Beispiel #1
0
class Stage(models.Model):
    """ Model for case stages. This models the main stages of a document
        management flow. Main 360fin objects (leads, opportunities, project
        issues, ...) will now use only stages, instead of state and stages.
        Stages are for example used to display the kanban view of records.
    """
    _name = "x_360fin.alerta.stage"
    _description = "360fin.alerta.stage"
    _rec_name = 'name'
    _order = "sequence, name, id"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by", store=True, copy=True, comodel_name='res.users')
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on", store=True, copy=True)
    write_uid = fields.Many2one(string="Last Updated by", store=True, copy=True, comodel_name='res.users')

    fold = fields.Boolean(string="Folded in Pipeline", store=True, copy=True, help="This stage is folded in the kanban view when there are no records in that stage to display."")
    legend_priority = fields.Text(string="Priority Management Explanation", store=True, copy=True, translate=True,
        help="Explanation text to help users using the star and priority mechanism on stages or issues that are in this stage.")
    name = fields.Char(string="Stage Name", required=True, store=True, copy=True, translate=True, size=0)
    sequence = fields.Integer(string="Sequence", store=True, copy=True, default=1, help="Used to order stages. Lower is better.")
    requirements = fields.Text(string="Requirements", store=True, copy=True,
        help="Enter here the internal requirements for this stage. It will appear as a tooltip over the stage's name.")
Beispiel #2
0
class F360Instrumento(models.Model):
    _name = "x_360fin.instrumento"
    _description = "360fin.instrumento"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_cnbv = fields.Char(string="Clave CNBV",
                         store=True,
                         copy=True,
                         size=0,
                         help="Clave CNBV")
    x_descripcion = fields.Char(string="Descripcion",
                                store=True,
                                copy=True,
                                size=0,
                                help="Descripción")
    x_name = fields.Char(string="Nombre", store=True, size=0)
def ks_get_date_range_from_month(date_state):
    ks_date_data = {}

    date = datetime.now()
    year = date.year
    month = date.month

    if date_state == "previous":
        month -= 1
        if month == 0:
            month = 12
            year -= 1
    elif date_state == "next":
        month += 1
        if month == 13:
            month = 1
            year += 1

    end_year = year
    end_month = month
    if month == 12:
        end_year += 1
        end_month = 1
    else:
        end_month += 1

    ks_date_data["selected_start_date"] = datetime(year, month, 1)
    ks_date_data["selected_end_date"] = datetime(end_year, end_month,
                                                 1) - timedelta(seconds=1)
    return ks_date_data
Beispiel #4
0
class iut_it_agenda(models.Model):
    _name = 'iut.it.agenda'

    room = fields.Char(string="Salle")
    start = fields.datetime(string='Horaire de début')
    end = fields.datetime(string='Horaire de fin')
    classe = fields.Char(string="Classe concernée")
Beispiel #5
0
class F360Cartera(models.Model):
    _name = "x_360fin.cartera"
    _description = "360fin.cartera"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_descripcion = fields.Char(string="Descripción", store=True, copy=True)
    x_impacto = fields.Integer(String="Impacto PLD",
                               store=True,
                               copy=True,
                               help="Impacto PLD")
    x_name = fields.Char(string="Cartera", store=True, size=0)
Beispiel #6
0
class F360Garantia(models.Model):
    _name = "x_360fin.garantia"
    _description = "360fin.garantia"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_codigo = fields.Char(string="Codigo",
                           store=True,
                           copy=True,
                           size=3,
                           help="Código")
    x_impacto = fields.Integer(string="Impacto PLD",
                               store=True,
                               copy=True,
                               default=1,
                               help="Impacto PLD")
    x_name = fields.Char(string="Garantía", store=True, size=0)
def ks_get_date_range_from_quarter(date_state):
    ks_date_data = {}

    date = datetime.now()
    year = date.year
    quarter = int((date.month - 1) / 3) + 1

    if date_state == "previous":
        quarter -= 1
        if quarter == 0:
            quarter = 4
            year -= 1
    elif date_state == "next":
        quarter += 1
        if quarter == 5:
            quarter = 1
            year += 1

    ks_date_data["selected_start_date"] = datetime(year, 3 * quarter - 2, 1)

    month = 3 * quarter
    remaining = int(month / 12)
    ks_date_data["selected_end_date"] = datetime(
        year + remaining, month % 12 + 1, 1) - timedelta(seconds=1)

    return ks_date_data
Beispiel #8
0
 def get_current_shift(self, dt):
     # get current shift: now between start_time and end_time
     shift = False
     if not dt:
         dt = fields.Datetime.now()
     actual_time = fields.Datetime.from_string(
         dt)  # datetime.datetime.strptime(now, '%Y-%m-%d %H:%M:%S')
     time = actual_time.hour + actual_time.minute / 60
     shift = self.search([('start_time', '<=', time),
                          ('end_time', '>', time)])
     if shift:
         if (len(shift) > 1):
             raise UserError(
                 _('We find more than one shift to this time %s') % time)
         start_datetime = fields.datetime(actual_time.year,
                                          actual_time.month,
                                          actual_time.day,
                                          int(shift.start_time), 0, 0)
         end_datetime = fields.datetime(actual_time.year,
                                        actual_time.month, actual_time.day,
                                        int(shift.end_time), 0, 0)
     else:
         raise UserError(_('We don´t find shift to this time %s') % time)
     return {
         'shift': shift,
         'start_datetime': start_datetime.strftime('%Y-%m-%d %H:%M:%S'),
         'end_datetime': end_datetime.strftime('%Y-%m-%d %H:%M:%S')
     }
Beispiel #9
0
def ks_get_date_range_from_month(date_state, timezone, type,self):
    ks_date_data = {}

    date = datetime.now(pytz.timezone(timezone))
    year = date.year
    month = date.month

    if date_state == "previous":
        month -= 1
        if month == 0:
            month = 12
            year -= 1
    elif date_state == "next":
        month += 1
        if month == 13:
            month = 1
            year += 1

    end_year = year
    end_month = month
    if month == 12:
        end_year += 1
        end_month = 1
    else:
        end_month += 1
    start_date = datetime(year, month, 1)
    end_date = datetime(end_year, end_month, 1) - timedelta(seconds=1)
    if type == 'date':
        ks_date_data["selected_start_date"] = start_date
        ks_date_data["selected_end_date"] = end_date
    else:
        ks_date_data["selected_start_date"] = ks_convert_into_utc(start_date, timezone)
        ks_date_data["selected_end_date"] = ks_convert_into_utc(end_date, timezone)
    return ks_date_data
Beispiel #10
0
def ks_get_date_range_from_quarter(date_state, timezone, type, self):
    ks_date_data = {}

    date = datetime.now(pytz.timezone(timezone))
    year = date.year
    quarter = int((date.month - 1) / 3) + 1

    if date_state == "previous":
        quarter -= 1
        if quarter == 0:
            quarter = 4
            year -= 1
    elif date_state == "next":
        quarter += 1
        if quarter == 5:
            quarter = 1
            year += 1

    start_date = datetime(year, 3 * quarter - 2, 1)

    month = 3 * quarter
    remaining = int(month / 12)
    end_date = datetime(year + remaining, month % 12 + 1,
                        1) - timedelta(seconds=1)
    if type == 'date':
        ks_date_data["selected_start_date"] = datetime.strptime(
            start_date.strftime("%Y-%m-%d"), '%Y-%m-%d')
        ks_date_data["selected_end_date"] = datetime.strptime(
            end_date.strftime("%Y-%m-%d"), '%Y-%m-%d')
    else:
        ks_date_data["selected_start_date"] = ks_convert_into_utc(
            start_date, timezone)
        ks_date_data["selected_end_date"] = ks_convert_into_utc(
            end_date, timezone)
    return ks_date_data
Beispiel #11
0
class F360Escrituras(models.Model):
    _name = "x_360fin.escrituras"
    _description = "360fin.escrituras"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_name = fields.Char(string="Nombre", store=True, size=0)
    x_company_id = fields.Many2one(string="Compañía id",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.company",
                                   on_delete=NULL)
    x_partner_id = fields.Many2one(comodel_name="res.partner",
                                   string="Partner",
                                   store=True,
                                   copy=True,
                                   help="Asociado/Cliente",
                                   on_delete=NULL)
    x_doc = fields.Binary(string="Documento",
                          store=True,
                          copy=True,
                          help="Copia documento")
    x_fedatario = fields.Char(string="Fedatario",
                              store=True,
                              copy=True,
                              help="Fedatario",
                              size=0)
    x_folio = fields.Char(string="Folio",
                          store=True,
                          copy=True,
                          help="Folio",
                          size=0)
    x_tipo = fields.Selection([
        ('1', 'Acta Constitutiva'),
        ('2', 'Poder Legal'),
        ('3', 'Cambio denominación'),
        ('4', 'Reforma Estatutos'),
    ],
                              string="Tipo documento",
                              store=True,
                              copy=True,
                              help="Tipo de documento a registrar")
def ks_get_date_range_from_day(date_state):
    ks_date_data = {}

    date = datetime.now()

    if date_state=="previous":
        date = date-timedelta(days=1)

    ks_date_data["selected_start_date"] = datetime(date.year,date.month,date.day)
    ks_date_data["selected_end_date"] = datetime(date.year, date.month, date.day) + timedelta(days=1, seconds=-1)
    return ks_date_data
def ks_get_date_range_from_year(date_state):
    ks_date_data = {}

    date = datetime.now()
    year = date.year

    if date_state=="previous":
        year -= 1

    ks_date_data["selected_start_date"] = datetime(year, 1, 1)
    ks_date_data["selected_end_date"] = datetime(year+1, 1, 1)-timedelta(seconds=1)

    return ks_date_data
Beispiel #14
0
class F360Genero(models.Model):
    _name = "x_360fin.genero"
    _description = "360fin.genero"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by", store=True, copy=True, comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on", store=True, copy=True)
    write_uid = fields.Many2one(string="Last Updated by", store=True, copy=True, comodel_name="res.users")

    x_codigo = fields.Char(string="Código de sexo", store=True, copy=True, size=1, help="Código de sexo")
    x_name = fields.Char(string="Genero", store=True, size=0)
