hi all, iam a newbie to odoo iam trying to call a fuction when a boolean field is clicked
this is my field
x = fields.Boolean (string = "SAM", default = False)
this is my function, this work fine without the button click condition but when i tried with this conndition i get no error but its not calling the function ie its not working
@ api.model
def x (self, vals):
rec = super (SaleOrder, self) .create (vals)
if self.transit_check:
rec = super (SaleOrder, self) .create (vals)
product_id = self.env ['product.product']. search ([('default_code', '=', 'XX')])
if product_id:
y = 0
for each in rec.order_line:
y + = each.y +2
self.env ['sale.order.line']. create ({'product_id': product_id.id, 'price_unit': y, 'order_id': rec.id, 'product_uom_qty': 1,})
return rec
else:
return rec
someone help me