تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
30290 أدوات العرض

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'?

الصورة الرمزية
إهمال
أفضل إجابة

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 :)

الصورة الرمزية
إهمال
الكاتب

Thanks, it helps.

Happy To help you. :)

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أبريل 19
2711
2
سبتمبر 18
14555
1
فبراير 18
3839
1
نوفمبر 24
2176
1
يناير 21
3591