lineatarea.py
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class hgt_linea_tarea(models.Model):
_name = 'hgt.linea_tarea'
liquidaciones = fields.Many2one(
string='Liquidaciones',
comodel_name='hgt.liquidacionestareas',
ondelete='restrict',
)
tarea = fields.Many2many(
string='Tareas',
comodel_name='hgt.tarea',
relation='tarea_lineatarea_rel',
column1='hgt_tarea_id',
column2='hgt_linea_tarea_id',
)
name = fields.Char(
related='tarea.name',
readonly=True,
store=True
)
inicio = fields.Datetime(
related='tarea.inicio',
readonly=True,
store=True
)
cierre = fields.Datetime(
related='tarea.cierre',
readonly=True,
store=True
)
minutos_reales = fields.Integer(
related='tarea.minutos_reales',
readonly=True,
store=True
)
tipo_cargo = fields.One2many(
string='Tipo de Cargo',
comodel_name='hgt.tipo_cargo',
inverse_name='linea_tarea',
)
subtotal = fields.Float(
string='Subtotal',
compute='obtener_subtotal',
)
state = fields.Selection(
related='tarea.state',
readonly=True,
store=True
)
def obtener_subtotal(self):
return 0