Odoo Help

0

How to clear the values of "many2many" field odoo 10?

By
selvi
on 8/21/17, 12:46 AM 299 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.

0
Avinash Nk
On 8/21/17, 12:50 AM

Hi,

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


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

selvi
on 8/21/17, 1:02 AM

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

if try this :

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

Aslam
on 8/21/17, 2:00 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/21/17, 12:46 AM
Seen: 299 times
Last updated: 8/21/17, 12:50 AM