summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Voet (ryv) <ryv@odoo.com>2020-09-21 14:13:34 +0000
committerArnold Moyaux <arm@odoo.com>2020-11-10 09:23:26 +0000
commit236094958785ed3e642e1b89d45a056fa2c8a8b2 (patch)
tree6d00696befd91084b69a805b607a5ece1a1f0a2f
parent16ab39a3f6ffa72698b9b46eae1505abb90504c4 (diff)
[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
-rw-r--r--addons/stock/models/stock_picking.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py
index 6b8e965eb8d..dac52635fa0 100644
--- a/addons/stock/models/stock_picking.py
+++ b/addons/stock/models/stock_picking.py
@@ -94,7 +94,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)