Beispiel #15
0
def ks_get_date_range_from_day(date_state, timezone):
    ks_date_data = {}

    date = datetime.now()

    if date_state == "previous":
        date = date - timedelta(days=1)
    elif date_state == "next":
        date = date + timedelta(days=1)
    start_date = datetime(date.year, date.month, date.day)
    end_date = datetime(date.year, date.month, date.day) + timedelta(
        days=1, seconds=-1)
    ks_date_data["selected_start_date"] = ks_convert_into_utc(
        start_date, timezone)
    ks_date_data["selected_end_date"] = ks_convert_into_utc(end_date, timezone)
    return ks_date_data
Beispiel #16
0
def ks_get_date_range_from_year(date_state, timezone):
    ks_date_data = {}

    date = datetime.now()
    year = date.year

    if date_state == "previous":
        year -= 1
    elif date_state == "next":
        year += 1
    start_date = datetime(year, 1, 1)
    end_date = datetime(year + 1, 1, 1) - timedelta(seconds=1)
    ks_date_data["selected_start_date"] = ks_convert_into_utc(
        start_date, timezone)
    ks_date_data["selected_end_date"] = ks_convert_into_utc(end_date, timezone)
    return ks_date_data
Beispiel #17
0
class F360Impacto(models.Model):
    _name = "x_360fin.impacto"
    _description = "360fin.impacto"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_company_id = fields.Many2one(string="Compañía id",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.company",
                                   on_delete=NULL,
                                   help="Company id")
    x_impacto = fields.Integer(string="Impacto PLD",
                               store=True,
                               copy=True,
                               default=1,
                               help="Impacto PLD")
    x_name = fields.Char(string="Nombre", store=True, size=0)
    x_partner_id = fields.Many2one(string="Socio ID",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.partner",
                                   on_delete=NULL,
                                   help="Partner id")
    x_max = fields.Float(string='Máximo',
                         store=True,
                         copy=True,
                         compute='_compute_x_max',
                         help="Maximum")
    x_min = fields.Float(string='Mínimo',
                         store=True,
                         copy=True,
                         compute='_compute_x_min',
                         help="Minimum")
