Fix
This commit is contained in:
parent
f2d1fe8f03
commit
d158d1c728
|
@ -1,4 +1,4 @@
|
|||
Copyright (C) 2019 Presik Technologies.
|
||||
Copyright (C) 2019-2023 Presik Technologies.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
14
__init__.py
14
__init__.py
|
@ -1,6 +1,5 @@
|
|||
#This file is part product_barcode module for Tryton.
|
||||
#The COPYRIGHT file at the top level of this repository contains
|
||||
#the full copyright notices and license terms.
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from . import configuration
|
||||
|
@ -17,10 +16,6 @@ def register():
|
|||
party.RegionFiduprevisora,
|
||||
party.DepartmentCode,
|
||||
party.Party,
|
||||
# customer_service.UserFiduprevisora,
|
||||
# customer_service.FiduprevisoraDepartment,
|
||||
# customer_service.FiduprevisoraCity,
|
||||
# customer_service.FiduprevisoraRegionDepartment,
|
||||
customer_service.ListSpecialty,
|
||||
customer_service.ReceiverService,
|
||||
customer_service.CustomerService,
|
||||
|
@ -32,6 +27,11 @@ def register():
|
|||
customer_service.CustomerReceiver,
|
||||
customer_service.AppCustomerFiduprevisora,
|
||||
dash.DashApp,
|
||||
dash.AppConsultaPQR,
|
||||
# customer_service.UserFiduprevisora,
|
||||
# customer_service.FiduprevisoraDepartment,
|
||||
# customer_service.FiduprevisoraCity,
|
||||
# customer_service.FiduprevisoraRegionDepartment,
|
||||
module='crm_fiduprevisora', type_='model')
|
||||
Pool.register(
|
||||
customer_service.FiduprevisoraReportWizard,
|
||||
|
|
4
case.py
4
case.py
|
@ -1,7 +1,7 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval, Bool, Not
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ from trytond.pool import PoolMeta
|
|||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'crm.configuration'
|
||||
|
||||
region_defect = fields.Many2One('crm.region_fiduprevisora', 'Region For Defect')
|
||||
response_mail_template = fields.Many2One('email.template', 'Template Response Emails')
|
||||
notification_mail_template = fields.Many2One('email.template', 'Template Notification Emails')
|
||||
region_defect = fields.Many2One('crm.region_fiduprevisora',
|
||||
'Region For Defect')
|
||||
response_mail_template = fields.Many2One('email.template',
|
||||
'Template Response Emails')
|
||||
notification_mail_template = fields.Many2One('email.template',
|
||||
'Template Notification Emails')
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from __future__ import with_statement
|
||||
from bdb import effective
|
||||
|
||||
from datetime import datetime, timedelta, time
|
||||
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Eval, If, In, Get, Or, Bool, Not
|
||||
from trytond.pyson import Eval, Or, Bool, Not
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
||||
from trytond.wizard import Wizard, StateView, Button, StateReport
|
||||
from trytond.report import Report
|
||||
from .exceptions import MessageUserError
|
||||
from trytond.modules.dash.dash import DashAppBase
|
||||
|
@ -18,16 +15,16 @@ STATES = {
|
|||
}
|
||||
|
||||
NEW_MEDIA = new_sel = [
|
||||
('', ''),
|
||||
('sede', 'Sede'),
|
||||
('web', 'Web'),
|
||||
('supersalud', 'Supersalud'),
|
||||
('', ''),
|
||||
('sede', 'Sede'),
|
||||
('web', 'Web'),
|
||||
('supersalud', 'Supersalud'),
|
||||
]
|
||||
|
||||
CLASSIFICATION = new_sel = [
|
||||
('', ''),
|
||||
('riesgo_vida', 'Riesgo de Vida'),
|
||||
('regular', 'Regular'),
|
||||
('', ''),
|
||||
('riesgo_vida', 'Riesgo de Vida'),
|
||||
('regular', 'Regular'),
|
||||
]
|
||||
|
||||
SEXUAL_DIVERSITY = [
|
||||
|
@ -63,9 +60,7 @@ class ReceiverService(ModelSQL, ModelView):
|
|||
__name__ = 'crm.receiver_service'
|
||||
_rec_name = 'name'
|
||||
name = fields.Char('Name', required=True)
|
||||
# email = fields.Char('Email', required=True)
|
||||
emails = fields.One2Many('crm.receiver_service.email',
|
||||
'receiver', 'Emails')
|
||||
emails = fields.One2Many('crm.receiver_service.email', 'receiver', 'Emails')
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.name
|
||||
|
@ -76,22 +71,23 @@ class ReceiverService(ModelSQL, ModelView):
|
|||
bool_op = 'AND'
|
||||
else:
|
||||
bool_op = 'OR'
|
||||
return [bool_op,
|
||||
('name',) + tuple(clause[1:]),
|
||||
]
|
||||
return [
|
||||
bool_op,
|
||||
('name',) + tuple(clause[1:]),
|
||||
]
|
||||
|
||||
|
||||
class ReceiverEmail(ModelSQL, ModelView):
|
||||
'Receiver - Emails'
|
||||
__name__ = 'crm.receiver_service.email'
|
||||
receiver = fields.Many2One('crm.receiver_service', 'Receiver', required=True)
|
||||
receiver = fields.Many2One('crm.receiver_service', 'Receiver',
|
||||
required=True)
|
||||
email = fields.Char('Email')
|
||||
|
||||
|
||||
class ListSpecialty(ModelSQL, ModelView):
|
||||
'List Specialty'
|
||||
__name__ = 'list.specialty'
|
||||
|
||||
name = fields.Char('Name', required=True)
|
||||
code = fields.Char('Code', required=True)
|
||||
|
||||
|
@ -107,7 +103,7 @@ class HealthProvider(ModelSQL, ModelView):
|
|||
name = fields.Function(fields.Char('Name'), 'get_rec_name')
|
||||
party = fields.Many2One('party.party', 'Party')
|
||||
city = fields.Many2One('party.city_code', 'City')
|
||||
asset = fields.Boolean('Asset', help="¡Check this if the provider is active!")
|
||||
asset = fields.Boolean('Asset', help="Check this if the provider is active!")
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return self.party.name
|
||||
|
@ -151,25 +147,26 @@ class CustomerService(metaclass=PoolMeta):
|
|||
attach_customer_1 = fields.Char('Attach Customer Web...', readonly=True)
|
||||
attach_customer_2 = fields.Char('Attach Customer Web...', readonly=True)
|
||||
attachments = fields.One2Many('crm.fiduprevisora.attachments',
|
||||
'service', 'Attachments')
|
||||
'service', 'Attachments')
|
||||
others_receivers = fields.One2Many('crm.customer_receiver',
|
||||
'customer_service', 'Receivers')
|
||||
'customer_service', 'Receivers')
|
||||
others_receivers_string = fields.Function(fields.Char('Others Receicers'),
|
||||
'get_others_receivers_string')
|
||||
'get_others_receivers_string')
|
||||
classification = fields.Selection(CLASSIFICATION, 'Classification',
|
||||
states={
|
||||
'required': (Eval('media') == 'supersalud'),
|
||||
'invisible': (Eval('media') != 'supersalud'),
|
||||
})
|
||||
detailed_especific_1= fields.Many2One('list.specialty', 'Detailed Especific 1',
|
||||
states={'required': True})
|
||||
detailed_especific_1= fields.Many2One('list.specialty',
|
||||
'Detailed Especific 1', states={'required': True})
|
||||
detailed_especific_2= fields.Many2One('list.specialty', 'Detailed Especific 2')
|
||||
detailed_especific_3= fields.Many2One('list.specialty', 'Detailed Especific 3')
|
||||
ethnical_group = fields.Selection(ETHNICAL_GROUP, 'Ethnical Group',
|
||||
states={'required': False})
|
||||
sexual_diversity = fields.Selection(SEXUAL_DIVERSITY, 'Sexual Diversity',
|
||||
states={'required': False})
|
||||
displaced = fields.Selection(OPTION_SELECT, 'Displaced', states={'required': False})
|
||||
displaced = fields.Selection(OPTION_SELECT, 'Displaced',
|
||||
states={'required': False})
|
||||
victim_of_violence = fields.Selection(OPTION_SELECT, 'Victim Of Violence',
|
||||
states={'required': False})
|
||||
disabled_person = fields.Selection(OPTION_SELECT, 'Disabled Person',
|
||||
|
@ -211,7 +208,8 @@ class CustomerService(metaclass=PoolMeta):
|
|||
config = Pool().get('crm.configuration')(1)
|
||||
template = config.response_mail_template
|
||||
if not template:
|
||||
service.get_message('No se ha definido una plantilla para el envío del correo.')
|
||||
service.get_message(
|
||||
'No se ha definido una plantilla para el envío del correo.')
|
||||
_attachments = []
|
||||
if service.attachments:
|
||||
for att in service.attachments:
|
||||
|
@ -364,9 +362,11 @@ class CustomerService(metaclass=PoolMeta):
|
|||
template.from_email = dmt_email
|
||||
template.subject = template.subject + self.company.party.name
|
||||
if attachments:
|
||||
response = self._send_mails(template, self, self.email or self.party.email, True, attachments)
|
||||
response = self._send_mails(
|
||||
template, self, self.email or self.party.email, True, attachments)
|
||||
else:
|
||||
response = self._send_mails(template, self, self.email or self.party.email, False, [])
|
||||
response = self._send_mails(
|
||||
template, self, self.email or self.party.email, False, [])
|
||||
if response.status_code == 202:
|
||||
self.write([self], {'sended_mail': True})
|
||||
else:
|
||||
|
@ -378,12 +378,11 @@ class CustomerService(metaclass=PoolMeta):
|
|||
config = pool.get('crm.configuration')(1)
|
||||
template = config.notification_mail_template
|
||||
if template:
|
||||
attach_dict = {}
|
||||
# attach_dict = {}
|
||||
template.subject = template.subject + self.company.party.name
|
||||
response = Template.send(template, self, email,
|
||||
attach=False, attachments=[])
|
||||
if not response or response.status_code != 202:
|
||||
print(email)
|
||||
self.write({self}, {'notes': 'Fallo envio al correo: ' + email})
|
||||
|
||||
def send_emails_department(self):
|
||||
|
@ -394,7 +393,7 @@ class CustomerService(metaclass=PoolMeta):
|
|||
def send_emails_receivers(self, template, attachments=[]):
|
||||
attach = False
|
||||
if attachments:
|
||||
attach= True
|
||||
attach = True
|
||||
template.subject = template.subject + self.company.party.name
|
||||
if self.department_region and self.department_region.emails:
|
||||
dmt_email = self.department_region.emails[0].email
|
||||
|
@ -427,18 +426,16 @@ class CustomerService(metaclass=PoolMeta):
|
|||
today = Date.today()
|
||||
date_ = today - timedelta(days=30)
|
||||
dt = datetime.combine(date_, datetime.min.time())
|
||||
# company = Transaction().context.get('company')
|
||||
res = {
|
||||
'status': 'success',
|
||||
'msg': 'Requerimiento enviado satifactoriamente !!',
|
||||
}
|
||||
print(args, 'this is args teh..........', dt)
|
||||
}
|
||||
services = cls.search([
|
||||
('party', '=', args['party']),
|
||||
('cs_date', '>=', dt),
|
||||
('state', '=', 'open'),
|
||||
('case', '=', args['case']),
|
||||
])
|
||||
])
|
||||
services = None
|
||||
special_population = args.pop('special_population') if args.get('special_population') else []
|
||||
fields_ = [
|
||||
|
@ -489,11 +486,12 @@ class FiduprevisoraReportStart(ModelView):
|
|||
party = fields.Many2One('party.party', 'Party')
|
||||
region = fields.Many2One('crm.region_fiduprevisora', 'Region')
|
||||
receiver_service = fields.Many2One('crm.receiver_service', 'Receiver')
|
||||
department_region = fields.Many2One('party.department_code', 'Department', domain=[
|
||||
('region', '=', Eval('region'))
|
||||
department_region = fields.Many2One('party.department_code', 'Department',
|
||||
domain=[
|
||||
('region', '=', Eval('region'))
|
||||
])
|
||||
city_region = fields.Many2One('party.city_code', 'City', domain=[
|
||||
('department', '=', Eval('department_region'))
|
||||
('department', '=', Eval('department_region'))
|
||||
])
|
||||
|
||||
@staticmethod
|
||||
|
@ -516,11 +514,12 @@ class FiduprevisoraReportStart(ModelView):
|
|||
class FiduprevisoraReportWizard(Wizard):
|
||||
'Fiduprevisora Report Wizard'
|
||||
__name__ = 'crm_fiduprevisora.fiduprevisora_report.wizard'
|
||||
start = StateView('crm_fiduprevisora.fiduprevisora_report.start',
|
||||
start = StateView(
|
||||
'crm_fiduprevisora.fiduprevisora_report.start',
|
||||
'crm_fiduprevisora.fiduprevisora_report_start_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Print', 'print_', 'tryton-ok', default=True),
|
||||
])
|
||||
])
|
||||
print_ = StateReport('crm_fiduprevisora.fiduprevisora_report')
|
||||
|
||||
def do_print_(self, action):
|
||||
|
@ -603,7 +602,6 @@ class FiduprevisoraReport(Report):
|
|||
('city_region', '=', city_region),
|
||||
)
|
||||
services = Service.search(dom_service)
|
||||
|
||||
report_context['records'] = services
|
||||
report_context['start_date'] = start_date
|
||||
report_context['end_date'] = end_date
|
||||
|
@ -614,10 +612,13 @@ class FiduprevisoraReport(Report):
|
|||
class CustomerReceiver(ModelSQL, ModelView):
|
||||
'Customer Receiver'
|
||||
__name__ = 'crm.customer_receiver'
|
||||
customer_service = fields.Many2One('crm.customer_service', 'Customer Service', required=True)
|
||||
receiver = fields.Many2One('crm.receiver_service', 'Receiver', required=True)
|
||||
customer_service = fields.Many2One('crm.customer_service',
|
||||
'Customer Service', required=True)
|
||||
receiver = fields.Many2One('crm.receiver_service', 'Receiver',
|
||||
required=True)
|
||||
media = fields.Selection(NEW_MEDIA, 'Media', required=True)
|
||||
|
||||
|
||||
class AppCustomerFiduprevisora(DashAppBase):
|
||||
'App Customer Fiduprevisora'
|
||||
__name__ = 'dash.app.crm_fiduprevisora'
|
||||
__name__ = 'dash.app.crm_fiduprevisora'
|
||||
|
|
9
dash.py
9
dash.py
|
@ -1,6 +1,8 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.modules.dash.dash import DashAppBase
|
||||
|
||||
|
||||
class DashApp(metaclass=PoolMeta):
|
||||
|
@ -11,6 +13,7 @@ class DashApp(metaclass=PoolMeta):
|
|||
origins = super(DashApp, cls)._get_origin()
|
||||
origins.extend([
|
||||
'dash.app.crm_fiduprevisora',
|
||||
'dash.app.consulta_pqr'
|
||||
])
|
||||
return origins
|
||||
|
||||
|
@ -19,5 +22,11 @@ class DashApp(metaclass=PoolMeta):
|
|||
options = super(DashApp, cls).get_selection()
|
||||
options.extend([
|
||||
('crm_fiduprevisora', 'Crm Fiduprevisora'),
|
||||
('consulta_pqr', 'Cosulta PQR'),
|
||||
])
|
||||
return options
|
||||
|
||||
|
||||
class AppConsultaPQR(DashAppBase):
|
||||
"App Consulta PQR"
|
||||
__name__ = "dash.app.consulta_pqr"
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<record model="dash.app.consulta_pqr" id="dash_app_consulta_pqr">
|
||||
<field name="company">1</field>
|
||||
<field name="icon"></field>
|
||||
<field name="kind">external</field>
|
||||
</record>
|
||||
<record model="dash.app" id="app_consulta_pqr">
|
||||
<field name="name">Consulta PQRs</field>
|
||||
<field name="active">True</field>
|
||||
<field name="app_name">consulta_pqr</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
|
@ -1,7 +1,6 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.model.exceptions import ValidationError
|
||||
|
||||
|
||||
class MessageUserError(UserError):
|
||||
|
|
30
party.py
30
party.py
|
@ -2,16 +2,14 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import fields, ModelSQL, ModelView
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval, If, In, Get, Or, Bool, Not
|
||||
from trytond.transaction import Transaction
|
||||
from operator import getitem, delitem, setitem
|
||||
from trytond.pyson import Eval, Bool, Not
|
||||
|
||||
AFILIATION_STATE = [
|
||||
('', ''),
|
||||
('retirado', 'Retirado'),
|
||||
('activo', 'Activo'),
|
||||
('proteccion_laboral', 'Protección Laboral'),
|
||||
]
|
||||
('', ''),
|
||||
('retirado', 'Retirado'),
|
||||
('activo', 'Activo'),
|
||||
('proteccion_laboral', 'Protección Laboral'),
|
||||
]
|
||||
|
||||
|
||||
TYPE_DOCUMENT = {
|
||||
|
@ -47,7 +45,7 @@ class DepartmentCode(metaclass=PoolMeta):
|
|||
__name__ = "party.department_code"
|
||||
region = fields.Many2One('crm.region_fiduprevisora', 'Region')
|
||||
emails = fields.One2Many('crm.fiduprevisora_department.email',
|
||||
'department', 'Emails')
|
||||
'department', 'Emails')
|
||||
|
||||
|
||||
class DepartmentEmail(ModelSQL, ModelView):
|
||||
|
@ -60,12 +58,14 @@ class DepartmentEmail(ModelSQL, ModelView):
|
|||
class Party(metaclass=PoolMeta):
|
||||
__name__ = "party.party"
|
||||
is_affiliate_user = fields.Boolean('Is Affiliate User')
|
||||
city_attention = fields.Many2One('party.city_code', 'City Attention', states={
|
||||
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
||||
})
|
||||
affiliation_state = fields.Selection(AFILIATION_STATE ,'Affiliation State', states={
|
||||
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
||||
})
|
||||
city_attention = fields.Many2One('party.city_code', 'City Attention',
|
||||
states={
|
||||
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
||||
})
|
||||
affiliation_state = fields.Selection(AFILIATION_STATE ,
|
||||
'Affiliation State', states={
|
||||
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.1
|
||||
version=6.0.2
|
||||
depends:
|
||||
crm
|
||||
email
|
||||
|
@ -11,3 +11,4 @@ xml:
|
|||
customer_service.xml
|
||||
configuration.xml
|
||||
message.xml
|
||||
dash.xml
|
||||
|
|
Loading…
Reference in New Issue