-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
[18.0] [MIG] product_configurator: Migration to 18.0 #150
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
Make it classmethod to reuse it at every test setup step.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-configurator-16.0/product-configurator-16.0-product_configurator Translate-URL: https://translation.odoo-community.org/projects/product-configurator-16-0/product-configurator-16-0-product_configurator/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. 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/
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.
b52aeff
to
5faec59
Compare
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. |
No description provided.