Search code examples
pythonloopsodoo

what is the best method to loop over all odoo product and update it's record?


i added a button to update a field in product template from another computed field but when i press this button only self product be update and the method didn't go over all product

i tried a lotin this problem but i can't solve it and this the simple i have added

@api.multi
def button_name(self):
    for template in self:
        self.name4 = self.name3

    pass

any help will be appreciated


Solution

  • This worked For me

    @api.multi
           def button_name(self):
               for template in self.search([]):
                template.name4 = template.name3
           return True