Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] sale_order_type: Avoid unwanted triggering of compute functions #3321

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

grindtildeath
Copy link
Contributor

Having account.move._compute_journal_id overriden with an added dependency to sale_type_id is messing with computation triggers, because compute functions depending on journal_id will get recomputed, potentially overwriting existing value, as is the case with bank account on account.payment.

Use instead the hook to search for default journal, in order to return the journal defined on sale order type to its compute function.

Having account.move._compute_journal_id overriden with an added
dependency to sale_type_id is messing with computation triggers,
because compute functions depending on journal_id will get recomputed,
potentially overwriting existing value, as is the case with
bank account on account.payment.

Use instead the hook to search for default journal, in order to return
the journal defined on sale order type to its compute function.
# trigger unwanted recomputation of partner_bank_id on vendor bills
self.env.add_to_compute(
self.env["account.move"]._fields["journal_id"], record
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful, AFAIK, when using add_to_compute, the field dependencies aren't recomputed unless you explicitly call modified, too.

@grindtildeath
Copy link
Contributor Author

Since Odoo accepted my fix and fast tracked it, I'm not sure if this change is still needed ❓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants