python 2.7 - If I change a field value in an api.onchange method, it's not updated in the view. Why? -
i have function executing in api.onchange('bom_line_ids')
, inside function want have if statement clear bom_line_ids if condition matched. used self.bom_line_ids.product_id = false
but reason field cleared (saw in prints, it's not updated in view).
@api.onchange('bom_line_ids') def get_excl_list(self): list1 = [] in self.excl_list: list1.append(i.id) list2 = [] j in self.bom_line_ids: list2.append(j.product_id.id) if j.product_id.id in list1: warning_message = "product: " + self.env['product.template'].search([('id','=',j.product_id.id)]).name + " can't added bom.\n please select product." print "self.bom_line_ids.product_id", self.bom_line_ids.product_id self.bom_line_ids.product_id = false print "self.bom_line_ids.product_id", self.bom_line_ids.product_id return { 'warning': {'title': 'product error', 'message':warning_message} }
there issue in odoo talking this. someone made pull request.
you can check other question solve issue manually: one2many field on_change function can't change own value?
Comments
Post a Comment