Beispiel #18
0
class IutSheduble(models.Model):
    _name = "iut.sheduble"
    _description = "Agenda"

    date_start = fields.datetime(string="Horaire début")
    date_stop = fields.datetime(string="Horaire fin")
    room = fields.Char(string="Salle de classe")
    class_id = fields.Many2one("iut.class",
                               required=True,
                               ondelete='cascade',
                               index=True,
                               copy=False)
    course_id = fields.Many2one("iut.course",
                                required=True,
                                ondelete='cascade',
                                index=True,
                                copy=False)
Beispiel #19
0
def ks_get_date_range_from_year(date_state, timezone, type,self):
    ks_date_data = {}

    date = datetime.now(pytz.timezone(timezone))
    year = date.year

    if date_state == "previous":
        year -= 1
    elif date_state == "next":
        year += 1
    start_date = datetime(year, 1, 1)
    end_date = datetime(year + 1, 1, 1) - timedelta(seconds=1)
    if type == 'date':
        ks_date_data["selected_start_date"] = start_date
        ks_date_data["selected_end_date"] = end_date
    else:
        ks_date_data["selected_start_date"] = ks_convert_into_utc(start_date, timezone)
        ks_date_data["selected_end_date"] = ks_convert_into_utc(end_date, timezone)
    return ks_date_data
Beispiel #20
0
def ks_get_date_range_from_futurestarting(date_state, self_tz):
    ks_date_data = {}
    date = datetime.now()
    hour = (24 - date.hour) + 1
    date = date + timedelta(hours=hour)
    start_date = datetime(date.year, date.month, date.day)
    ks_date_data["selected_start_date"] = ks_convert_into_utc(
        start_date, self_tz)
    ks_date_data["selected_end_date"] = False
    return ks_date_data
Beispiel #21
0
class F360Entidad(models.Model):
    _name = "x_360fin.entidad"
    _description = "360fin.entidad"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_name = fields.Char(string="Nombre", store=True, size=0)
