Skip to content

Commit

Permalink
Merge commit 'refs/pull/2683/head' of https://github.com/oca/sale-wor…
Browse files Browse the repository at this point in the history
…kflow into 16.0-3641
  • Loading branch information
docker-odoo committed Sep 12, 2023
2 parents 0313bd1 + b30d597 commit c52982c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sale_order_type/models/account_move.py
Expand Up @@ -56,9 +56,11 @@ 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):
res = super()._compute_journal_id()
@api.onchange("sale_type_id")
def _onchange_sale_type(self):
"""It's not ideal to use an onchange instead inheriting the compute.
But when using the compute somthing is broken and, for example,
duplicating and internal transfer and trying to re-post will bring
an error because of currency_id not computed"""
for move in self.filtered("sale_type_id.journal_id"):
move.journal_id = move.sale_type_id.journal_id
return res
move.journal_id = move.sale_type_id.journal_id.id

0 comments on commit c52982c

Please sign in to comment.