Skip to content

Commit

Permalink
[IMP] auto reconcile credit note to origin invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
cpintofonseca committed Oct 20, 2023
1 parent a5fa8f7 commit eef5431
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions l10n_pt_account_invoicexpress/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,15 @@ def create_credit_note(self, lines):
],
})

# Post and reconcile credit note
if l10npt_vat_exempt_reason:
credit_note.action_post()

Check warning on line 374 in l10n_pt_account_invoicexpress/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_pt_account_invoicexpress/models/account_move.py#L374

Added line #L374 was not covered by tests

outstanding_lines = credit_note.line_ids

Check warning on line 376 in l10n_pt_account_invoicexpress/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_pt_account_invoicexpress/models/account_move.py#L376

Added line #L376 was not covered by tests
outstanding_lines = outstanding_lines.filtered(lambda l: float_compare(l.balance, 0.0, 2) < 0)
for outstanding_line in outstanding_lines:
self.js_assign_outstanding_line(outstanding_line.id)

Check warning on line 379 in l10n_pt_account_invoicexpress/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_pt_account_invoicexpress/models/account_move.py#L379

Added line #L379 was not covered by tests

def _track_subtype(self, init_values):
res = super()._track_subtype(init_values)
if "payment_state" in init_values and self.payment_state == "paid":
Expand Down

0 comments on commit eef5431

Please sign in to comment.