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.
22 lines
706 B
22 lines
706 B
# -*- coding: utf-8 -*-
|
|
from openerp import models, fields, api
|
|
|
|
class NewEaterWizard(models.TransientModel):
|
|
"""
|
|
A transient model for the creation of a eater related to a worker.
|
|
"""
|
|
_name = '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):
|
|
client = self.partner_id.sudo()
|
|
client._new_eater(self.first_name, self.last_name, self.email)
|