-
-
Notifications
You must be signed in to change notification settings - Fork 385
[15.0][MIG] sale_commission_product_criteria: Migration to 15.0 #636
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
base: 15.0
Are you sure you want to change the base?
[15.0][MIG] sale_commission_product_criteria: Migration to 15.0 #636
Conversation
Currently translated at 100.0% (65 of 65 strings) Translation: commission-14.0/commission-14.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_product_criteria/it/
Currently translated at 100.0% (65 of 65 strings) Translation: commission-14.0/commission-14.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_product_criteria/es/
Currently translated at 100.0% (65 of 65 strings) Translation: commission-14.0/commission-14.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_product_criteria/it/
Currently translated at 100.0% (65 of 65 strings) Translation: commission-14.0/commission-14.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_product_criteria/it/
Currently translated at 100.0% (64 of 64 strings) Translation: commission-14.0/commission-14.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_product_criteria/it/
e4ecd04 to
c2ab1a8
Compare
| _name = "commission.item" | ||
| _description = "Commission Item" | ||
| _order = "applied_on, based_on, categ_id desc, id desc" | ||
| _order = "applied_on, based_on, category_complete_name desc, id desc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this change, but change _order of the category itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's more convenient to change the order of the category than to add this order at the commission.item level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why the default category order is not valid? It should be...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, adding a many2one field in the order evaluates the ID of the related record, but what we need is for it to be ordered by grandchild > child > parent. If we create the child record first, then the parent, and then the grandchild, the order would be incorrect (grandchild > parent > child). By ordering by complete_name (as categories do), we solve the problem. Am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding a many2one, first you get the IDs ordered by their native model order, and then it's applied here, so you don't need to reorder them (this also means 2 queries, but Odoo does it this way for UX convenience).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change leads to worse performance at a rather delicate moment, but if you want we can leave it for the time being until we can measure it in an instance with a lot of records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the number of records to be very high for the commission definition? Do you think it has a big impact? Other thing it can be done is to put auto_joint=True on categ_id for resolving everything in one query.
sale_commission_product_criteria/models/sale_commission_line_mixin.py
Outdated
Show resolved
Hide resolved
c2ab1a8 to
aee82ad
Compare
aee82ad to
595b009
Compare
| _name = "commission.item" | ||
| _description = "Commission Item" | ||
| _order = "applied_on, based_on, categ_id desc, id desc" | ||
| _order = "applied_on, based_on, category_complete_name desc, id desc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the number of records to be very high for the commission definition? Do you think it has a big impact? Other thing it can be done is to put auto_joint=True on categ_id for resolving everything in one query.
595b009 to
bdb5a88
Compare
bdb5a88 to
f868e6b
Compare
This PR supersedes #631 to replace the use of
SQLwith afiltered_domainon the commission items. The authorship of the migration commit has been preserved.cc @Tecnativa TT57153
ping @carlosdauden @pedrobaeza @PolComas