add function field in customerservice for report
This commit is contained in:
parent
ecd69d8989
commit
2dfe50b199
|
@ -213,6 +213,7 @@ class CustomerService(metaclass=PoolMeta):
|
|||
nursing_mother = fields.Selection(OPTION_SELECT, 'Nursing Mother', states={'required': False})
|
||||
older_adult = fields.Selection(OPTION_SELECT, 'Older Adult',
|
||||
states={'required': False})
|
||||
current_risk = fields.Function(fields.Char('Current Risk'), 'get_current_risk')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -391,6 +392,25 @@ class CustomerService(metaclass=PoolMeta):
|
|||
ext_ = 'ODT'
|
||||
return ext_
|
||||
|
||||
def get_current_risk(self, name=None):
|
||||
if self.cs_date:
|
||||
days_diference = datetime.now() - self.cs_date
|
||||
if self.media == 'supersalud':
|
||||
if self.classification == 'reclamo_riesgo_vital' and self.state == 'open':
|
||||
return 'Higher'
|
||||
if self.classification == 'reclamo_riesgo_priorizado' and self.state == 'open':
|
||||
print(days_diference, self.party.name)
|
||||
if days_diference.days == 0:
|
||||
return 'Medium'
|
||||
if days_diference.days >= 1:
|
||||
return 'Higher'
|
||||
if self.classification == 'reclamo_riesgo_simple' and self.state == 'open':
|
||||
if days_diference.days >= 3:
|
||||
return 'Higher'
|
||||
if days_diference.days >= 2:
|
||||
return 'Medium'
|
||||
return 'low'
|
||||
|
||||
def send_email_customer(self, template, attachments=[]):
|
||||
if self.department_region and self.department_region.emails:
|
||||
dmt_email = self.department_region.emails[0].email
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue