[FIX] purchase_requisition: System pick wrong operation type in Purchase Agreement

When creating a "purchase.requisition" record, the default Operation Type was
always the one defined in the company 1 even if the user was not in the company 1.

opw:1890190

closes odoo/odoo#27520
This commit is contained in:
Goffin Simon
2018-10-08 09:22:34 +00:00
parent ebe43bad9e
commit 6c0c1259bc
@@ -45,8 +45,8 @@ class PurchaseRequisition(models.Model):
def _get_picking_in(self):
pick_in = self.env.ref('stock.picking_type_in')
if not pick_in:
company = self.env['res.company']._company_default_get('purchase.requisition')
company = self.env['res.company']._company_default_get('purchase.requisition')
if not pick_in or pick_in.sudo().warehouse_id.company_id.id != company.id:
pick_in = self.env['stock.picking.type'].search(
[('warehouse_id.company_id', '=', company.id), ('code', '=', 'incoming')],
limit=1,