|
@@ -8,12 +8,31 @@ class ProjectTask(models.Model):
|
|
|
|
|
|
|
|
x_start_date = fields.Date(string="Fecha inicio")
|
|
x_start_date = fields.Date(string="Fecha inicio")
|
|
|
x_end_date = fields.Date(string="Fecha final")
|
|
x_end_date = fields.Date(string="Fecha final")
|
|
|
|
|
+ x_days_duration = fields.Integer(string="Duración (Días)", compute="compute_days_duration", store=True)
|
|
|
|
|
+
|
|
|
|
|
+ @api.depends("x_start_date","x_end_date")
|
|
|
|
|
+ def compute_days_duration(self):
|
|
|
|
|
+ for rec in self:
|
|
|
|
|
+ if rec.x_start_date and rec.x_end_date:
|
|
|
|
|
+ rec.x_days_duration = (rec.x_end_date - rec.x_start_date).days
|
|
|
|
|
+ else:
|
|
|
|
|
+ rec.x_days_duration = 0
|
|
|
|
|
|
|
|
@api.depends('date_deadline', 'planned_date_begin', 'user_ids')
|
|
@api.depends('date_deadline', 'planned_date_begin', 'user_ids')
|
|
|
def _compute_allocated_hours(self):
|
|
def _compute_allocated_hours(self):
|
|
|
for rec in self:
|
|
for rec in self:
|
|
|
rec.allocated_hours = 0
|
|
rec.allocated_hours = 0
|
|
|
|
|
|
|
|
|
|
+ @api.depends('project_id')
|
|
|
|
|
+ def _compute_display_in_project(self):
|
|
|
|
|
+ for rec in self:
|
|
|
|
|
+ rec.display_in_project = True
|
|
|
|
|
+
|
|
|
|
|
+ @api.depends('project_id', 'parent_id')
|
|
|
|
|
+ def _compute_show_display_in_project(self):
|
|
|
|
|
+ for rec in self:
|
|
|
|
|
+ rec.show_display_in_project = False
|
|
|
|
|
+
|
|
|
@api.onchange("x_start_date")
|
|
@api.onchange("x_start_date")
|
|
|
def onchange_start_date(self):
|
|
def onchange_start_date(self):
|
|
|
for rec in self:
|
|
for rec in self:
|