Beispiel #22
0
class F360Evento(models.Model):
    _name = "x_360fin.evento"
    _description = "360fin.evento"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by", store=True, copy=True, comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on", store=True, copy=True)
    write_uid = fields.Many2one(string="Last Updated by", store=True, copy=True, comodel_name="res.users")

    x_company_id = fields.Many2one(string="Compañía id", store=True, copy=True, comodel_name="res.company", on_delete=NULL, help="Company id")
    x_contagio = fields.Integer(string="Impacto Contagio", store=True, copy=True, default=1, help="Impacto contagio")
    x_legal = fields.Integer(string="Impacto legal", store=True, copy=True, default=1, help="Impacto legal")
    x_name = fields.Char(string="Evento", store=True, size=0)
    x_oper = fields.Integer(string="Impacto Operativo", store=True, copy=True, default=1, help="Impacto Operativo")
    x_partner_id = fields.Many2one(string="Partner id", store=True, copy=True, comodel_name="res.partner", on_delete=NULL, help="Partner id")
    x_prob = fields.Integer(string="Nivel de Probabilidad", store=True, copy=True, default=1, help="Nivel de Probabilidad")
    x_promedio = fields.Float(string='Promedio Impacto', compute='_compute_x_promedio', readonly=True, store=True, help="Promedio Impacto")
    x_reput = fields.Integer(string="Impacto Reputacional", ,store=True, copy=True, default=1, help="Impacto Reputacional")
    x_riesgo = fields.Float(string='Riesgo',  readonly=True, store=True, compute='_compute_x_riesgo')
Beispiel #23
0
class F360Categorias(models.Model):
    _name = "x_360fin.categorias"
    _description = "360fin.categorias"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_codigo = fields.Char(string="Código", store=True, copy=True)
    x_descripcion = fields.Char(string="Descripción", store=True, copy=True)
    x_name = fields.Char(string="Categorias", store=True, size=0)
Beispiel #24
0
class F360Colonia(models.Model):
    _name = "x_360fin.colonia"
    _description = "360fin.colonia"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_name = fields.Char(string="Name", store=True, size=0)
    x_zipcode_id = fields.Many2one(string="Código zip id",
                                   store=True,
                                   copy=True,
                                   comodel_name="x_360fin.zipcode",
                                   on_delete=NULL,
                                   help="Zipcode id")
    x_colonia = fields.Char(string="Colonia",
                            store=True,
                            copy=True,
                            help="Colonia",
                            size=0)
    x_codigo = fields.Char(string="Código",
                           store=True,
                           copy=True,
                           help="Código",
                           size=0)
Beispiel #25
0
def ks_get_date_range_from_day(date_state, timezone, type, self):
    ks_date_data = {}

    date = datetime.now(pytz.timezone(timezone))

    if date_state == "previous":
        date = date - timedelta(days=1)
    elif date_state == "next":
        date = date + timedelta(days=1)
    start_date = datetime(date.year, date.month, date.day)
    end_date = datetime(date.year, date.month, date.day) + timedelta(
        days=1, seconds=-1)
    if type == 'date':
        ks_date_data["selected_start_date"] = datetime.strptime(
            start_date.strftime("%Y-%m-%d"), '%Y-%m-%d')
        ks_date_data["selected_end_date"] = end_date
        ks_date_data["selected_end_date"] = datetime.strptime(
            end_date.strftime("%Y-%m-%d"), '%Y-%m-%d')
    else:
        ks_date_data["selected_start_date"] = ks_convert_into_utc(
            start_date, timezone)
        ks_date_data["selected_end_date"] = ks_convert_into_utc(
            end_date, timezone)
    return ks_date_data
