-
-
Notifications
You must be signed in to change notification settings - Fork 711
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
[17.0][MIG] product_company_default: Migration to 17.0 #1815
base: 17.0
Are you sure you want to change the base?
Conversation
Currently translated at 100.0% (2 of 2 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_company_default Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_company_default/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.
LGTM, tested in runboat
/ocabot migration product_company_default |
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.
@@ -0,0 +1,2 @@ | |||
This module populates the company field with user's company as the |
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 is not what the module does. Is it normal ?
Moreover, using the config parameter with a company that is not enabled on user that creates the product can leads to UX problems.
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 think the current description is not accurate. Should be "the current active one" instead of "user's company."
Moreover, using the config parameter with a company that is not enabled on user that creates the product can leads to UX problems.
@rousseldenis I'm not getting this comment. The config parameter doesn't depend on the company.
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.
(Aung Ko Ko Lin is on leave for a while.)
@@ -0,0 +1,2 @@ | |||
This module populates the company field with user's company as the |
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 think the current description is not accurate. Should be "the current active one" instead of "user's company."
Moreover, using the config parameter with a company that is not enabled on user that creates the product can leads to UX problems.
@rousseldenis I'm not getting this comment. The config parameter doesn't depend on the company.
Of course. But:
What will happen as this will set the company 1 for this new product ? |
@rousseldenis The config param just enables the feature. It's not setting the default company. |
Ooops, I'm tired 😅 |
There's no sense in having a global config parameter for disabling the feature. If you don't want the feature, just don't install the module. If it's a trick for testing together with other modules, just do something like: company_id = fields.Many2one(default=lambda self: self._default_company_id())
@api.model
def _default_company_id(self):
context = self.env.context
if (
config["test_enable"]
and not context.get("test_product_company_default")
):
return False
return self.env.company |
Don"t agree at all. It's anti-programatic to rely on tests in business code. |
That's your opinion, and I already know it, but it's just a line and avoid incompatibilities in the tests that lead to split CIs. And more in this case, where it's not a module incompatibility. Just test issues due to incorrect company in the products created for testing purposes. Anyway, I was just doing a hypothesis for that config parameter, which I don't find sense if not for this goal. |
It's not just about tests. It decouples also the module deployment and feature activation. That makes sense. |
I don't agree on that. You can deploy the module, but don't install it. You have the same control changing the system parameter and installing the module. Both can be UI activations. |
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.
Putting the debate on the validity of the config param (and the minor suggestion on the README) aside, the PR looks fine as far as the migration is concerned.
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.
LG.
About the pro/con of system parameter it's not blocking the migration here.
.sudo() | ||
.get_param("product_company_default.default_company_enable") | ||
) | ||
if param == "1": |
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.
Should we make use of odoo.tools.str2bool
to support other trui-sh values?
I think the debate about the technique is still relevant, as you prefer to add ir_config.parameter data, plus code to read it (with the |
This PR has the |
Module migrated to version 17.0
cc https://github.com/APSL 163062
@miquelalzanillas @javierobcn @mpascuall @BernatObrador @ppyczko please review