From a25f6e1b9617a04ccc517ed2e53429ca233ba728 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 7 Jun 2019 14:20:35 +0000 Subject: [PATCH] [FIX] sale: recompute delivered qty - Create a product A of type "Service", Invoice based on "Milestones", Service Tracking "Create a task in a new project". - Create a new SO with A, confirm. - Go the to task associated to the SO, go to "Timesheets" tab, add an entry - In the SO, edit the delivered quantity - Create invoice, validate Back to the SO, delivered quantity is reset to 0. We make sure to filter out SO lines which have a delivered quantity set manually. Introduced by d6ad22227cc7b3f36ac9914cce4f8a1f0a0f36a2. opw-1982020 closes odoo/odoo#33991 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale/models/sale.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 9fca947f6f1..fddcfed99b7 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1246,6 +1246,9 @@ class SaleOrderLine(models.Model): """ Compute and write the delivered quantity of current SO lines, based on their related analytic lines. """ + # The delivered quantity of Sales Lines in 'manual' mode should not be erased + self = self.filtered(lambda sol: sol.product_id.service_type != 'manual') + # avoid recomputation if no SO lines concerned if not self: return False