release version 6.0
This commit is contained in:
parent
d9f1b4ccdf
commit
3f1efb9f72
|
@ -3,10 +3,10 @@
|
||||||
#the full copyright notices and license terms.
|
#the full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
import configuration
|
from . import configuration
|
||||||
import customer_service
|
from . import customer_service
|
||||||
import case
|
from . import case
|
||||||
import party
|
from . import party
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|
2
case.py
2
case.py
|
@ -4,8 +4,6 @@ from trytond.model import ModelView, ModelSQL, fields
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.pyson import Eval, Bool, Not
|
from trytond.pyson import Eval, Bool, Not
|
||||||
|
|
||||||
__all__ = ['Case']
|
|
||||||
|
|
||||||
|
|
||||||
class Case(metaclass=PoolMeta):
|
class Case(metaclass=PoolMeta):
|
||||||
__name__ = "crm.case"
|
__name__ = "crm.case"
|
||||||
|
|
|
@ -4,8 +4,6 @@ from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
|
||||||
__all__ = ['Configuration']
|
|
||||||
|
|
||||||
|
|
||||||
class Configuration(metaclass=PoolMeta):
|
class Configuration(metaclass=PoolMeta):
|
||||||
__name__ = 'crm.configuration'
|
__name__ = 'crm.configuration'
|
||||||
|
|
|
@ -9,9 +9,7 @@ from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
|
from .exceptions import MessageUserError
|
||||||
__all__ = ['CustomerService', 'RegionDepartment',
|
|
||||||
'ReceiverService', 'DepartmentEmail', 'HealthProvider']
|
|
||||||
|
|
||||||
STATES = {
|
STATES = {
|
||||||
'readonly': (Eval('state') != 'draft'),
|
'readonly': (Eval('state') != 'draft'),
|
||||||
|
@ -85,24 +83,6 @@ class HealthProvider(ModelSQL, ModelView):
|
||||||
('party.name',) + tuple(clause[1:]),
|
('party.name',) + tuple(clause[1:]),
|
||||||
]
|
]
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def import_data(cls, fields_names, data):
|
|
||||||
cont = 0
|
|
||||||
data_ = []
|
|
||||||
for row in data[0:]:
|
|
||||||
providers = cls.search([
|
|
||||||
('party.id_number', '=', row[0])
|
|
||||||
])
|
|
||||||
for provider in providers:
|
|
||||||
print(provider.name)
|
|
||||||
if not providers:
|
|
||||||
data_.append(row)
|
|
||||||
continue
|
|
||||||
provider = providers[0]
|
|
||||||
cls.write([provider], {'asset': row[2],
|
|
||||||
})
|
|
||||||
return super(HealthProvider, cls).import_data(fields_names, data_)
|
|
||||||
|
|
||||||
|
|
||||||
class CustomerService(metaclass=PoolMeta):
|
class CustomerService(metaclass=PoolMeta):
|
||||||
__name__ = 'crm.customer_service'
|
__name__ = 'crm.customer_service'
|
||||||
|
@ -376,7 +356,7 @@ class CustomerService(metaclass=PoolMeta):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def get_message(self, message):
|
def get_message(self, message):
|
||||||
self.raise_user_error('message', message)
|
raise MessageUserError('message', message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def dash_on_change_user(cls, args, ctx):
|
def dash_on_change_user(cls, args, ctx):
|
||||||
|
@ -400,6 +380,7 @@ class CustomerService(metaclass=PoolMeta):
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class FiduprevisoraAttachments(ModelSQL, ModelView):
|
class FiduprevisoraAttachments(ModelSQL, ModelView):
|
||||||
'Fiduprevisora - Attachments'
|
'Fiduprevisora - Attachments'
|
||||||
__name__ = 'crm.fiduprevisora.attachments'
|
__name__ = 'crm.fiduprevisora.attachments'
|
||||||
|
@ -479,8 +460,8 @@ class FiduprevisoraReport(Report):
|
||||||
__name__ = 'crm_fiduprevisora.fiduprevisora_report'
|
__name__ = 'crm_fiduprevisora.fiduprevisora_report'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_context(cls, records, data):
|
def get_context(cls, records, header, data):
|
||||||
report_context = super(FiduprevisoraReport, cls).get_context(records, data)
|
report_context = super(FiduprevisoraReport, cls).get_context(records, header, data)
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Company = pool.get('company.company')
|
Company = pool.get('company.company')
|
||||||
Service = pool.get('crm.customer_service')
|
Service = pool.get('crm.customer_service')
|
||||||
|
@ -537,6 +518,7 @@ class FiduprevisoraReport(Report):
|
||||||
report_context['company'] = company.party.name
|
report_context['company'] = company.party.name
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
class CustomerReceiver(ModelSQL, ModelView):
|
class CustomerReceiver(ModelSQL, ModelView):
|
||||||
'Customer Receiver'
|
'Customer Receiver'
|
||||||
__name__ = 'crm.customer_receiver'
|
__name__ = 'crm.customer_receiver'
|
||||||
|
|
|
@ -0,0 +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.exceptions import UserError
|
||||||
|
from trytond.model.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class MessageUserError(UserError):
|
||||||
|
pass
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?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 grouped="1">
|
||||||
|
<!-- <record model="ir.message" id="msg_not_sale_shop">
|
||||||
|
<field name="text">Go to user preferences and select a shop "%(s)"</field>
|
||||||
|
</record> -->
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</tryton>
|
76
party.py
76
party.py
|
@ -5,8 +5,6 @@ from trytond.pool import PoolMeta, Pool
|
||||||
from trytond.pyson import Eval, If, In, Get, Or, Bool, Not
|
from trytond.pyson import Eval, If, In, Get, Or, Bool, Not
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
__all__ = ['RegionFiduprevisora', 'DepartmentCode', 'Party']
|
|
||||||
|
|
||||||
|
|
||||||
class RegionFiduprevisora(ModelSQL, ModelView):
|
class RegionFiduprevisora(ModelSQL, ModelView):
|
||||||
'Region Fiduprevisora'
|
'Region Fiduprevisora'
|
||||||
|
@ -55,77 +53,3 @@ class Party(metaclass=PoolMeta):
|
||||||
],'Affiliation State', states={
|
],'Affiliation State', states={
|
||||||
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
'invisible': (Not(Bool(Eval('is_affiliate_user')))),
|
||||||
})
|
})
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def import_data(cls, fields_names, data):
|
|
||||||
City = Pool().get('party.city_code')
|
|
||||||
number_ids = []
|
|
||||||
cont = 0
|
|
||||||
i = 0
|
|
||||||
for row in data[1:]:
|
|
||||||
cities = City.search([
|
|
||||||
('code', '=', row[6].replace(' ', '')),
|
|
||||||
])
|
|
||||||
city_attention = cities[0].id if cities else None
|
|
||||||
i += 1
|
|
||||||
print(i)
|
|
||||||
if row[5] in number_ids:
|
|
||||||
continue
|
|
||||||
number_ids.append(row[5])
|
|
||||||
users = cls.search([
|
|
||||||
('id_number', '=', row[5]),
|
|
||||||
])
|
|
||||||
state_ = ''
|
|
||||||
if row[8] == 'Activo':
|
|
||||||
state_ = 'activo'
|
|
||||||
elif row[8] == 'Retirado':
|
|
||||||
state_ = 'retirado'
|
|
||||||
elif row[8] == 'Protección Laboral' or row[4].count('Laboral') > 0:
|
|
||||||
state_ = 'proteccion_laboral'
|
|
||||||
|
|
||||||
if users:
|
|
||||||
user = users[0]
|
|
||||||
if state_ != user.affiliation_state:
|
|
||||||
cls.write([user], {'affiliation_state': state_})
|
|
||||||
print('actualizado ----> ', user.name)
|
|
||||||
if city_attention:
|
|
||||||
cls.write([user], {'city_attention': city_attention})
|
|
||||||
print('actualizado ----> ', user.name)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
cls.create_new_party(row, state_, city_attention)
|
|
||||||
cont += 1
|
|
||||||
print('creado ----> ', row[5])
|
|
||||||
except:
|
|
||||||
cls.raise_user_error('error_import', 'Error en la linea ' + row[5])
|
|
||||||
return cont
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def create_new_party(cls, row, state_, city_attention):
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
code = cls._new_code()
|
|
||||||
name = row[0] + ' ' + row[1] + ' ' + row[2] + ' ' + row[3]
|
|
||||||
id_number = row[5]
|
|
||||||
if row[4].count('Ciud') > 0:
|
|
||||||
type_document = 13
|
|
||||||
elif row[4].count('Pasa') > 0:
|
|
||||||
type_document = 41
|
|
||||||
elif row[4].count('Tarj') > 0:
|
|
||||||
type_document = 12
|
|
||||||
elif row[4].count('Regi') > 0:
|
|
||||||
type_document = 11
|
|
||||||
else:
|
|
||||||
type_document = 0
|
|
||||||
if city_attention:
|
|
||||||
cursor.execute("INSERT INTO party_party (active, is_affiliate_user, code, \
|
|
||||||
name, id_number, type_document, city_attention, affiliation_state) \
|
|
||||||
VALUES ('true', 'true', '%s', '%s', '%s', '%s', %s, '%s')" % (
|
|
||||||
code, name, id_number, type_document, city_attention, state_
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
cursor.execute("INSERT INTO party_party (active, is_affiliate_user, code, \
|
|
||||||
name, id_number, type_document, affiliation_state) \
|
|
||||||
VALUES ('true', 'true', '%s', '%s', '%s', '%s', '%s')" % (
|
|
||||||
code, name, id_number, type_document, state_)
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=5.0.0
|
version=6.0.0
|
||||||
depends:
|
depends:
|
||||||
crm
|
crm
|
||||||
email
|
email
|
||||||
|
@ -9,3 +9,4 @@ xml:
|
||||||
party.xml
|
party.xml
|
||||||
customer_service.xml
|
customer_service.xml
|
||||||
configuration.xml
|
configuration.xml
|
||||||
|
message.xml
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- 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. -->
|
||||||
<tree editable="bottom">
|
<tree editable="1">
|
||||||
<field name="email"/>
|
<field name="email"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- 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. -->
|
||||||
<tree editable="bottom">
|
<tree editable="1">
|
||||||
<field name="email"/>
|
<field name="email"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- 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. -->
|
||||||
<tree editable="bottom">
|
<tree editable="1">
|
||||||
<field name="receiver"/>
|
<field name="receiver"/>
|
||||||
<field name="media"/>
|
<field name="media"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
Loading…
Reference in New Issue