From e65d6e422f852c7933fe4ee14e8f46046fce6d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Mon, 21 Sep 2020 14:13:34 +0000 Subject: [PATCH] [FIX] stock: fix creation of picking type for a other company In multi company (company A and B), - Select the company A as main one, and select B too. - Create a picking type and change the company to B. - Don't select any warehouse. - We can't save, because the company ir.sequence is set to A instead of B. Fix by apply the company_id of the picking type. task-2372196 --- addons/stock/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 43eb85d60df..8c6cdf7379c 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -92,7 +92,7 @@ class PickingType(models.Model): vals['sequence_id'] = self.env['ir.sequence'].create({ 'name': _('Sequence') + ' ' + vals['sequence_code'], 'prefix': vals['sequence_code'], 'padding': 5, - 'company_id': self.env.company.id, + 'company_id': vals.get('company_id') or self.env.company.id, }).id picking_type = super(PickingType, self).create(vals)