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 build #1521

Merged

Conversation

simahawk
Copy link
Contributor

@simahawk simahawk commented Feb 19, 2024

Tackling some issues from #1513

@OCA-git-bot
Copy link
Contributor

Hi @legalsylvain,
some modules you are maintaining are being modified, check this out!

@legalsylvain
Copy link
Contributor

Thanks !

@legalsylvain
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-1521-by-legalsylvain-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Feb 19, 2024
Signed-off-by legalsylvain
@OCA-git-bot
Copy link
Contributor

@legalsylvain your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-1521-by-legalsylvain-bump-patch.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@simahawk
Copy link
Contributor Author

There's an unrelated error on abc_classification_product_level
https://github.com/OCA/product-attribute/actions/runs/7955666562/job/21715009413?pr=1521#step:8:480

@legalsylvain
Copy link
Contributor

There's an unrelated error on abc_classification_product_level

The error is in the module product_abc_classification

@rousseldenis, @lmignon @MiquelRForgeFlow, @lmarion-source

could you take a look ?
thanks !

@simahawk
Copy link
Contributor Author

There's an unrelated error on abc_classification_product_level

The error is in the module product_abc_classification

@rousseldenis, @lmignon @MiquelRForgeFlow, @lmarion-source

could you take a look ? thanks !

I'm on it

@simahawk
Copy link
Contributor Author

Now the issue is on product_supplierinfo_for_customer

@simahawk
Copy link
Contributor Author

simahawk commented Feb 21, 2024

To me the domain used to look for the customer info is wrong.
Failing test:

image

This means that the selected customer info should be the one w/ price = 100.0 because is the one assigned to the specific variant. However, the selection gives you back the generic price:

(Pdb++) product._select_customerinfo(partner=self.customer).price
30.0

When I look at the domain it seems wrong

Pdb++) product._prepare_domain_customerinfo({"partner_id": self.customer.id})
[('partner_id', '=', 49), '|', ('product_id', '=', 49), '&', ('product_tmpl_id', '=', 32), ('product_id', '=', False)]

By logic, I assume we should have an AND w/ partner and product and fallback w/ the OR. However I don't know this module at all...

@pedrobaeza @sergio-teruel @MiquelRForgeFlow @AaronHForgeFlow anyone can provide some feedback?

@simahawk simahawk changed the title [16.0] product_pricelist_simulation*: fix Monetary field warning [16.0] Fix build Feb 21, 2024
@pedrobaeza
Copy link
Member

In a first sight, I don't see the domain incorrect. It's saying that:

  • The partner should be 49
  • And then, comply with one on these criteria:
    • The product is 49
    • Or the product is empty and the product template is 32, which should be the template for product 49

The only weird thing is that the partner ID and the product ID is the same, but reading the code, it seems legit.

@simahawk
Copy link
Contributor Author

IMO there's something wrong because even if I have 2 records matching the partner and only one of them matches the variant I get the generic one (matching only the tmpl) as a result. Hence, I assume the domain is wrong.

@pedrobaeza
Copy link
Member

@victoralmau
Copy link
Member

IMO the solution for product_supplierinfo_for_customer is to set a sequnce for each element of product.customerinfo (sequence: 10 and sequence: 20 respectively for example).

@AaronHForgeFlow
Copy link
Contributor

AaronHForgeFlow commented Feb 27, 2024

I think the matching of the variant is more important than the template. Perhaps the sorting is incorrect. Created PR with this: camptocamp#4

@pedrobaeza
Copy link
Member

@victoralmau see my previous comments. Anyway, you can exercise the solution in one PR if you see it's the proper one.

@pedrobaeza
Copy link
Member

Fixed in #1528, although the solution doesn't convince me too much I have to say, as this reveals a flaw in the design.

@AaronHForgeFlow
Copy link
Contributor

Tested in my local with this: camptocamp#4 and test were not failing

@pedrobaeza
Copy link
Member

But that's not very optimal in performance. We should try to avoid several filtered.

@AaronHForgeFlow
Copy link
Contributor

AaronHForgeFlow commented Feb 29, 2024

@pedrobaeza after @lmignon suggestion it works the same without the use of filtered: https://github.com/camptocamp/product-attribute/pull/4/files

@pedrobaeza
Copy link
Member

Can you gather all and rebase for getting the proper solution?

@AaronHForgeFlow
Copy link
Contributor

Can you gather all and rebase for getting the proper solution?

Hi @pedrobaeza is this comment in regards my PR? I am afraid I did not get what you mean.

@pedrobaeza
Copy link
Member

Yes, I mean to put here in this PR (by @simahawk or someone else) the needed things to get such proper code.

@simahawk
Copy link
Contributor Author

I'll cherry-pick camptocamp#4

simahawk and others added 4 commits February 29, 2024 11:28
Monetary fields do not have any digits attribute
since their precision comes from the currency.

There's also no need to specify a currency field
when currency_id is available on the model.
The test on unicity constraint is passing but the error log from the ORM
must be muted to not get a false negative.
@simahawk simahawk force-pushed the 16-fix-product_pricelist_simulation-monetary branch from b414318 to 03d244c Compare February 29, 2024 10:29
@simahawk
Copy link
Contributor Author

Are we all fine w/ these fixes?

@pedrobaeza pedrobaeza added this to the 16.0 milestone Feb 29, 2024
@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-1521-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 26fccb0 into OCA:16.0 Feb 29, 2024
7 of 9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c302a0e. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.

8 participants