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

Conversation

lekha-sydney-tools
Copy link

@lekha-sydney-tools lekha-sydney-tools commented Oct 17, 2024

[16.0] [FIX] purchase_request: Invalid Operator - Typo "=?" change to "="

Operator Updated
@lekha-sydney-tools lekha-sydney-tools changed the title Operator fix [16.0][FIX] Operator fix Oct 17, 2024
@luke-stdev001
Copy link

@lekha-sydney-tools from our team has come across this operator typo in the code which results in an 'operation not supported' error when trying to trigger the Create RFQ button in the Create RFQ wizard as shown (apologies for the messy screenshot):

Screenshot 2024-10-17 at 1 12 56 pm

If anyone is available to give this a quick review to get this typo fix merged? It would be great to get this fixed upstream here so we can get rid of our local copy of this fix and just pull the latest from this repo.

@lekha-sydney-tools lekha-sydney-tools changed the title [16.0][FIX] Operator fix [16.0] [FIX] purchase_request: Invalid Operator - Typo "=?" change to "=" Oct 17, 2024
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

See comment below.

@@ -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.

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