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

order_id = fields.Many2one('sale.order', string='Order Reference', required=True, ondelete='cascade', index=True, copy=False)


What index and copy means?

What about ondelete='cascade'?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

copy=False
If you put copy=False to a field, When you duplicate a record, That value is not copied to duplicating (Newly created)record.

ondelete='cascade'

If you put this to a Many2one field, the deletion of record will cause to deletion of one2one records according to that record.
Eg:

When you delete a Sale Order, It will delete sale order lines also.

Index=True

you can speed the database search performance. However, you should be careful not to add indexes on too many fields because the size of the database can rapidly increase. What means, you should carefully detect the most searchable fields and to create indexes for them only.

Hope it may help you :)

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks, it helps.

Happy To help you. :)

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 19
2724
2
thg 9 18
14596
1
thg 2 18
3870
1
thg 11 24
2218
1
thg 1 21
3600