-
-
Notifications
You must be signed in to change notification settings - Fork 84
[18.0] [MIG] product_configurator: Migration to 18.0 #150
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: 18.0
Are you sure you want to change the base?
[18.0] [MIG] product_configurator: Migration to 18.0 #150
Conversation
…ct_configurator_purchase : create test case for after or before validate the product then it id or sol is equal or not
…late and product functionality
…duct_weight_extra method
…duct config and product product
…bute and compute_domain and solved the error come in _check_constraint_min_max_value method
…g them in website module
Currently translated at 100.0% (235 of 235 strings) Translation: product-configurator-17.0/product-configurator-17.0-product_configurator Translate-URL: https://translation.odoo-community.org/projects/product-configurator-17-0/product-configurator-17-0-product_configurator/it/
5bf3c75
to
439b635
Compare
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.
Thanks for the work done! 🙏🏻
@@ -421,7 +422,10 @@ def get_cfg_weight(self, value_ids=None, custom_vals=None): | |||
|
|||
self = self.with_context(active_id=product_tmpl.id) | |||
|
|||
value_ids = flatten(value_ids) | |||
# Use the updated flatten method (using itertools.chain) |
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.
# Use the updated flatten method (using itertools.chain) |
no need to clarify this in the code
value_ids = flatten(value_ids) | ||
# Use the updated flatten method (using itertools.chain) | ||
value_ids = list( | ||
chain.from_iterable(v if isinstance(v, list) else [v] for v in value_ids) |
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.
Consider also other iterables (ie: tuple)
from collections.abc import Iterable
chain.from_iterable(v if isinstance(v, list) else [v] for v in value_ids) | |
chain.from_iterable(v if isinstance(v, Iterable) else [v] for v in value_ids) |
@@ -504,8 +508,6 @@ def _compute_currency_id(self): | |||
product_preset_id = fields.Many2one( | |||
comodel_name="product.product", | |||
string="Preset", | |||
domain="[('product_tmpl_id', '=', product_tmpl_id),\ | |||
('config_preset_ok', '=', True)]", |
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.
What's the motivation for removing the domain here and moving it to the view? 🤔
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.
We will have to move the domain to the level of XML
As in v18, domains based on related fields are not carried forward. https://github.com/odoo/odoo/blob/18.0/odoo/fields.py#L3067
product_preset_id field is defined at the product.config.session level and the product.configurator inherits the original object. Which makes that field related.
open_step_lines = list( | ||
map(lambda x: "%s" % (x), self.get_open_step_lines().ids) | ||
) | ||
open_step_lines = list(map(lambda x: f"{x}", self.get_open_step_lines().ids)) |
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.
open_step_lines = list(map(lambda x: f"{x}", self.get_open_step_lines().ids)) | |
open_step_lines = list(map(str, self.get_open_step_lines().ids)) |
@@ -1173,7 +1173,7 @@ def check_and_open_incomplete_step(self, value_ids=None, custom_value_ids=None): | |||
step_to_open = step | |||
break | |||
if step_to_open: | |||
return "%s" % (step_to_open.id) | |||
return f"{step_to_open.id}" |
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.
str(step_to_open.id)
} | ||
} | ||
|
||
.pull-right { |
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.
We can just use bootstrap's float-end
class and remove this one
|
||
from lxml import etree | ||
|
||
from odoo import _, api, fields, models |
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.
Use self.env._
instead
|
||
TODO: This only works when activating the selection not when typing | ||
""" | ||
product_tmpl_id = self.env.context.get("_cfg_product_tmpl_id") |
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.
Can we take the opportunity to write unit tests for this method? 🙏🏻
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.
We take care of the test cases also in this MR
] | ||
return prices | ||
|
||
def encode_custom_values(self, custom_vals): |
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 this method actually used somewhere? 🤔
if not, let's remove it
) | ||
return list(flat_val_ids) | ||
|
||
def formatPrices(self, prices=None, dp="Product Price"): |
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 this method actually used somewhere? 🤔
if not, let's remove it
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.
In the core modules, it is not used, But I still remember some of the custom modules and other companies were also using this method in their modules.
5faec59
to
16a3618
Compare
@ivantodorovich Thank you so much for your review and for pointing out the missing points and improvements. We have made the necessary changes. |
16a3618
to
5ee2444
Compare
5ee2444
to
65d031f
Compare
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.
Thanks!
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.
Functional test OK on the base data part of the product configurator. Variant management, restrictions, images, and names are handled. Test based on the PR available on the runbot (MRP). The sales part is still missin
@yterrettaz |
Yes, with pleasure, but I don't have a runbot for that yet. |
Hello, I would like to suggest a commit. The changes concern an optimization that avoid the recompute of the attribute's conditions for every view generation. These are now computed and stored on the product.template.attribute.line. The difference is notable mainly for complexe configuration and for the portal part. Secondly, the changes split the compute of the conditions into three distinct methods, it should be easier to inherit them to have more complexe attribute's conditions. |
This change make the required, readonly and invisible conditions easier to understand. |
@BenjaHe We will check and test for functionality and performance. also might be for future compatibility for website module. |
@bizzappdev Any news on the handling of the proposed patch? |
I just opened an issue for version 18 -> #161 |
@gurneyalex We have scheduled this for this week's sprint. Most probably it will be ready by next Monday |
No description provided.