Skip to content

Commit 1ab794f

Browse files
committed
[FIX] sale_order_type: Incompatibility with l10n_latam_check module
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.
1 parent 3607581 commit 1ab794f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sale_order_type/models/account_move.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ def _compute_invoice_payment_term_id(self):
4848
move.invoice_payment_term_id = move.sale_type_id.payment_term_id
4949
return res
5050

51-
@api.depends("sale_type_id")
52-
def _compute_journal_id(self):
51+
def _search_default_journal(self):
5352
res = super()._compute_journal_id()
54-
for move in self.filtered("sale_type_id.journal_id"):
55-
move.journal_id = move.sale_type_id.journal_id
53+
sale_type_journal_id = self.sale_type_id.journal_id
54+
if sale_type_journal_id and sale_type_journal_id in self.suitable_journal_ids:
55+
return sale_type_journal_id
5656
return res
57+
58+
@api.onchange("sale_type_id")
59+
def _onchange_sale_type_id(self):
60+
sale_type_journal_id = self.sale_type_id.journal_id
61+
if sale_type_journal_id and sale_type_journal_id in self.suitable_journal_ids:
62+
self.journal_id = sale_type_journal_id.id

0 commit comments

Comments
 (0)