Skip to content

Commit

Permalink
[FIX] When adding a new line in sales orders
Browse files Browse the repository at this point in the history
  • Loading branch information
edescalona committed Jan 21, 2025
1 parent 8d3fd21 commit 585881f
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions rental_pricelist_interval/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ def _get_product_rental_uom_ids(self):
res = super()._get_product_rental_uom_ids()
return res

@api.onchange("product_id")
def product_id_change(self):
@api.onchange("product_id", "rental_qty")
def rental_product_id_change(self):
res = super().rental_product_id_change()
self._update_interval_price()
uom_interval = self.env.ref("rental_pricelist_interval.product_uom_interval")
res = super().product_id_change()
if (
self.order_id.pricelist_id.is_interval_pricelist
and self.product_id
Expand All @@ -135,27 +136,21 @@ def product_id_change(self):
self.product_uom = uom_ids[0]
return res

@api.onchange("product_id", "rental_qty")
def rental_product_id_change(self):
res = super().rental_product_id_change()
self._update_interval_price()
return res

@api.onchange("rental_qty", "number_of_time_unit", "product_id")
def rental_qty_number_of_days_change(self):
res = super().rental_qty_number_of_days_change()
self._update_interval_price()
return res

@api.onchange("product_uom", "product_uom_qty")
def product_uom_change(self):
res = super().product_uom_change()
def _onchange_product_uom(self):
res = super()._onchange_product_uom()
self._update_interval_price()
return res

@api.onchange("start_date", "end_date", "product_uom")
def onchange_start_end_date(self):
res = super().onchange_start_end_date()
def _onchange_start_end_date(self):
res = super()._onchange_start_end_date()
if self.start_date and self.end_date:
self._update_interval_price()
return res

0 comments on commit 585881f

Please sign in to comment.