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.

23 lines
669 B

  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class NewEaterWizard(models.TransientModel):
  4. """
  5. A transient model for the creation of a eater related to a worker.
  6. """
  7. _name = "eater.new.wizard"
  8. def _get_default_partner(self):
  9. return self.env.context["active_id"]
  10. first_name = fields.Char("First Name", required=True)
  11. last_name = fields.Char("Last Name", required=True)
  12. email = fields.Char("Email")
  13. partner_id = fields.Many2one("res.partner", default=_get_default_partner)
  14. @api.one
  15. def create_new_eater(self):
  16. self.partner_id._new_eater(self.first_name, self.last_name, self.email)