Beispiel #26
0
class F360Amortiza(models.Model):
    _name = "x_360fin.amortiza"
    _description = "360fin.amortiza"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name='res.users')
    display_name = fields.Char(string="Display Name", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name='res.users')

    x_balance = fields.Float(string="Balance",
                             compute='_compute_x_balance',
                             store=True,
                             copy=True)
    x_balance_tax = fields.Float(string="Balance with tax",
                                 compute='_compute_x_balance_tax',
                                 store=True,
                                 copy=True,
                                 help="Balance with tax")
    x_capital = fields.Float(string="Capital",
                             compute='_compute_x_capital',
                             index=True,
                             store=True,
                             copy=True,
                             help="Payments to Capital")
    x_company_id = fields.Many2one(string="Company id",
                                   store=True,
                                   copy=True,
                                   help="Company id",
                                   comodel_name="res.company",
                                   on_delete=4)
    x_date = fields.Datetime(string="Date",
                             store=True,
                             copy=True,
                             help="Fecha")
    x_loan_fin = fields.Float(string="Loan Final",
                              compute='_compute_x_loan_fin',
                              store=True,
                              copy=True,
                              help="Loan Final")
    x_loan_ini = fields.Float(string="Loan Initial",
                              compute='_compute_x_loan_ini',
                              store=True,
                              copy=True,
                              help="Loan Initial")
    x_n = fields.Integer(String="Number of Payment",
                         store=True,
                         copy=True,
                         default=1,
                         help="Number of payment")
    x_name = fields.Char(string="Name", store=True, size=0)
    x_opportunity_id = fields.Many2one(string="Opportunity id",
                                       store=True,
                                       copy=True,
                                       comodel_name='crm.lead',
                                       on_delete=False,
                                       help="Opportunity id")
    x_order_id = fields.Many2one(string="Order id",
                                 required=False,
                                 comodel_name="sale.order",
                                 on_delete=False,
                                 domain="[]",
                                 help="Order id")
    x_partner_id = fields.Many2one(string="Código partner id",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.partner",
                                   domain="[]",
                                   on_delete=False,
                                   help="Partner id")
    x_pay = fields.Float(string="Payment",
                         store=True,
                         copy=True,
                         compute='_compute_x_pay',
                         help="Payment")
    x_pay_tax = fields.Float(string="Pay with Tax",
                             compute='_compute_x_pay_tax',
                             store=True,
                             copy=True,
                             help="pay with tax")
    x_product_id = fields.Many2one(string="Product id",
                                   store=True,
                                   copy=True,
                                   help="Product id",
                                   comodel_name='product.product',
                                   domain="[]",
                                   on_delete=False)
    x_rate = fields.Float(string="Rate",
                          store=True,
                          copy=True,
                          compute='_compute_x_rate',
                          help="Interest rate")
    x_tax = fields.Float(string="Tax",
                         store=True,
                         copy=True,
                         compute='_compute_x_tax',
                         help="Tax Amount")
Beispiel #27
0
class Catalogo(models.Model):

    _name = "x_360fin.alerta.catalogo"
    _description = "360fin.alerta.catalogo"
    _rec_name = 'name'
    _order = "sequence, name, id"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name='res.users')
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name='res.users')

    color = fields.Integer(string="Color Index",
                           default=0,
                           store=True,
                           copy=True)
    color_type = fields.Selection([('0', 'ND'), ('1', 'Verde'),
                                   ('2', 'Amarilla'), ('3', 'Roja')],
                                  string="Color de alerta",
                                  store=True,
                                  copy=True)
    count = fields.Integer(string="Cuenta", default=0, store=True, copy=True)
    message = fields.Text(string="Message of Alert",
                          store=True,
                          copy=True,
                          help="Enter the message of the alert")
    name = fields.Char(string="Catálogo Alerta",
                       required=True,
                       store=True,
                       copy=True,
                       translate=True,
                       size=0)
    recommend = fields.Text(string="Recommendation",
                            store=True,
                            copy=True,
                            translate=True,
                            help="Recommendation")
    rule = fields.Text(string="Rule",
                       store=True,
                       copy=True,
                       translate=True,
                       help="Rule")
    sequence = fields.Integer(string="Sequence",
                              store=True,
                              copy=True,
                              default=1,
                              help="Used to order stages. Lower is better.")
    type = fields.Selection([('0', 'ND'), ('1', 'Inusual'), ('2', 'Relevante'),
                             ('3', 'Inusual/Relevante'),
                             ('4', 'Listas Negras')],
                            string="Tipo de alerta",
                            store=True,
                            copy=True)
