Skip to content
Snippets Groups Projects
Commit 170492e2 authored by Santiago Said's avatar Santiago Said
Browse files

Merge branch 'MR' into '12.0-stage'

[FIX] use get to obtain values from dict to prevent KeyError

See merge request !22
parents df56a81f f3f5bb9b
No related branches found
No related tags found
1 merge request!22[FIX] use get to obtain values from dict to prevent KeyError
......@@ -51,8 +51,8 @@ class Partner(models.Model):
@api.model
def create(self, vals):
if not vals['ref'] and self.env.context['default_partner_type'] == 'insurance':
vals['ref'] = str(self.env['ir.sequence'].next_by_code('res.partner.insurance'))
if not vals.get('ref') and self.env.context.get('default_partner_type', '') == 'insurance':
vals['ref'] = str(self.env['ir.sequence'].next_by_code('res.partner.insurance'))
return super(Partner, self).create(vals)
@api.multi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment