Skip to Content
Menu
This question has been flagged
1 Reply
7836 Views

how can we unlink records from one2many without deleting ?

Avatar
Discard
Best Answer

Hi,

First your relation field should be not required. So you can update the relation field by False to unlink association.

Example, to unlink association between an pos.order and all one2many lines:

self.env['pos.order.line'].serach([('order_id','=', order_id)]).write({'order_id':False})

Best regards.


Avatar
Discard
Related Posts Replies Views Activity
0
Sep 20
1737
6
Dec 19
16195
0
Apr 16
2201
3
Mar 16
12669
1
Mar 15
11348