From 2b4226b422a70eb5301943d75bcd7dcb3b7cfea3 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Mon, 4 Jan 2021 13:33:46 +0530 Subject: [PATCH] update code without division --- cor_custom/models/project.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cor_custom/models/project.py b/cor_custom/models/project.py index 6fe9cbd..2f5e405 100755 --- a/cor_custom/models/project.py +++ b/cor_custom/models/project.py @@ -82,6 +82,21 @@ class Project(models.Model): record.hourly_rate = (cost/val) record.budgeted_hour_week = budgeted_hour_week + if record.project_type == 'hours_no_limit': + price_unit = 0.0 + count = 0.0 + for rec in record.sale_line_employee_ids: + price_unit = price_unit + rec.price_unit + count = count + 1 + print('price_unit', price_unit, count) + if record.budgeted_hours > 0.0: + avg =(record.budgeted_hours/count) + hourly_rate = price_unit * avg + print('ppppppppppp', avg, hourly_rate) + record.hourly_rate = (price_unit * avg)/record.budgeted_hours + print('100000', record.hourly_rate) + + class InheritProjectProductEmployeeMap(models.Model): _inherit = 'project.sale.line.employee.map'