[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
This commit is contained in:
Tiffany Chang (tic)
2020-03-05 13:04:11 +00:00
parent 69c4b628c3
commit 10250b1722
@@ -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)