account-invoicing
account-invoicing copied to clipboard
[IMP] account_global_discount: Set to zero global discount.
invoice_global_discount_ids is correctly emptied but amount_global_discount and amount_untaxed_before_global_discounts are not being recomputed or set to zero, so the global discount amount is staying on invoice causing incorrect amount.
@pedrobaeza , @alexis-via , review please.
It should be @anajuaristi who should check if this fixes her problem.
Hi Pedro. Tested in http://3473816-900-65a3b0.runbot1.odoo-community.org/?
Invoiced sale order with global discount --> On invoice:
Untaxed Amount Before Disc. | $ 37,500.00 |
---|---|
Global Discounts | $ -3,750.00 |
Untaxed Amount | $ 33,750.00 |
Tax | $ 5,062.50 |
Total | $ 38,812.50 |
After erasing the discount:
Untaxed Amount | $ 33,750.00 |
---|---|
Tax | $ 5,625.00 |
Total | $ 39,375.00 |
So, it seems the fix is not solving the problem.
The fields are not being recomputed pushing any button. but... By the moment I have found a simple way to set those fields to Zero, and it is...
- just define a new global discount 0%
- Asign that discount to invoice --> Fields are perfectly recalculated
- Erase 0% discount So.. functionally it works but technically the error is still there. We will see it again next week. Thank you: Ana
I think it could be the same fix in line 50 we can see
def _set_global_discounts_by_tax(self):
"""Create invoice global discount lines by taxes combinations and
discounts.
"""
self.ensure_one()
if not self.global_discount_ids:
return
Maybe it should also be:
def _set_global_discounts_by_tax(self):
"""Create invoice global discount lines by taxes combinations and
discounts.
"""
self.ensure_one()
if not self.invoice_global_discount_ids:
self.amount_global_discount = 0.0
self.amount_untaxed_before_global_discounts = 0.0
return
We will try with this next week
Hello.
I recently used the latest version of the account_global_discount module for version 12 and got this error. Is there any news about its correction?
Thanks.
@pedrobaeza I also approved the PR. Let's see if it can be merged
This PR has the approved
label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖
OK, I'm not using anymore 12.0, although it seems a bit weird, as pre-v13 resets the values of each compute to the default one, but it doesn't hurt:
/ocabot merge patch
On my way to merge this fine PR! Prepared branch 12.0-ocabot-merge-pr-900-by-pedrobaeza-bump-patch, awaiting test results.
Congratulations, your PR was merged at f54a799a125e4f0af5ec75832303cde7d05e22d2. Thanks a lot for contributing to OCA. ❤️