Beispiel #28
0
class F360Alerta(models.Model):
    _name = "x_360fin.alerta"
    _inherit = ['mail.thread']
    _description = "360fin.alerta"
    _order = "priority desc,date_deadline,id desc"

    def _default_probability(self):
        stage_id = self._default_stage_id()
        if stage_id:
            return self.env['x_360fin.alerta.stage'].browse(
                stage_id).probability
        return 10

    def _default_stage_id(self):
        return self._stage_find(domain=[('fold', '=', False)]).id

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name='res.users')
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name='res.users')

    active = fields.Boolean(string="Active", store=True, copy=True)
    name = fields.Char(string="Alerta",
                       required=True,
                       index=True,
                       readonly=True,
                       store=True,
                       copy=True,
                       size=0)
    date_action_last = fields.Datetime(string="Last Action",
                                       readonly=True,
                                       store=True,
                                       copy=True)
    kanban_state = fields.Selection([('grey', 'Pendiente'),
                                     ('red', 'Bloqueado'),
                                     ('green', 'Validado'),
                                     ('blue', 'Reportado')],
                                    string="Activity State",
                                    readonly=True)
    description = fields.Text(string="Notes", store=True, copy=True)
    priority = fields.Selection(
        f360_alerta_stage.AVAILABLE_PRIORITIES,
        string="Priority",
        store=True,
        index=True,
        copy=True,
        default=f360_alerta_stage.AVAILABLE_PRIORITIES[0][0])
    date_closed = fields.Datetime(string="Closed Date",
                                  readonly=True,
                                  store=True)
    stage_id = fields.Many2one(string="Stage",
                               track_visibility="onchange",
                               store=True,
                               copy=True,
                               index=True,
                               group_expand="_read_group_stage_ids",
                               default=lambda self: self._default_stage_id(),
                               comodel_name="x_360fin.alerta.stage")
    user_id = fields.Many2one(string="Compliance Officer",
                              index=True,
                              track_visibility="onchange",
                              comodel_name="res.users",
                              default=lambda self: self.env.user)
    date_open = fields.Datetime(string="Assigned",
                                readonly=True,
                                store=True,
                                copy=True,
                                default=fields.Datetime.now)
    day_open = fields.Float(string="Days to Assign", readonly=True, store=True)
    day_close = fields.Float(string="Days to Close", readonly=True, store=True)
    date_last_stage_update = fields.Datetime(string="Last Stage Update",
                                             store=True,
                                             index=True,
                                             copy=True,
                                             default=fields.Datetime.now)
    date_conversion = fields.Datetime(string="Conversion Date",
                                      readonly=True,
                                      store=True,
                                      copy=True)

    # Only used for type opportunity
    date_deadline = fields.Date(
        string="Expected Closing",
        store=True,
        copy=True,
        help="Estimate of the date on which the alert will be late.")
    color = fields.Integer(string="Color Index",
                           store=True,
                           copy=True,
                           default=0)

    # Alerts
    alert_id = fields.Many2one(string="Alerta id",
                               readonly=True,
                               store=True,
                               copy=True,
                               comodel_name="x_360fin.alerta.catalogo",
                               help="Alerta id")
    employee_id = fields.Many2one(string="Employee id",
                                  readonly=True,
                                  store=True,
                                  copy=True,
                                  help="Employee id",
                                  comodel_name="hr.employee")
    partner_id = fields.Many2one(string="Partner id",
                                 readonly=True,
                                 store=True,
                                 copy=True,
                                 help="Partner id",
                                 comodel_name="res.partner")
    company_id = fields.Many2one(string="Company id",
                                 readonly=True,
                                 store=True,
                                 copy=True,
                                 help="Company id",
                                 comodel_name="res.company")
    invoice_id = fields.Many2one(string="Invoice id",
                                 readonly=True,
                                 store=True,
                                 copy=True,
                                 help="Invoice id",
                                 comodel_name="account.invoice")
    payment_id = fields.Many2one(string="Payment id",
                                 readonly=True,
                                 store=True,
                                 copy=True,
                                 help="Payment id",
                                 comodel_name="account.payment")
    user_det_id = fields.Many2one(string="User Detect",
                                  track_visibility="onchange",
                                  readonly=True,
                                  store=True,
                                  copy=True,
                                  index=True,
                                  comodel_name="res.user")
    message = fields.Text(string="Message of Alert",
                          readonly=True,
                          store=True,
                          copy=True,
                          help="Enter here the message of the alert")
    message_ids = fields.one2many(string="Messages ids",
                                  store=True,
                                  comodel_name="mail.message",
                                  relation_field="res_id")
    message_channel_ids = fields.Many2one(string="Followers (Channels)",
                                          readonly=True,
                                          comodel_name="mail.channel")
    message_follower_ids = fields.one2many(string="Followers",
                                           store=True,
                                           comodel_name="mail.followers",
                                           relation_field="res_id")
    message_last_post = fields.datetime(
        string="Last Message Date",
        store=True,
        copy=True,
        help="Date of the last message posted on the record")
    message_needaction = fields.Boolean(
        string="Action Needed",
        readonly=True,
        help="If checked, new messages require your attention.If checked,")
    message_needaction_counter = fields.Integer(
        string="Number of actions",
        readonly=True,
        help="Number of messages which requires an action")
    message_partner_ids = fields.Many2many(string="Follower (Partners)",
                                           readonly=True,
                                           comodel_name="res.partner")
    message_unread = fields.Boolean(
        string="Unread Messages",
        readonly=True,
        help="If checked new messages require your attention")
    message_is_follower = fields.Boolean(string="Is Follower", readonly=True)
    message_is_needaction = fields.Boolean(string="Followers (Partners)",
                                           readonly=True)
    message_is_needaction_counter = fields.Integer(string="Number of actions",
                                                   readonly=True)
    message_is_partner_ids = fields.Many2many(string="Follower (Partners)",
                                              readonly=True)
    analysis = fields.Text(string="Analysis of Alert",
                           store=True,
                           copy=True,
                           help="Enter the analysis of the alert")
    message_unread_counter = fields.Integer(string="Unread Messages counter",
                                            readonly=True,
                                            help="Number of unread messages")
    state = fields.Selection([('1', 'Pendiente'), ('2', 'Validado'),
                              ('3', 'Bloqueado'), ('4', 'Reportado')],
                             string="State",
                             store=True,
                             copy=True)

    @api.model
    def _read_group_stage_ids(self, stages, domain, order):
        # retrieve team_id from the context and write the domain
        # - ('id', 'in', stages.ids): add columns that should be present
        # - OR ('fold', '=', False): add default columns that are not folded

        # search_domain = [('id', 'in', stages.ids)]

        # perform search
        # stage_ids = stages._search(search_domain, order=order, access_rights_uid=SUPERUSER_ID)
        stage_ids = self.env['x_360fin.alerta.stage'].search([])
        return stage_ids
        #return stages.browse(stage_ids)

    @api.multi
    def _compute_kanban_state(self):
        today = date.today()
        for alerta in self:
            kanban_state = 'grey'
            if alerta.date_deadline:
                alerta_date = fields.Date.from_string(alerta.date_deadline)
                if alerta_date >= today:
                    kanban_state = 'green'
                else:
                    kanban_state = 'red'
            alerta.kanban_state = kanban_state

    @api.depends('date_open')
    def _compute_day_open(self):
        """ Compute difference between create date and open date """
        for alerta in self.filtered(lambda l: l.date_open):
            date_create = fields.Datetime.from_string(alerta.create_date)
            date_open = fields.Datetime.from_string(alerta.date_open)
            alerta.day_open = abs((date_open - date_create).days)

    @api.depends('date_closed')
    def _compute_day_close(self):
        """ Compute difference between current date and log date """
        for alerta in self.filtered(lambda l: l.date_closed):
            date_create = fields.Datetime.from_string(alerta.create_date)
            date_close = fields.Datetime.from_string(alerta.date_closed)
            alerta.day_close = abs((date_close - date_create).days)

    @api.model
    def _onchange_stage_id_values(self, stage_id):
        """ returns the new values when stage_id has changed """
        if not stage_id:
            return {}
        stage = self.env['x_360fin.alerta.stage'].browse(stage_id)
        return {}

    @api.onchange('stage_id')
    def _onchange_stage_id(self):
        values = self._onchange_stage_id_values(self.stage_id.id)
        self.update(values)

    def _onchange_partner_id_values(self, partner_id):
        """ returns the new values when partner_id has changed """

        return {}

    @api.model
    def _onchange_user_values(self, user_id):
        """ returns new values when user_id has changed """
        return {}

    @api.onchange('user_id')
    def _onchange_user_id(self):
        """ When changing the user, also set a team_id or restrict team id to the ones user_id is member of. """
        values = self._onchange_user_values(self.user_id.id)
        self.update(values)

    @api.multi
    def action_set_active(self):
        return self.write({'active': True})

    @api.multi
    def action_set_unactive(self):
        return self.write({'active': False})

    def _stage_find(self, domain=None, order='sequence'):
        """ Determine the stage of the current lead with its teams, the given domain and the given team_id
            :param domain : base search domain for stage
            :returns 360fin.alerta.stage recordset
        """
        # AND with the domain in parameter
        # if domain:
        #    search_domain += list(domain)
        # perform search, return the first found
        return self.env['x_360fin.alerta.stage'].search([], limit=1)
