Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1718 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 25
2798
0
thg 11 22
4065
1
thg 3 20
5528
2
thg 3 15
7838
2
thg 7 23
2681