From b9e3c15315250e7e24c8123667fdfb023e5c69e0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 4 Feb 2019 10:13:36 +0000 Subject: [PATCH] [FIX] stock_dropshipping: consolidated lines - Create a SO with 2 lines of the same product (set route as Drop Ship) - At validation, both lines are merged into a single line in the PO As a result, one SO line will be over-delivered, and the other under-delivered. Two lines should be kept in the PO. opw-1928702 closes odoo/odoo#30800 --- addons/stock_dropshipping/models/purchase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/stock_dropshipping/models/purchase.py b/addons/stock_dropshipping/models/purchase.py index 2a3e32d1269..cefc96ee830 100644 --- a/addons/stock_dropshipping/models/purchase.py +++ b/addons/stock_dropshipping/models/purchase.py @@ -16,6 +16,12 @@ class PurchaseOrderLine(models.Model): re['sale_line_id'] = self.sale_line_id.id return res + def _merge_in_existing_line(self, product_id, product_qty, product_uom, location_id, name, origin, values): + if values.get('route_ids') and values['route_ids'] == self.env.ref('stock_dropshipping.route_drop_shipping'): + return False + return super(PurchaseOrderLine, self)._merge_in_existing_line( + product_id=product_id, product_qty=product_qty, product_uom=product_uom, + location_id=location_id, name=name, origin=origin, values=values) class ProcurementRule(models.Model): _inherit = 'procurement.rule'