diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py
index e082d91..6c51f03 100755
--- a/cor_custom/models/analytic.py
+++ b/cor_custom/models/analytic.py
@@ -53,6 +53,7 @@ class AccountAnalyticLine(models.Model):
parent_project = fields.Many2one('project.project', related='project_id.parent_project', string='Parent Project')
sub_project = fields.Many2one('project.project', domain="[('is_sub_project', '=', True)]",
string='Sub Project')
+ active_project = fields.Boolean(related='project_id.active', store=True)
@api.onchange('project_id')
def _onchange_sub_project_id(self):
@@ -254,8 +255,8 @@ class AccountAnalyticLine(models.Model):
value._onchange_start_end_date_time()
if value.unit_amount == 0.0:
raise ValidationError(_("Your can not fill 0.0 hour entry"))
- if value.unit_amount >= 24.0:
- raise ValidationError(_("Your can not fill more than 24.0 hour entry"))
+ # if value.unit_amount >= 24.0:
+ # raise ValidationError(_("Your can not fill more than 24.0 hour entry"))
return value
def write(self, vals):
diff --git a/cor_custom/views/analytic_view.xml b/cor_custom/views/analytic_view.xml
index 64ebee5..1756a00 100755
--- a/cor_custom/views/analytic_view.xml
+++ b/cor_custom/views/analytic_view.xml
@@ -66,7 +66,7 @@
-
@@ -81,6 +81,7 @@
+
@@ -163,7 +164,7 @@
-
@@ -229,7 +230,7 @@
-
+
diff --git a/cor_custom/views/project_view.xml b/cor_custom/views/project_view.xml
index f4dc19a..879ad51 100755
--- a/cor_custom/views/project_view.xml
+++ b/cor_custom/views/project_view.xml
@@ -6,12 +6,12 @@
project.project
-
-
-
-
-
-
+
+
+
+
+
+
@@ -263,9 +263,9 @@
code
- if records:
- action = records.action_done_task()
-
+ if records:
+ action = records.action_done_task()
+
diff --git a/sub_project/models/sub_project.py b/sub_project/models/sub_project.py
index 18b8c91..f2dd98c 100755
--- a/sub_project/models/sub_project.py
+++ b/sub_project/models/sub_project.py
@@ -9,6 +9,24 @@ class SubProject(models.Model):
sub_project = fields.Many2many('project.project', 'project_subproject_rel', 'project_id', 'id',
domain="[('is_sub_project', '=', True),('parent_project', '=', False)]", string='Sub Project')
parent_project = fields.Many2one('project.project', domain="[('is_sub_project', '=', False)]", string='Parent Project')
+ total_timesheet_time_sub_project = fields.Integer(compute='_compute_total_timesheet_time_sub_project')
+
+ def _compute_total_timesheet_time_sub_project(self):
+ for project in self:
+ total_time = 0.0
+ record = self.env['account.analytic.line'].search([(('sub_project', '=', project.id))])
+ for timesheet in record:
+ total_time += timesheet.unit_amount * timesheet.product_uom_id.factor_inv
+ total_time *= project.timesheet_encode_uom_id.factor
+ project.total_timesheet_time_sub_project = total_time
+ #project.total_timesheet_time_sub_project = int(round(total_time))
+
+
+ def action_view_custom_sub_project(self):
+ action = self.env["ir.actions.actions"]._for_xml_id("hr_timesheet.timesheet_action_all")
+ action['domain'] = [('sub_project', '=', self.id)]
+ action['context'] = {'search_default_sub_project': self.id}
+ return action
# @api.onchange('parent_project', 'sub_project')
# def onchange_parent_project_sub_project(self):
diff --git a/sub_project/views/sub_project.xml b/sub_project/views/sub_project.xml
index 497e85d..5417ffd 100755
--- a/sub_project/views/sub_project.xml
+++ b/sub_project/views/sub_project.xml
@@ -1,22 +1,72 @@
+
+
+ project.project.invoice.form.inherit
+ project.project
+
+
+
+
+
+
+
+
+
+
project.project.form.inherit
project.project
+
-
+
-
+
-
@@ -71,7 +120,7 @@
-
+