From f170cb896b9a48dac004bdff0eb2aaf4e136e7dc Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Fri, 29 Nov 2024 15:35:55 -0300 Subject: [PATCH] [FIX] l10n_br_sale:ind_final after partner invoice --- l10n_br_sale/models/sale_order.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/l10n_br_sale/models/sale_order.py b/l10n_br_sale/models/sale_order.py index 98ce12dc2ae5..71f6d6a963db 100644 --- a/l10n_br_sale/models/sale_order.py +++ b/l10n_br_sale/models/sale_order.py @@ -269,3 +269,12 @@ def _get_fiscal_partner(self): partner = self.partner_invoice_id return partner + + @api.onchange("partner_id") + def _onchange_partner_id_fiscal(self): + if self.partner_id: + # Necessário chamar o onchange para preencher o partner_invoice_id + # antes do Mix Fiscal e ter o ind_final correto + # TODO: teria outra forma com menos código? + self.onchange_partner_id() + return super()._onchange_partner_id_fiscal()