Beispiel #29
0
class ListaNegra(models.Model):
    _name = "x_360fin.lista_negra"
    _description = "360fin.lista_negra"

    create_date = fields.datetime(string="Created on", store=True, copy=True)
    create_uid = fields.Many2one(string="Created by",
                                 store=True,
                                 copy=True,
                                 comodel_name="res.users")
    display_name = fields.Char(string="Display", readonly=True, size=0)
    id = fields.Integer(string="ID", readonly=True, store=True, copy=True)
    write_date = fields.datetime(string="Last Updated on",
                                 store=True,
                                 copy=True)
    write_uid = fields.Many2one(string="Last Updated by",
                                store=True,
                                copy=True,
                                comodel_name="res.users")

    x_cargo = fields.Char(string="Cargo",
                          store=True,
                          copy=True,
                          size=0,
                          help="Cargo")
    x_cod_individuo = fields.Char(string="Código Individuo",
                                  store=True,
                                  copy=True,
                                  size=0,
                                  help="Código Individuo")

    x_denominacion = fields.Char(string="Denominación",
                                 store=True,
                                 copy=True,
                                 size=0,
                                 help="Denominación")
    x_direccion = fields.Char(string="Dirección",
                              store=True,
                              copy=True,
                              size=0,
                              help="Dirección")

    x_enlace = fields.Char(string="Enlace",
                           store=True,
                           copy=True,
                           size=0,
                           help="Enlace")
    x_exactitud_denominacion = fields.Char(string="Exactidud Denominación",
                                           store=True,
                                           copy=True,
                                           size=0,
                                           help="Exactitud Denominación")
    x_exactitud_id = fields.Char(string="Exactitud Identificación",
                                 store=True,
                                 copy=True,
                                 size=0,
                                 help="Exactitud id")
    x_fecha = fields.datetime(string="Fecha Consulta",
                              store=True,
                              copy=True,
                              help="Fecha Consulta")
    x_id_tributaria = fields.Char(string="Id Tributaria",
                                  store=True,
                                  copy=True,
                                  size=0,
                                  help="Id Tributaria")
    x_identificacion = fields.Char(string="Identificación",
                                   store=True,
                                   copy=True,
                                   size=0,
                                   help="Identificación")
    x_lista = fields.Char(string="Lista",
                          store=True,
                          copy=True,
                          size=0,
                          help="Lista")
    x_lugar_trabajo = fields.Char(string="Lugar de trabajo",
                                  store=True,
                                  copy=True,
                                  size=0,
                                  help="Lugar de trabajo")
    x_mensaje = fields.Char(string="Mensajes",
                            store=True,
                            copy=True,
                            size=0,
                            help="Mensaje")
    x_otra_id = fields.Char(string="Otra Identificación",
                            store=True,
                            copy=True,
                            size=0,
                            help="Otra Identificación")
    x_pais_lista = fields.Char(string="País Lista",
                               store=True,
                               copy=True,
                               size=0,
                               help="País Lista")
    x_status = fields.Char(string="Estado de Búsqueda",
                           store=True,
                           copy=True,
                           size=0,
                           help="Estado de Búsqueda")

    x_name = fields.Char(string="Name", store=True, size=0)
    x_company_id = fields.Many2one(string="Compañía	id",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.company",
                                   on_delete=NULL,
                                   help="Company id")
    x_employee_id = fields.Many2one(string="Employee id",
                                    store=True,
                                    copy=True,
                                    comodel_name="hr.employee",
                                    on_delete=NULL,
                                    help="Employee id")
    x_partner_id = fields.Many2one(string="Socio id",
                                   store=True,
                                   copy=True,
                                   comodel_name="res.partner",
                                   on_delete=NULL,
                                   help="Partner id")
