account-invoicing icon indicating copy to clipboard operation
account-invoicing copied to clipboard

[IMP] account_global_discount: Set to zero global discount.

Open alfredoavanzosc opened this issue 3 years ago • 5 comments

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.

alfredoavanzosc avatar Mar 25 '21 09:03 alfredoavanzosc

@pedrobaeza , @alexis-via , review please.

alfredoavanzosc avatar Mar 26 '21 08:03 alfredoavanzosc

It should be @anajuaristi who should check if this fixes her problem.

pedrobaeza avatar Mar 26 '21 08:03 pedrobaeza

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

anajuaristi avatar Mar 26 '21 15:03 anajuaristi

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

anajuaristi avatar Mar 26 '21 15:03 anajuaristi

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.

greciosd avatar Sep 16 '22 09:09 greciosd

@pedrobaeza I also approved the PR. Let's see if it can be merged

anajuaristi avatar Mar 28 '23 10:03 anajuaristi

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). 🤖

OCA-git-bot avatar Mar 28 '23 10:03 OCA-git-bot

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

pedrobaeza avatar Mar 28 '23 11:03 pedrobaeza

On my way to merge this fine PR! Prepared branch 12.0-ocabot-merge-pr-900-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot avatar Mar 28 '23 11:03 OCA-git-bot

Congratulations, your PR was merged at f54a799a125e4f0af5ec75832303cde7d05e22d2. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Mar 28 '23 12:03 OCA-git-bot