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
822 B

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