Skip to content
Snippets Groups Projects
Commit 814af4ae authored by Marco Folco's avatar Marco Folco
Browse files

Merge branch 'SOF-22-Correcciones' into '12.0-stage'

[MOD] health insurance

Closes SOF-22

See merge request !25
parents 9855d943 9b9efeba
No related branches found
No related tags found
1 merge request!25[MOD] health insurance
......@@ -29,7 +29,8 @@ class Partner(models.Model):
_inherit = "res.partner"
partner_type = fields.Selection(
[('insurance', 'Insurance')],
[('insurance', 'Insurance'),
('sofsa_user', 'Sofsa User')],
string="Partner type",
default=lambda x: x._get_default_partner_type())
......@@ -47,12 +48,15 @@ class Partner(models.Model):
@api.multi
def _get_default_partner_type(self):
return 'insurance'
return 'sofsa_user'
@api.model
def create(self, vals):
if 'default_partner_type' in self.env.context and 'ref' in vals:
if not vals['ref'] and self.env.context['default_partner_type'] == 'insurance':
if 'partner_type' in vals:
if vals['partner_type'] == 'insurance':
vals['ref'] = str(self.env['ir.sequence'].next_by_code('res.partner.insurance'))
if 'default_partner_type' in self.env.context and not vals['ref']:
if self.env.context['default_partner_type'] == 'insurance':
vals['ref'] = str(self.env['ir.sequence'].next_by_code('res.partner.insurance'))
return super(Partner, self).create(vals)
......
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