You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
687 B

  1. from odoo import api, models
  2. class SubscriptionRequest(models.Model):
  3. _inherit = 'subscription.request'
  4. def get_eater_vals(self, partner, share_product_id):
  5. vals = {}
  6. eater = share_product_id.eater
  7. if partner.is_company or partner.age < 18:
  8. eater = 'eater'
  9. vals['eater'] = eater
  10. return vals
  11. @api.one
  12. def validate_subscription_request(self):
  13. invoice = super(SubscriptionRequest, self).validate_subscription_request()[0]
  14. partner = invoice.partner_id
  15. vals = self.get_eater_vals(partner, self.share_product_id)
  16. partner.write(vals)
  17. return invoice