Skip to content

Commit

Permalink
When set the invoce to draft, and move the "account move" related fro…
Browse files Browse the repository at this point in the history
…m the

move field to the alternatives_moves and recocnile with the new one, remove
from this 2 account move the tax lines related, so they not apply in the
303 model, for example. The new move will do.
  • Loading branch information
bernatnan committed Oct 8, 2024
1 parent 8adc93d commit e15e64d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def draft(cls, invoices):
pool = Pool()
Move = pool.get('account.move')
MoveLine = pool.get('account.move.line')
TaxLine = pool.get('account.tax.line')

to_draft = []
to_save = []
Expand Down Expand Up @@ -90,13 +91,18 @@ def draft(cls, invoices):

for invoice in to_save:
to_reconcile = []
tax_line_to_delete = []
for move in invoice.additional_moves:
for line in move.lines:
if (not line.reconciliation
and line.account == invoice.account):
to_reconcile.append(line)
if line.tax_lines:
tax_line_to_delete.extend(line.tax_lines)
if to_reconcile:
MoveLine.reconcile(to_reconcile)
if tax_line_to_delete:
TaxLine.delete(tax_line_to_delete)

# Remove links to lines which actually do not pay the invoice
if to_save:
Expand Down

0 comments on commit e15e64d

Please sign in to comment.