From a1592a9160ec44ad6ac7f4a1e41fa8d43d0c6830 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Tue, 26 Dec 2023 08:07:24 -0500 Subject: [PATCH] [16.0][FIX] account_avatax_oca, skip exception raise on lines with not product in display_type --- account_avatax_oca/models/account_move.py | 22 ++++++++++++++++++++++ account_avatax_oca/models/account_tax.py | 15 +++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/account_avatax_oca/models/account_move.py b/account_avatax_oca/models/account_move.py index b7238ae47..bf600b004 100644 --- a/account_avatax_oca/models/account_move.py +++ b/account_avatax_oca/models/account_move.py @@ -503,3 +503,25 @@ def onchange_reset_tax_amt(self): for line in self: line.avatax_amt_line = 0.0 line.move_id.avatax_amount = 0.0 + + # pylint: disable=W8110 + @api.depends( + "tax_ids", + "currency_id", + "partner_id", + "analytic_distribution", + "balance", + "partner_id", + "move_id.partner_id", + "price_unit", + "quantity", + ) + def _compute_all_tax(self): + for rec in self: + super( + AccountMoveLine, + self.with_context( + line_display_type=rec.display_type, + line_account_type=rec.account_type, + ), + )._compute_all_tax() diff --git a/account_avatax_oca/models/account_tax.py b/account_avatax_oca/models/account_tax.py index d10ca402d..65141c41b 100644 --- a/account_avatax_oca/models/account_tax.py +++ b/account_avatax_oca/models/account_tax.py @@ -82,6 +82,21 @@ def compute_all( fixed_multiplicator, ) avatax_invoice = self.env.context.get("avatax_invoice") + if ( + ( + "line_display_type" in self.env.context + and self.env.context.get("line_display_type") != "product" + ) + and "line_account_type" + and self.env.context.get("line_display_type") != "asset_receivable" + ): + # CHECK ME: Changes in 16 version, make compute taxes on all lines, + # included payment terms line, etc, but only + # product lines should pass + # by this validation or should be computed one by + # one with context we can know what line call + # this method + avatax_invoice = False if avatax_invoice: # Find the Avatax amount in the invoice Lines # Looks up the line for the current product, price_unit, and quantity