Skip to content

Commit

Permalink
Merge PR #3447 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Oct 17, 2024
2 parents 245fd1f + 9c21e5a commit 65920b6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ def create(self, vals_list):
cfop_id = (
self.env["l10n_br_fiscal.cfop"].browse(cfop) if cfop else False
)
fiscal_operation_line_id = values.get("fiscal_operation_line_id")
fiscal_operation_line_id = (
self.env["l10n_br_fiscal.operation.line"].browse(
fiscal_operation_line_id
)
if fiscal_operation_line_id
else False
)

values.update(
self._get_amount_credit_debit_model(
move_id,
Expand All @@ -214,6 +223,7 @@ def create(self, vals_list):
company_id=move_id.company_id,
date=move_id.date,
cfop_id=cfop_id,
fiscal_operation_line_id=fiscal_operation_line_id,
)
)
self._inject_shadowed_fields(vals_list)
Expand Down Expand Up @@ -309,6 +319,7 @@ def write(self, values):
company_id=line.company_id,
date=line.date,
cfop_id=line.cfop_id,
fiscal_operation_line_id=line.fiscal_operation_line_id,
)
result |= super(AccountMoveLine, line).write(to_write)

Expand Down Expand Up @@ -599,6 +610,7 @@ def _get_amount_credit_debit(
company_id=None,
date=None,
cfop_id=None,
fiscal_operation_line_id=None,
):
self.ensure_one()
# The formatting was a little strange, but I tried to make it as close as
Expand All @@ -625,6 +637,9 @@ def _get_amount_credit_debit(
if date is None
else date,
cfop_id=self.cfop_id if cfop_id is None else cfop_id,
fiscal_operation_line_id=self.fiscal_operation_line_id
if fiscal_operation_line_id is None
else fiscal_operation_line_id,
)

def _get_amount_credit_debit_model(
Expand All @@ -639,6 +654,7 @@ def _get_amount_credit_debit_model(
company_id,
date,
cfop_id,
fiscal_operation_line_id,
):
if exclude_from_invoice_tab:
return {}
Expand All @@ -648,7 +664,11 @@ def _get_amount_credit_debit_model(
sign = -1
else:
sign = 1
if cfop_id and not cfop_id.finance_move:
if (cfop_id and not cfop_id.finance_move) or (
not cfop_id
and fiscal_operation_line_id
and not fiscal_operation_line_id.add_to_amount
):
amount_currency = 0
else:
if move_id.fiscal_operation_id.deductible_taxes:
Expand Down

0 comments on commit 65920b6

Please sign in to comment.