Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sale_tier_validation/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ def _get_accepted_notification_subtype(self):

def _get_rejected_notification_subtype(self):
return "sale_tier_validation.sale_order_tier_validation_rejected"

def _get_fields_to_write_validation(self, vals, records_exception_function):
# Don't block order validation when sale_loyalty is installed and no coupon
# is being handled, due to this code assigning always an empty value:
# https://github.com/odoo/odoo/blob/2a7876538e9ea630563e39ee8402b27147d1e428/
# addons/sale_loyalty/models/sale_order.py#L740
# Done here for not creating a glue module as we can detect the situation. The
# only drawback is that this doesn't have any regression test
(
allowed_field_names,
not_allowed_field_names,
) = super()._get_fields_to_write_validation(vals, records_exception_function)
if "applied_coupon_ids" in vals and not vals.get("applied_coupon_ids"):
allowed_field_names += ["applied_coupon_ids"]
return allowed_field_names, not_allowed_field_names