Skip to content
Open
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
8 changes: 8 additions & 0 deletions cooperator_eater/models/subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down