From a7852b613aeb2257b7fda4e2b2e5289e6401ae26 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 8 Dec 2015 10:11:46 +0100 Subject: [PATCH] [FIX] sale: trigger creation of a new SO line Commit fa1da9dc removes this part of the code, but it should be kept. Now with a clearer comment. --- addons/sale/sale_analytic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale_analytic.py b/addons/sale/sale_analytic.py index 731d8b38d01..398c99e11e5 100644 --- a/addons/sale/sale_analytic.py +++ b/addons/sale/sale_analytic.py @@ -82,10 +82,12 @@ class AccountAnalyticLine(models.Model): ('state', '=', 'sale'), ('product_id', '=', self.product_id.id)], limit=1) - # Use the existing SO line only if the unit prices are the same, otherwise we create - # a new line + # Use the existing SO line only if the unit prices are the same if sol and sol.price_unit == self._get_invoice_price(sol.order_id): result.update({'so_line': sol.id}) + else: + # This will trigger the creation of a new SO line + sol = False if not sol and self.account_id and self.product_id and self.product_id.invoice_policy == 'cost': order_line_vals = self._get_sale_order_line_vals()