Browse Source

[UPDT] Bug fixed

pull/187/head
Ajmalcybrosys 6 years ago
parent
commit
2c0b68a388
  1. 14
      first_last_name/models/name.py
  2. 2
      gender_contact/models/gender.py

14
first_last_name/models/name.py

@ -28,13 +28,15 @@ class FirstNameLastName(models.Model):
@api.depends('name') @api.depends('name')
def _compute_first_name(self): def _compute_first_name(self):
for i in self: for i in self:
list = i.name.split(' ', 1) if i.name else None if i.name :
if list and i.company_type == 'person': list = i.name.split(' ', 1)
i.first_name = list[0] if list and i.company_type == 'person':
i.first_name = list[0]
@api.depends('name') @api.depends('name')
def _compute_last_name(self): def _compute_last_name(self):
for i in self: for i in self:
list = i.name.split(' ', 1) if i.name else None if i.name :
if len(list) == 2 and i.company_type == 'person': list = i.name.split(' ', 1) if i.name else None
i.last_name = list[1] if len(list) == 2 and i.company_type == 'person':
i.last_name = list[1]

2
gender_contact/models/gender.py

@ -6,6 +6,6 @@ class FirstNameLastName(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
gender = fields.Selection([ ('male', 'Male'), gender = fields.Selection([ ('male', 'Male'),
('female', 'female'), ('female', 'Female'),
('other', 'Others')], ('other', 'Others')],
string='Gender') string='Gender')

Loading…
Cancel
Save