update code without division

This commit is contained in:
Pawan Kumar 2021-01-04 13:33:46 +05:30
parent daedab9435
commit 2b4226b422
1 changed files with 15 additions and 0 deletions

View File

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