[FIX] stock: sequence_code key error when create stock pick type

KeyError "sequence_code" occurs when creating a stock picking type. This is
because there is not a key "sequence_code" in vals.

This commit added the condition to ensure "sequence_code" key
is available in vals.

sentry-3828105626

closes odoo/odoo#113849

X-original-commit: f88cd4967d0f455b246f481104090417e4ec10e0
Signed-off-by: Adrien Widart <awt@odoo.com>
This commit is contained in:
Mahamadasif Ansari
2023-02-28 18:08:32 +01:00
committed by Adrien Widart (awt)
parent 9d86983617
commit 9dd01bffe2
+1 -1
View File
@@ -100,7 +100,7 @@ class PickingType(models.Model):
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if 'sequence_id' not in vals or not vals['sequence_id']:
if not vals.get('sequence_id') and vals.get('sequence_code'):
if vals.get('warehouse_id'):
wh = self.env['stock.warehouse'].browse(vals['warehouse_id'])
vals['sequence_id'] = self.env['ir.sequence'].sudo().create({