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.

20 lines
640 B

  1. from odoo import models, fields, api
  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. def _get_default_partner(self):
  8. return self.env.context['active_id']
  9. first_name = fields.Char('First Name', required=True)
  10. last_name = fields.Char('Last Name', required=True)
  11. email = fields.Char('Email')
  12. partner_id = fields.Many2one('res.partner', default=_get_default_partner)
  13. @api.one
  14. def create_new_eater(self):
  15. self.partner_id._new_eater(self.first_name, self.last_name, self.email)