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 @@ --> -