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

I need to clear "many2many" fields value, So i tried these code but it does not empty the field

My Code:

            purchase_id = fields.Many2many(

                        'purchase.order',

                        string='Purchase Order',

                        store=False,

                        readonly=True,

                        help='Associated Purchase Order. Filled in automatically when a PO is chosen on the vendor bill.'

             )


            @api.onchange('purchase_id')

            def _onchage_purchase(self):

            self.purchase_id = [6, 0, []] 


I tried like this, but it doesn't works.. Please, can anyone help me to resolve this.

Avatar
Discard
Best Answer

Hi,

Check this link : https://www.odoo.com/forum/help-1/question/removing-elements-from-many2many-field-122928


Avatar
Discard
Author

I referred and tried the methods given from this link.. But still i can't get the result

Check if the onchange function is being called by just putting a print .

if try this :

self.purchase_id = [(6, 0, [])]

Related Posts Replies Views Activity
0
Dec 24
48
2
Oct 24
229
1
Aug 24
586
2
Jul 24
267
1
Jul 24
289