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
680 B
23 lines
680 B
from odoo import api, fields, models
|
|
|
|
|
|
class NewEaterWizard(models.TransientModel):
|
|
"""
|
|
A transient model for the creation of a eater related to a worker.
|
|
"""
|
|
|
|
_name = "eater.new.wizard"
|
|
_description = "eater.new.wizard"
|
|
|
|
def _get_default_partner(self):
|
|
return self.env.context["active_id"]
|
|
|
|
first_name = fields.Char("First Name", required=True)
|
|
last_name = fields.Char("Last Name", required=True)
|
|
email = fields.Char("Email")
|
|
|
|
partner_id = fields.Many2one("res.partner", default=_get_default_partner)
|
|
|
|
@api.one
|
|
def create_new_eater(self):
|
|
self.partner_id._new_eater(self.first_name, self.last_name, self.email)
|