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

[16.0] l10n_br_fiscal: Renomeação de métodos compute para evitar ambiguidades em heranças de modelos #3549

Merged
merged 6 commits into from
Dec 18, 2024
Merged
1 change: 1 addition & 0 deletions l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def _get_view(self, view_id=None, view_type="form", **options):
)
def _compute_amount(self):
for move in self.filtered(lambda m: m.fiscal_operation_id):
move._compute_fiscal_amount()
for line in move.line_ids:
if (
move.is_invoice(include_receipts=True)
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account/tests/test_account_move_lc.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def test_venda_with_icms_reduction_with_relief(self):
# Testando com Alivio do ICMS
self.move_out_venda_with_icms_reduction.invoice_line_ids[0].icms_relief_id = 1
self.move_out_venda_with_icms_reduction.invoice_line_ids._onchange_fiscal_taxes()
self.move_out_venda_with_icms_reduction.line_ids._compute_amounts()
self.move_out_venda_with_icms_reduction.line_ids._compute_fiscal_amounts()

product_line_vals_1 = {
"name": self.product_a.display_name,
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_fiscal/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ def _compute_name(self):
"fiscal_line_ids.amount_tax_not_included",
"fiscal_line_ids.amount_tax_withholding",
)
def _compute_amount(self):
return super()._compute_amount()
def _compute_fiscal_amount(self):
return super()._compute_fiscal_amount()

@api.model_create_multi
def create(self, vals_list):
Expand Down
18 changes: 9 additions & 9 deletions l10n_br_fiscal/models/document_line_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _operation_domain(self):
)

amount_fiscal = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

price_gross = fields.Monetary(
Expand All @@ -201,38 +201,38 @@ def _operation_domain(self):
"Total value of products or services (quantity x unit price)"
"before any discounts."
),
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

amount_untaxed = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

amount_tax = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

amount_taxed = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

amount_total = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

financial_total = fields.Monetary(
string="Amount Financial",
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

financial_total_gross = fields.Monetary(
string="Financial Gross Amount",
help="Total amount before any discounts are applied.",
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

financial_discount_value = fields.Monetary(
compute="_compute_amounts",
compute="_compute_fiscal_amounts",
)

amount_tax_included = fields.Monetary()
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_fiscal/models/document_line_mixin_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _get_view(self, view_id=None, view_type="form", **options):
"price_unit",
"quantity",
)
def _compute_amounts(self):
def _compute_fiscal_amounts(self):
for record in self:
round_curr = record.currency_id or self.env.ref("base.BRL")

Expand Down
Loading
Loading