add search_current_risk
This commit is contained in:
parent
13bef2dec8
commit
ed38bd18f1
|
@ -1 +0,0 @@
|
||||||
,presik,presik,05.09.2023 16:57,file:///home/presik/.config/libreoffice/4;
|
|
|
@ -213,7 +213,8 @@ class CustomerService(metaclass=PoolMeta):
|
||||||
nursing_mother = fields.Selection(OPTION_SELECT, 'Nursing Mother', states={'required': False})
|
nursing_mother = fields.Selection(OPTION_SELECT, 'Nursing Mother', states={'required': False})
|
||||||
older_adult = fields.Selection(OPTION_SELECT, 'Older Adult',
|
older_adult = fields.Selection(OPTION_SELECT, 'Older Adult',
|
||||||
states={'required': False})
|
states={'required': False})
|
||||||
current_risk = fields.Function(fields.Char('Current Risk'), 'get_current_risk')
|
current_risk = fields.Function(fields.Char('Current Risk'), 'get_current_risk',
|
||||||
|
searcher='search_current_risk')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -399,7 +400,6 @@ class CustomerService(metaclass=PoolMeta):
|
||||||
if self.classification == 'reclamo_riesgo_vital' and self.state == 'open':
|
if self.classification == 'reclamo_riesgo_vital' and self.state == 'open':
|
||||||
return 'Higher'
|
return 'Higher'
|
||||||
if self.classification == 'reclamo_riesgo_priorizado' and self.state == 'open':
|
if self.classification == 'reclamo_riesgo_priorizado' and self.state == 'open':
|
||||||
print(days_diference, self.party.name)
|
|
||||||
if days_diference.days == 0:
|
if days_diference.days == 0:
|
||||||
return 'Medium'
|
return 'Medium'
|
||||||
if days_diference.days >= 1:
|
if days_diference.days >= 1:
|
||||||
|
@ -411,6 +411,33 @@ class CustomerService(metaclass=PoolMeta):
|
||||||
return 'Medium'
|
return 'Medium'
|
||||||
return 'low'
|
return 'low'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def search_current_risk(cls, name, clause):
|
||||||
|
# pool = Pool()
|
||||||
|
# CustomerService = pool.get('crm.customer_service')
|
||||||
|
# customer_service = CustomerService.__table__()
|
||||||
|
# query = customer_service.select(customer_service.id)
|
||||||
|
# datetime.today()-(datecustomer_service.cs_date))
|
||||||
|
print(clause[2], 'este es mi clause')
|
||||||
|
cursor = Transaction().connection.cursor()
|
||||||
|
if clause[2] == 'Higher':
|
||||||
|
query = f"""select id from crm_customer_service where (state='open' AND media='supersalud') AND
|
||||||
|
((classification='reclamo_riesgo_vital') OR
|
||||||
|
(DATE_PART('day', CURRENT_DATE - cs_date) > 0 AND classification='reclamo_riesgo_priorizado') OR
|
||||||
|
(DATE_PART('day', CURRENT_DATE - cs_date) > 1 AND classification='reclamo_riesgo_simple'));"""
|
||||||
|
elif clause[2] == 'Medium':
|
||||||
|
query = f"""select id from crm_customer_service where (state='open' AND media='supersalud') AND
|
||||||
|
((DATE_PART('day', CURRENT_DATE - cs_date)=0 AND classification='reclamo_riesgo_priorizado') OR
|
||||||
|
(DATE_PART('day', CURRENT_DATE - cs_date)=1 AND classification='reclamo_riesgo_simple'));"""
|
||||||
|
elif clause[2] == 'low':
|
||||||
|
query = f"""select id from crm_customer_service where (state='open' AND media='supersalud') AND
|
||||||
|
((DATE_PART('day', CURRENT_DATE - cs_date)=0 AND classification='reclamo_riesgo_simple'));"""
|
||||||
|
cursor.execute(query)
|
||||||
|
result = cursor.fetchall()
|
||||||
|
ids = [tupla[0] for tupla in result]
|
||||||
|
return [('id', 'in', ids)]
|
||||||
|
# return [('id', 'in', query)]
|
||||||
|
|
||||||
def send_email_customer(self, template, attachments=[]):
|
def send_email_customer(self, template, attachments=[]):
|
||||||
if self.department_region and self.department_region.emails:
|
if self.department_region and self.department_region.emails:
|
||||||
dmt_email = self.department_region.emails[0].email
|
dmt_email = self.department_region.emails[0].email
|
||||||
|
|
|
@ -257,5 +257,33 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<menuitem parent="dash.menu_configuration" sequence="250"
|
<menuitem parent="dash.menu_configuration" sequence="250"
|
||||||
action="act_dash_app_crm_fiduprevisora_form" id="menu_dash_app_crm_fiduprevisora_form"/>
|
action="act_dash_app_crm_fiduprevisora_form" id="menu_dash_app_crm_fiduprevisora_form"/>
|
||||||
|
|
||||||
|
<record model="ir.action.act_window.domain" id="act_customer_service_form_domain_higher">
|
||||||
|
<field name="name">Higher</field>
|
||||||
|
<field name="sequence" eval="90"/>
|
||||||
|
<field name="domain" eval="[
|
||||||
|
('current_risk', '=', 'Higher'),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="crm.act_customer_service_form"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.domain" id="act_customer_service_form_domain_medium">
|
||||||
|
<field name="name">Medium</field>
|
||||||
|
<field name="sequence" eval="90"/>
|
||||||
|
<field name="domain" eval="[
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('current_risk', '=', 'Medium')
|
||||||
|
]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="crm.act_customer_service_form"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.domain" id="act_customer_service_form_domain_low">
|
||||||
|
<field name="name">Low</field>
|
||||||
|
<field name="sequence" eval="90"/>
|
||||||
|
<field name="domain" eval="[
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('current_risk', '=', 'low')
|
||||||
|
]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="crm.act_customer_service_form"/>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
19
locale/es.po
19
locale/es.po
|
@ -82,6 +82,10 @@ msgctxt "field:crm.customer_service,classification:"
|
||||||
msgid "Classification"
|
msgid "Classification"
|
||||||
msgstr "Clasificación"
|
msgstr "Clasificación"
|
||||||
|
|
||||||
|
msgctxt "field:crm.customer_service,current_risk:"
|
||||||
|
msgid "Current Risk"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "field:crm.customer_service,department_region:"
|
msgctxt "field:crm.customer_service,department_region:"
|
||||||
msgid "Department"
|
msgid "Department"
|
||||||
msgstr "Departamento de Región"
|
msgstr "Departamento de Región"
|
||||||
|
@ -406,6 +410,21 @@ msgctxt "model:ir.action,name:fiduprevisora_report_wizard"
|
||||||
msgid "Fiduprevisora Report"
|
msgid "Fiduprevisora Report"
|
||||||
msgstr "Reporte Fiduprevisora"
|
msgstr "Reporte Fiduprevisora"
|
||||||
|
|
||||||
|
msgctxt ""
|
||||||
|
"model:ir.action.act_window.domain,name:act_customer_service_form_domain_higher"
|
||||||
|
msgid "Higher"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt ""
|
||||||
|
"model:ir.action.act_window.domain,name:act_customer_service_form_domain_low"
|
||||||
|
msgid "Low"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt ""
|
||||||
|
"model:ir.action.act_window.domain,name:act_customer_service_form_domain_medium"
|
||||||
|
msgid "Medium"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "model:ir.ui.menu,name:"
|
msgctxt "model:ir.ui.menu,name:"
|
||||||
msgid "Cities"
|
msgid "Cities"
|
||||||
msgstr "Ciudades"
|
msgstr "Ciudades"
|
||||||
|
|
|
@ -2,15 +2,23 @@
|
||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
|
<xpath expr="/tree/field[@name='efficacy']"
|
||||||
|
position="replace">
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="/tree/field[@name='number']"
|
||||||
|
position="after">
|
||||||
|
<field name="efficacy"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="/tree/field[@name='city']"
|
<xpath expr="/tree/field[@name='city']"
|
||||||
position="after">
|
position="after">
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/tree/field[@name='customer']"
|
<xpath expr="/tree/field[@name='customer']"
|
||||||
position="after">
|
position="after">
|
||||||
|
<field name="current_risk"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/tree/field[@name='party']"
|
<xpath expr="/tree/field[@name='party']"
|
||||||
position="after">
|
position="after">
|
||||||
<field name="region"/>
|
<!-- <field name="region"/> -->
|
||||||
<field name="department_region"/>
|
<field name="department_region"/>
|
||||||
<field name="city_region"/>
|
<field name="city_region"/>
|
||||||
<field name="health_provider"/>
|
<field name="health_provider"/>
|
||||||
|
|
Loading…
Reference in New Issue