Skip to content

Commit

Permalink
teste def write
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Apr 26, 2024
1 parent fa6ea5e commit 97de7e7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,22 @@ def create(self, vals_list):
# the creation of l10n_br_fiscal.document.line as it would mess the association
# of the remaining fiscal document lines with their proper aml. That's why we
# remove the useless fiscal document lines here.
moves_to_recompute = []
recompute_dynamic_lines = False
for line in results:
if not line.exclude_from_invoice_tab:
recompute_dynamic_lines = True
moves_to_recompute.append(line.move_id)
line.with_context(check_move_validity=False)._onchange_price_subtotal()
if not line.move_id.fiscal_document_id or line.exclude_from_invoice_tab:
fiscal_line_to_delete = line.fiscal_document_line_id
line.fiscal_document_line_id = False
fiscal_line_to_delete.sudo().unlink()
if line and recompute_dynamic_lines:
line.move_id.with_context(
check_move_validity=False
)._recompute_dynamic_lines(recompute_all_taxes=True)
if moves_to_recompute and recompute_dynamic_lines:
for move in moves_to_recompute:
move.with_context(check_move_validity=False)._recompute_dynamic_lines(
recompute_all_taxes=True
)

return results

Expand Down

0 comments on commit 97de7e7

Please sign in to comment.