简体   繁体   中英

How to override update function of a custom model in Odoo 11

I want to create a customer_number in the format of cust<id> (For example, cust001, cust004,.. ) using the id . When I use the create() function it returns the id of the record. So I decided to update the record with my customer_number using the id of the record. The following code is in the create() function.

res = super(lot_number, self).write(vals)

I want to create a customer number using the id of the record. I would really appreciate some help with this. Thanks.

@api.model

def create(self, vals):

 res = super(lot_number, self).create(vals) res.customer_id = 'cust'+str(res.id) return res 

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