3
votes

I have created relational columns with different class but when i delete relational records it will delete records from the base class as well.

Anyone have any solution to stop deleting the records from the base class while deleting relational field.

I have checked with ondelete='set null' on field declaration.

e.g i have create a field many2one with 'purchase.order', when i delete this record it delete the 'purchase.order' as well.

I want to stop deleting the purchase order while delete the record.

2
try ondelete='restrict' or ondelete='cascade'Alpesh Valaki
@ADVALAKI I have try with bothNaitik
Did you try my answer?Charif DZ
@CherifOdoo Yes, I tried it, I vote up... Thanks !!!Naitik

2 Answers

2
votes

in order to stop the field one2many from deleting record witch is the default behavior of that field is when you creating you view give it an option:

<field name="one2many_field_name" options="{'not_delete': True}" />
1
votes

In Odoo 8, use widget="many2many":

<field name="one2many_field_name" widget="many2many" />