Skip to content

Commit

Permalink
[FIX] sale_order_type: Incompatibility with l10n_latam_check module
Browse files Browse the repository at this point in the history
This is a work-in-progress PR and is not yet finished.

When adding a dependency to the _compute_journal_id method, it breaks the functionality of the l10n_latam_check module when calculating the l10n_latam_check_issuer_vat field during the creation of a third-party check payment.

Steps to reproduce:

Create a payment.
Choose a third-party check journal.
Modify the l10n_latam_check_issuer_vat issuer.
Save the payment.
The l10n_latam_check_issuer_vat field is recomputed.
  • Loading branch information
maq-adhoc committed Jan 29, 2025
1 parent 3607581 commit 1ab794f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sale_order_type/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ def _compute_invoice_payment_term_id(self):
move.invoice_payment_term_id = move.sale_type_id.payment_term_id
return res

@api.depends("sale_type_id")
def _compute_journal_id(self):
def _search_default_journal(self):
res = super()._compute_journal_id()
for move in self.filtered("sale_type_id.journal_id"):
move.journal_id = move.sale_type_id.journal_id
sale_type_journal_id = self.sale_type_id.journal_id
if sale_type_journal_id and sale_type_journal_id in self.suitable_journal_ids:
return sale_type_journal_id
return res

@api.onchange("sale_type_id")
def _onchange_sale_type_id(self):
sale_type_journal_id = self.sale_type_id.journal_id
if sale_type_journal_id and sale_type_journal_id in self.suitable_journal_ids:
self.journal_id = sale_type_journal_id.id

0 comments on commit 1ab794f

Please sign in to comment.