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: POS consolidated invoice rounded total issue #28006

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

nemesis189
Copy link
Contributor

Ref issue: ISS-21-22-06296

Problem:
Consider the following 2 POS Invoices:

invoice 1:
Invoice 2:
Consolidated Invoice of the above two:
  • The total gets rounded in both the invoices and 0.50 is deducted from the total of both invoices
  • So the effect totals and the amount paid in both the invoices now are: 250 and 50
  • On consolidating these 2 invoices, the total becomes:
    250.5 + 50.5 = 301
  • The effective amount actually paid is 250+50 = 300, since the totals of individual invoices were rounded off
  • In the consolidated invoice, the paid amount is calculated by adding paid amounts from individual pos invoices
  • The amount to be paid in the consolidated sales invoice gets recalculated as 301 after merging the two POS invoices
  • Since only 300 was paid and the sales invoice has 301 as the amount to be paid, the consolidated invoice would remain in unpaid state and there would be an outstanding amount of Re. 1

Solution:

Fixed Consolidated Invoice of the above two:
  • Adding the Rounding Adjustment and Rounded Total of the individual POS invoices while merging to calculate the same for Consolidated Invoice
  • In calculate_taxes method, rounding adjustment was being overriden so bypassed that for consolidated invoices
  • In calculate_totals method, total_taxes_and_charges was being calculated even when there were no taxes applied, so added a condition for the same

@codecov
Copy link

codecov bot commented Oct 19, 2021

Codecov Report

Merging #28006 (b5b0039) into develop (7acdcc7) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #28006      +/-   ##
===========================================
- Coverage    54.43%   54.41%   -0.03%     
===========================================
  Files         1254     1255       +1     
  Lines        67717    67838     +121     
===========================================
+ Hits         36861    36911      +50     
- Misses       30856    30927      +71     
Impacted Files Coverage Δ
...ype/pos_invoice_merge_log/pos_invoice_merge_log.py 75.65% <100.00%> (+0.94%) ⬆️
erpnext/controllers/taxes_and_totals.py 97.63% <100.00%> (+0.02%) ⬆️
...ctype/product_tax_category/product_tax_category.py 0.00% <0.00%> (-100.00%) ⬇️
...rations/doctype/taxjar_settings/taxjar_settings.py 29.50% <0.00%> (-70.50%) ⬇️
...ctype/woocommerce_settings/woocommerce_settings.py 80.39% <0.00%> (-3.93%) ⬇️
...e/asset_value_adjustment/asset_value_adjustment.py 87.80% <0.00%> (-3.66%) ⬇️
...eport/item_variant_details/item_variant_details.py 84.52% <0.00%> (-3.58%) ⬇️
erpnext/shopping_cart/utils.py 32.14% <0.00%> (-3.58%) ⬇️
...wise_balance_history/batch_wise_balance_history.py 91.52% <0.00%> (-1.70%) ⬇️
erpnext/stock/report/stock_ledger/stock_ledger.py 78.33% <0.00%> (-1.67%) ⬇️
... and 35 more

@nextchamp-saqib nextchamp-saqib self-assigned this Oct 25, 2021
@nextchamp-saqib nextchamp-saqib merged commit 75a76e6 into frappe:develop Oct 29, 2021
@nextchamp-saqib
Copy link
Member

@Mergifyio backport version-13-hotfix

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2021

backport version-13-hotfix

✅ Backports have been created

@nemesis189 nemesis189 added this to the v13.15 milestone Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants