[18.0][IMP] product_cost_security: Make tests more resilient#2254
Open
sergio-teruel wants to merge 1 commit intoOCA:18.0from
Open
[18.0][IMP] product_cost_security: Make tests more resilient#2254sergio-teruel wants to merge 1 commit intoOCA:18.0from
sergio-teruel wants to merge 1 commit intoOCA:18.0from
Conversation
Contributor
carlos-lopez-tecnativa
suggested changes
Apr 8, 2026
Comment on lines
+64
to
+71
| if ( | ||
| config["test_enable"] | ||
| and not self.env.context.get("testing_product_cost_security") | ||
| and "standard_price" in fields | ||
| ): | ||
| # By default in other tests users have not this security group, so do this | ||
| # only when we are testing this module. | ||
| return fields |
Contributor
There was a problem hiding this comment.
The logic of this module is not exclusive to the standard_price field; it applies to every field that has the group product_cost_security.group_product_cost defined in its field definition. So, I think it is better to use the function _product_cost_security_fields to check this.
Additionally, I returned the super() call.
What do you think about this approach?
Suggested change
| if ( | |
| config["test_enable"] | |
| and not self.env.context.get("testing_product_cost_security") | |
| and "standard_price" in fields | |
| ): | |
| # By default in other tests users have not this security group, so do this | |
| # only when we are testing this module. | |
| return fields | |
| product_cost_fields = self._product_cost_security_fields().intersection( | |
| valid_fields | |
| ) | |
| if ( | |
| config["test_enable"] | |
| and not self.env.context.get("testing_product_cost_security") | |
| and product_cost_fields | |
| ): | |
| # By default in other tests users have not this security group, so do this | |
| # only when we are testing this module. | |
| return valid_fields |
yajo
reviewed
Apr 13, 2026
Member
There was a problem hiding this comment.
suggestion: alter context in test only once, here:
Suggested change
| cls.env = cls.env(context=dict(cls.env.context, disable_auto_svl=True, testing_product_cost_security=True)) |
34936be to
f118288
Compare
Contributor
Author
|
@yajo @carlos-lopez-tecnativa Changes done! |
carlos-lopez-tecnativa
approved these changes
Apr 20, 2026
Contributor
Author
|
Do not merge, the last changes not fix the issue |
f118288 to
c3db4b2
Compare
carlosdauden
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Tecnativa
ping @carlosdauden @CarlosRoca13