Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TakePOS: Fix bug when attempting to pay a credit note invoice #32233

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NextGestion
Copy link
Contributor

TakePOS: Fix bug when attempting to pay a credit note invoice

@NextGestion
Copy link
Contributor Author

Hello @eldy,

Can you check this PR #32233 , and see if it can be merged?

Thank you

@eldy
Copy link
Member

eldy commented Dec 6, 2024

Hello @eldy,

Can you check this PR #32233 , and see if it can be merged?

Thank you

Can you describe the use case. How do you get a credit note invoice in the POS ? It seems you can only generate standard invoice. What steps do you do ?

@NextGestion
Copy link
Contributor Author

Hello @eldy ,

Please follow the steps below :

  • In TakePOS, pay a standard invoice
  • Click the "Create credit note" button
    image

htdocs/takepos/invoice.php :

image

  • Attempt to pay the credit note invoice
  • You will face the issue below :
    image

@eldy
Copy link
Member

eldy commented Dec 9, 2024

I see, it seems this implementation of credit note in takepos is not yet complete. When we go on the button "Pay", we still have label "received" when we should have refund. A lot of this are still wrong.
For the fix you suggest, i suggest instead to make 1 common test using abs to use 2 different tests depending on type of invoice so we keep the protection to avoid to pay a standard invoice if amount is negative.

So
if $invoice->getRemainToPay() > 0) {
become

if (($invoice->getRemainToPay() > 0 && $invoice->type == Facture::TYPE_STANDARD)
||($invoice->getRemainToPay() < 0 && $invoice->type == Facture::TYPE_CREDITNOTE))  {

of your PR,

@eldy eldy added the PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do) label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants