简体   繁体   中英

Fetch Employee records from One model to another in ODOO 10

How to create records directly from hr employee model into my new model. In hr model I have some employee records, I have to retrieve those records and store into my new model by code. Please help me.

Try this:

@api.model 
def create(self, vals):
record = super(Employee, self).create(vals) 
if record.name and record.birthday: 

    return self.env['hr.birthday'].create({
                                    'name': record.name,
                                    'birthday_date': record.birthday
                                            }) 
return record

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM