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] purchase_request: Invalid Operator - Typo "=?" change to "=" #2435

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _get_order_line_search_domain(self, order, item):
("name", "=", name),
("product_id", "=", item.product_id.id),
("product_uom", "=", vals["product_uom"]),
("analytic_distribution", "=?", item.line_id.analytic_distribution),
("analytic_distribution", "=", item.line_id.analytic_distribution),
Copy link
Member

@StefanRijnhart StefanRijnhart Oct 17, 2024

Choose a reason for hiding this comment

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

It is not a typo. =? is a valid operator: https://github.com/odoo/odoo/blob/16.0/odoo/osv/expression.py#L1120-L1122

But the analytic distribution is a tricky field, and I assume the operator may well be buggy in this case. To emulate the behaviour of the operator, you need to include this clause in the domain optionally (i.e. if item.line_id.analytic_distribution has any content).

And as always in case of a bugfix, please try and reproduce the bug in a test.

]
if self.sync_data_planned:
date_required = item.line_id.date_required
Expand Down
Loading