Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1397 มุมมอง

Hi, I am wondering if it's good practice to override the method create, on a model and update a field in the following way (using object.attribute = value):


Class MyTable:

​starting_date: fields.Datetime(string='any date')
​**** MORE FIELDS ******

​@api.model
​def create(self, values):
​***** SOME LOGIC HERE ******
​new_record = super(MyTable, self).create(values)
​new_record.starting_date = new_record.create_date
​return new_record
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 25
2317
0
พ.ย. 22
3523
1
มี.ค. 20
5097
2
มี.ค. 15
7375
2
ก.ค. 23
2308