2020-04-16 15:28:18 +02:00
|
|
|
# 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
|
2020-06-15 23:22:03 +02:00
|
|
|
from trytond.pyson import Eval, Bool, Not
|
2020-04-16 15:28:18 +02:00
|
|
|
|
|
|
|
__all__ = ['Case']
|
|
|
|
|
|
|
|
|
|
|
|
class Case(metaclass=PoolMeta):
|
|
|
|
__name__ = "crm.case"
|
|
|
|
macroprocess = fields.Char('Macroprocess')
|
|
|
|
process_service = fields.Char('Process Service')
|
|
|
|
motives_health = fields.Char('Motives General Health')
|
|
|
|
type_request = fields.Char('Type Request')
|
|
|
|
priority = fields.Char('Priority')
|
|
|
|
time_max = fields.Numeric('Time Max Response (days)', digits=(2, 0))
|
|
|
|
quality_attribute = fields.Char('Quality Attribute')
|
|
|
|
required_attach = fields.Boolean('Required Attach')
|
2020-06-15 23:22:03 +02:00
|
|
|
attach_description = fields.Char('Attach Description', states={
|
|
|
|
'invisible': (Not(Bool(Eval('required_attach')))),
|
|
|
|
'required': (Bool(Eval('required_attach'))),
|
|
|
|
})
|
2020-04-16 15:28:18 +02:00
|
|
|
|
2020-06-15 23:22:03 +02:00
|
|
|
@classmethod
|
|
|
|
def import_data(cls, fields_names, data):
|
|
|
|
cont = 0
|
|
|
|
data_ = []
|
|
|
|
for row in data[1:]:
|
|
|
|
cases = cls.search([
|
|
|
|
('name', '=', row[0])
|
|
|
|
])
|
|
|
|
if not cases:
|
|
|
|
print('Case no found. ', row[0])
|
|
|
|
data_.append(row)
|
|
|
|
continue
|
|
|
|
case = cases[0]
|
|
|
|
cls.write([case], {'required_attach': True,
|
|
|
|
'attach_description': row[2]
|
|
|
|
})
|
|
|
|
print('registro actualizado --->', case.name)
|
|
|
|
return super(Case, cls).import_data(fields_names, data_)
|
2020-04-16 15:28:18 +02:00
|
|
|
|
|
|
|
def get_rec_name(self, name):
|
|
|
|
return self.name
|