From d3dc5048e40d1aef693336d10ce582d39ce17337 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 6 Sep 2018 14:31:50 +0200 Subject: [PATCH] =?UTF-8?q?[FIX]=20purchase=5Frequistion:=20Duplicate=20pu?= =?UTF-8?q?rchase=20agreement=20with=20"Run=20sch=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …eduler" Steps to reproduce the bug: - Let's consider P a product with routes "buy" and "mto" and with purchase_requistion = 'Propose a call for tenders' - Let's consider a BOM B with P as component - Create a MO for B - Run the scheduler two times Bug: Two purchase agreements have been created for the the same MO. opw:1882280 --- .../models/purchase_requisition.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py index 526ce255a9f..a5a8c17ab32 100644 --- a/addons/purchase_requisition/models/purchase_requisition.py +++ b/addons/purchase_requisition/models/purchase_requisition.py @@ -313,6 +313,18 @@ class ProductTemplate(models.Model): ('tenders', 'Propose a call for tenders')], string='Procurement', default='rfq') +class StockMove(models.Model): + _inherit = "stock.move" + + requistion_line_ids = fields.One2many('purchase.requisition.line', 'move_dest_id') + +class ProcurementGroup(models.Model): + _inherit = 'procurement.group' + + @api.model + def _get_exceptions_domain(self): + return super(ProcurementGroup, self)._get_exceptions_domain() + [('requistion_line_ids', '=', False)] + class ProcurementRule(models.Model): _inherit = 'procurement.rule'