Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Task Logs
Entity: project.project
Compute Method: _compute_timesheet_stat_values
| Inputs | Method | Outputs |
|---|---|---|
|
+ for project in self: + encode_uom = project.timesheet_encode_uom_id + uom_ratio = self.env.ref('uom.product_uom_hour').factor / encode_uom.factor + + stat_timesheet_value = False + stat_extra_time_value = False + success_rate = False + + allocated = project.allocated_hours * uom_ratio + effective = project.total_timesheet_time + if allocated: + success_rate = round(100 * effective / allocated) + stat_timesheet_value = self.env._( + "%(effective)s / %(allocated)s %(uom_name)s", + effective=round(effective), + allocated=round(allocated), + uom_name=encode_uom.name, + ) + if success_rate > 100: + stat_extra_time_value = self.env._( + "%(exceeding_hours)s %(uom_name)s (+%(exceeding_rate)s%%)", + exceeding_hours=round(effective - allocated), + uom_name=encode_uom.name, + exceeding_rate=round(100 * (effective - allocated) / allocated), + ) + else: + stat_timesheet_value = self.env._( + "%(effective)s %(uom_name)s", + effective=round(effective), + uom_name=encode_uom.name, + ) + + project.stat_timesheet_value = stat_timesheet_value + project.stat_extra_time_value = stat_extra_time_value + project.stat_success_rate = success_rate |
|
