Hello, I would like to reduce 2000 on the price of an item in sale.order.line if the field "with_cloth" is checked.
How to test the values of the form and apply the reduction before saving ?
Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hello Mame Penda Bathily,
Try below code:
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
with_cloth = fields.Boolean('With Cloth') #Add this field in view.
@api.onchange('with_cloth')
def onchange_with_cloth(self):
if self.with_cloth:
self.price_unit = self.product_id.lst_price - 2000
else:
self.price_unit = self.product_id.lst_price
Hope this will helps you.
Thanks,
Thank you so much! It's Work ;)
Please up vote the answer and accepted as resolved. Thanks,
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up