From 4f9ff30cdf0ae7b5397b48299cdb0b481827f257 Mon Sep 17 00:00:00 2001 From: Simon Hick Date: Wed, 25 Feb 2026 11:33:19 +0100 Subject: [PATCH] [FIX] validate subscription before sending mail --- cooperator_eater/models/subscription_request.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cooperator_eater/models/subscription_request.py b/cooperator_eater/models/subscription_request.py index 762209f00..d14460111 100644 --- a/cooperator_eater/models/subscription_request.py +++ b/cooperator_eater/models/subscription_request.py @@ -19,6 +19,14 @@ def get_eater_vals(self, partner, share_product_id): def validate_subscription_request(self): self.ensure_one() + if self.partner_id: + vals = self.get_eater_vals(self.partner_id, self.share_product_id) + # settattr will change the values of the partner object without + # applying the changes in the db, so we can see if the new value of + # the field eater is valid, without the risk of changing the result of + # super().validate_subscription_request() which depends on that field + setattr(self.partner_id, "eater", vals["eater"]) # noqa: B010 + invoice = super().validate_subscription_request()[0] partner = invoice.partner_id