-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
[16.0][FIX] loyalty_partner_applicability: Set default value for partner domain rule #186
[16.0][FIX] loyalty_partner_applicability: Set default value for partner domain rule #186
Conversation
c1e136c
to
f8ef2f2
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.
Thinking it twice, would it be more resilient to override the create of the program.rule
and simply add the default domain in the vals if not present?
f8ef2f2
to
6e4683c
Compare
Yes, it's more resilient. Done :) |
…main rule It is necessary to establish the default value, in this case "[ ]" to the rule_partners_domain field, in the create method for the rules established in the computed method "_program_type_default_values" that establishes the default values depending on the type of program, because when creating a new program, these rules do not have the rule_partners_domain field defined, as it is not contemplated, its value will be "False", which cannot be interpreted as a correct domain. To avoid this error, the check is made in the create method and the correct value is added. TT44344
6e4683c
to
c66d64c
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.
👍
I don't get why the default is not applied, even if coming from that "direct creation". Anyway, the way to fix this is to override
Anyway, I insist, why the default value is not applied? Is this bypassing the ORM somehow? |
It's bypassed: https://github.com/odoo/odoo/blob/16.0/addons/loyalty/models/loyalty_reward.py#L20 |
ping @pedrobaeza |
…t set This way, we can avoid a crash on incorrect input data.
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 have just added another safeguard on the sale part.
/ocabot merge patch
On my way to merge this fine PR! |
Congratulations, your PR was merged at 5b0e946. Thanks a lot for contributing to OCA. ❤️ |
It is necessary to set the default value, in this case "[ ]" to the rule_partners_domain field, overwriting the computed method "_program_type_default_values" that sets the default values depending on the type of program, because when creating a new program, these default rules are defined and the rule_partners_domain field, not being contemplated, its value will be "False", which cannot be interpreted as a correct domain. To avoid this error, the value is added to the rules defined by default.
The error:
cc @Tecnativa TT44344
@chienandalu @CarlosRoca13 please review