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.

24 lines
708 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. from odoo import api, fields, models
  2. class NewEaterWizard(models.TransientModel):
  3. """
  4. A transient model for the creation of a eater related to a worker.
  5. """
  6. _name = "eater.new.wizard"
  7. _description = "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.multi
  15. def create_new_eater(self):
  16. self.ensure_one()
  17. self.partner_id._new_eater(self.first_name, self.last_name, self.email)