From 10250b1722e897a9f8e22bcc20ace3faf1d27ea9 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Wed, 19 Feb 2020 10:18:27 +0000 Subject: [PATCH] [IMP] purchase_stock: add to existing PO w/o user_id Product purchases triggered by a stock rule currently searches existing draft RFQs for matching 'partner_id' and 'company_id'. This commit makes it so it also takes into account 'user_id' (i.e. "Purchase Representative") and only selects ones without a user_id so as to not randomly add lines to POs of different Purchase Representatives. Supports Task: 2041853 --- addons/purchase_stock/models/stock_rule.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase_stock/models/stock_rule.py b/addons/purchase_stock/models/stock_rule.py index fa7c1eaaa63..0df54976cee 100644 --- a/addons/purchase_stock/models/stock_rule.py +++ b/addons/purchase_stock/models/stock_rule.py @@ -290,6 +290,7 @@ class StockRule(models.Model): ('state', '=', 'draft'), ('picking_type_id', '=', self.picking_type_id.id), ('company_id', '=', company_id.id), + ('user_id', '=', False), ) if values.get('orderpoint_id'): procurement_date = fields.Date.to_date(values['date_planned']) - relativedelta(days=int(values['supplier'].delay) + company_id.po_lead)