I want to update computed field records but it writes self record in all fields when I use write method.
the name field in product, template is non stored. now because of our business needs so I can't search it.
I make another stored field to move name records into it. so I can looking for instead of name.
I make a button to update data in that field from name field. but when I press the button it updates with self name not name of each product.
class autopart(models.Model):
_inherit = 'product.template'
@api.multi
def button_name(self):
for rec in self:
name=self.name
rec.search([]).write({'nameseacrh': self.name})
name = fields.Char(string="Name", required=False ,compute=compute_amount ,search=pro_search)
nameseacrh = fields.Char(string="", required=False,store=True, compute=compute_search )
button XML
<button name="button_name" type="object" string="name" class="oe_highlight" groups="base.group_system"/>