summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2019-02-27 12:43:03 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2019-02-27 12:54:53 +0000
commit4613d0a80b9a9ef84cc2aa9638b0f3929a3793b8 (patch)
tree6ff04ccef6d438b67aa95962cfd60694bc85ef14
parentee184bcf589f2a6b3a32ba9d004e32eb6516a26e (diff)
[FIX] event_sale: on change of events product in SO
Have a product that is an event, with the price of 1500. Create a ticket for this product in an event, with the price of 600. In a SO, add a line with this ticket. Before this commit, when you change the product, to another product that is also an event, the event, the ticket and the price stayed the ones of the first product. Now, the event, the ticket and the price are updated when the product is modified. opw-1940368
-rw-r--r--addons/event_sale/models/sale_order.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/event_sale/models/sale_order.py b/addons/event_sale/models/sale_order.py
index 4b42f6d8663..2834dfb11c9 100644
--- a/addons/event_sale/models/sale_order.py
+++ b/addons/event_sale/models/sale_order.py
@@ -69,3 +69,12 @@ class SaleOrderLine(models.Model):
def product_uom_change(self):
if not self.event_ticket_id:
super(SaleOrderLine, self).product_uom_change()
+
+ @api.multi
+ @api.onchange('product_id')
+ def product_id_change(self):
+ super(SaleOrderLine, self).product_id_change()
+ self.event_id = None
+ self.event_ticket_id = None
+ if self.product_id.event_ok:
+ self.price_unit = 0.0