Odoo Help

0

0
1 Answer
2
Avatar

Mitul Shingala

--Mitul Shingala--
--Mitul Shingala--

Odoo Developer

Mitul Shingala
28.01.19, 00:46

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
28.01.19, 07:36

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
28.01.19, 07:36

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
28.01.19, 07:36

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
28.01.19, 08:10

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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now