[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
This commit is contained in:
Rémy Voet (ryv)
2020-11-10 10:44:02 +00:00
committed by Arnold Moyaux
parent 923a1c3d53
commit e65d6e422f
+1 -1
View File
@@ -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)