[FIX] purchase_requistion: Duplicate purchase agreement with "Run sch…

…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
This commit is contained in:
Goffin Simon
2018-09-06 16:05:13 +02:00
parent 79a7d58a1c
commit d3dc5048e4
@@ -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'