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

fix: write off amount on pos #45963

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

diptanilsaha
Copy link
Member

@diptanilsaha diptanilsaha commented Feb 17, 2025

Fixed write-off on POS, where the User can write off the change amount if paid using Cash Mode of Payment.

Co-authored by @devdiogenes

#45607

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Feb 17, 2025
@diptanilsaha diptanilsaha marked this pull request as ready for review February 18, 2025 06:33
@devdiogenes
Copy link
Contributor

Thanks for mentioning

@HarryPaulo
Copy link
Contributor

In this code block I see a conflict between the writeoff calculated on the POS invoice and the writeoff applied automatically...

if write_off_limit and abs(self.doc.outstanding_amount) <= write_off_limit:

I will run tests soon and put all the observation points here.

@diptanilsaha diptanilsaha marked this pull request as draft February 18, 2025 16:20
@diptanilsaha
Copy link
Member Author

@HarryPaulo Thank you for bringing this to my attention. It appears that the logic for consolidation is incorrect.

However, I believe there should be a limit on the write-off amount for each POS invoice. What do you think about this?

@diptanilsaha
Copy link
Member Author

@devdiogenes any updates?

@HarryPaulo
Copy link
Contributor

HarryPaulo commented Feb 19, 2025

Can a POS invoice be partially paid? i belive Yes.

I think the "write_off_limit" parameter can generate many operational errors, as it mischaracterizes what the user would have to apply when making the POS Invoice, looking at the outstanding balance according to a limit...

What if "write_off_limit" was a validation of the writeoff limit applied to POS Invoice and Sales Invoice instead of marking write_off_outstanding_amount_automatically?

Tomorrow I will take a few hours and get your code and do some testing

@HarryPaulo
Copy link
Contributor

HarryPaulo commented Feb 19, 2025

I understand the practicality of this parameter...

In the POS profile, the "write_off_limit" field should have its default value = 0, this would leave the feature disabled by default, if the user applied a limit value, the system would perform this "writeoff" automatically.

When applying the "write_off_outstanding_amount_automatically" the system must consider the "change_amount".

  1. When creating a sales invoice where is_pos=1 and is_consolidated=0, it must apply the rule to the sales invoice.

  2. When creating a POS invoice, it must apply the rule.

When consolidating, the system should only ADD the amounts made in the POS invoice and consolidate them in the sales invoices, I believe that it should not apply this writeoff rule.

@HarryPaulo
Copy link
Contributor

HarryPaulo commented Feb 24, 2025

I made a POS Invoice with grand total 18,90.

$20 was give as money, 0,1 write off and $1 change amount.

On cosolidate, change amount was wrong calculated,

Sales Invoice: $20 was give as money, 0,1 write off and $1,1 change amount.

20250224_110342.mp4

image

Resulting a wrong Outstanding Amount

@HarryPaulo
Copy link
Contributor

Change amount is not calculated correctly on try to create directly the sales, is impossible to set write off and change amount together

Examples:

Directly trying to set change amount and writeoff os Sales Invoice

20250224_122014.mp4

Directly trying to set change amount and writeoff os POS Invoice

20250224_122137.mp4

@HarryPaulo
Copy link
Contributor

Tryinig to use auto write off and set the change amount, not work too...

20250224_125256.mp4

@diptanilsaha
Copy link
Member Author

diptanilsaha commented Feb 24, 2025

@HarryPaulo Thanks for your feedback. I need some more time to complete this feature. Keep testing and let me know if you find any more bugs.

@diptanilsaha
Copy link
Member Author

diptanilsaha commented Mar 5, 2025

@HarryPaulo we are integrating Sales Invoice with POS. So, there might be some delay in releasing this feature as some rework might be required.

@HarryPaulo
Copy link
Contributor

@diptanilsaha POS Invoice will still exists? because POS invoice is very important for operations with big quantity of sales per day...

@diptanilsaha
Copy link
Member Author

Yes, the POS Invoice will be available. By default, the POS will use the POS Invoice. However, users can choose to use the Sales Invoice in the POS Profile Configurations.

@HarryPaulo
Copy link
Contributor

HarryPaulo commented Mar 5, 2025

image

We currently have two POS systems, the old Offline POS and the current online one.

For the offline POS, we use this option to define whether that environment will create a sales invoice or POS Invoice.

I don't know if it would be ideal to configure this in the POS Profile or in the POS Settings

However, when releasing your change, I will make the adaptations and follow the new format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants