From b8ed434e471342f26ab8124d3c494f05ba137e91 Mon Sep 17 00:00:00 2001 From: "pawan.sharma" Date: Mon, 1 Aug 2022 11:50:53 +0530 Subject: [PATCH 1/2] hide main timesheet hour menu for sub-project --- sub_project/models/sub_project.py | 9 ++++---- sub_project/views/sub_project.xml | 35 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/sub_project/models/sub_project.py b/sub_project/models/sub_project.py index ae52b6d..f2dd98c 100755 --- a/sub_project/models/sub_project.py +++ b/sub_project/models/sub_project.py @@ -11,17 +11,16 @@ class SubProject(models.Model): 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') - @api.depends('timesheet_ids') def _compute_total_timesheet_time_sub_project(self): for project in self: total_time = 0.0 - value = project.timesheet_ids.search([('sub_project', '!=', False)]) - for timesheet in value: + 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 - # Now convert to the proper unit of measure set in the settings total_time *= project.timesheet_encode_uom_id.factor - #project.total_timesheet_time_sub_project = int(round(total_time)) 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") diff --git a/sub_project/views/sub_project.xml b/sub_project/views/sub_project.xml index 20db701..5417ffd 100755 --- a/sub_project/views/sub_project.xml +++ b/sub_project/views/sub_project.xml @@ -1,18 +1,17 @@ - - - project.project.form.inherit + + + project.project.invoice.form.inherit project.project - + - + + + + + + + + project.project.form.inherit + project.project + + +
- + @@ -67,7 +77,6 @@ --> -
From 51bfc960c373f1f4c7f8e7dd965c0f5bd02fda3d Mon Sep 17 00:00:00 2001 From: "pawan.sharma" Date: Mon, 1 Aug 2022 12:14:39 +0530 Subject: [PATCH 2/2] remove project create option from timesheet for all views --- cor_custom/views/analytic_view.xml | 4 ++-- cor_custom/views/project_view.xml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cor_custom/views/analytic_view.xml b/cor_custom/views/analytic_view.xml index f93cd16..8bae471 100755 --- a/cor_custom/views/analytic_view.xml +++ b/cor_custom/views/analytic_view.xml @@ -163,7 +163,7 @@ - @@ -229,7 +229,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 - -
-
-
+ +
+
+