Odoo Help

0

0
1 Answer
2
Avatar

Mitul Shingala India

--Mitul Shingala--
5332
| 6 4 9
Vadodara, Gujarat, India
--Mitul Shingala--

Odoo Developer

Mitul Shingala India
1/28/19, 12:46 AM

hello 

try with below code

@api.multi
    def correct_procuts_vendors(self):
        products = self.env['product.template'].search([])
        for product in products:
            newSellers = []
            for seller in product.variant_seller_ids:
                if seller.name.name != "maassump@gmail.com":
                    newSellers.append(seller.id)
            product.write({'variant_seller_ids': [(6, 0, newSellers)]})
4 Comments
arthur Brazil
1/28/19, 7:36 AM

It did work, thanks very much! I understand why to change the append to seller.id, but I didn't get what "[(6, 0, newSellers)]" actually means. Would you mund telling me, please?

arthur Brazil
1/28/19, 7:36 AM

It did work, thanks very much! I understand why to change the append to seller.id, but I didn't get what "[(6, 0, newSellers)]" actually means. Would you mund telling me, please?

arthur Brazil
1/28/19, 7:36 AM

It did work, thanks very much! I understand why to change the append to seller.id, but I didn't get what "[(6, 0, newSellers)]" actually means. Would you mind telling me, please?

Mitul Shingala India
1/28/19, 8:10 AM

in odoo, when you write into many2many field at that time you have pass the value like [(6, 0, [list_of_record_ids])].

for more detail refer this website: https://odoo-development.readthedocs.io/en/latest/dev/py/x2many.html

Ask a Question
Writer
Keep Informed
1 follower(s)
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