Beispiel #30
0
class WebsiteProposal(models.Model):
    _name = 'website_proposal.proposal'
    _rec_name = 'id'

    def _get_default_company(self):
        company_id = self.env['res.users']._get_company(context=context)
        if not company_id:
            raise UserError(_('Error!'), _('There is no default company for the current user!'))
        return company_id

    def _get_res_name(self, name, args):
        res = {}
        for r in self.browse(ids):
            record = self.env[r.res_model].browse(r.res_id)
            res[r.id] = record.name
        return res

    _columns = {
        'res_name': fields.function(_get_res_name, string='Name', type='char'),
        'access_token': fields.char('Security Token', required=True, copy=False),
        'template_id': fields.many2one('website_proposal.template', 'Quote Template', readonly=True),
        'head': fields.text('Html head'),
        'page_header': fields.text('Page header'),
        'website_description': fields.html('Description'),
        'page_footer': fields.text('Page footer'),

        'res_model': fields.char('Model', readonly=True, help="The database object this is attached to"),
        'res_id': fields.integer('Resource ID', readonly=True, help="The record id this is attached to", select=True),
        'sign': fields.binary('Singature'),
        'sign_date': fields.datetime('Signing Date'),
        'signer': fields.binary('Signer'),
        'state': fields.selection([
            ('draft', 'Draft'),
            ('rejected', 'Rejected'),
            ('done', 'Signed'),
        ]),
        'company_id': fields.many2one('res.company', 'Company'),
    }
    _defaults = {
        'access_token': lambda self, cr, uid, ctx={}: str(uuid.uuid4()),
        'company_id': _get_default_company,
        'state': 'draft',
    }

    def open_proposal(self):
        return {
            'type': 'ir.actions.act_url',
            'target': 'self',
            'url': '/website_proposal/%s' % (ids[0])
        }

    def edit_proposal(self):
        return {
            'type': 'ir.actions.act_url',
            'target': 'self',
            'url': '/website_proposal/%s?enable_editor' % (ids[0])
        }

    def create(self, vals):
        record = self.env[vals.get('res_model']).browse(vals.get('res_id'))

        mako = mako_template_env.from_string(tools.ustr(vals.get('website_description')))
        website_description = mako.render({'record': record})
        website_description = website_description.replace('template-only-', '')

        vals['website_description'] = website_description
        new_id = super(WebsiteProposal, self).create(vals)
        return new_id