update divide by 0 condition

This commit is contained in:
Pawan Kumar 2021-01-06 18:04:04 +05:30
parent 01d7ecfd97
commit 0a60384fb1
2 changed files with 3 additions and 2 deletions

View File

@ -178,7 +178,8 @@ class InheritProjectProductEmployeeMap(models.Model):
val.cost = val.project_id.budgeted_revenue * (val.project_id.manager_per/100) * (val.distribution_per/100)
else:
val.cost = val.project_id.budgeted_revenue * (val.project_id.employee_per/100) * (val.distribution_per/100)
val.budgeted_qty = val.cost/val.price_unit
if val.price_unit > 0.0:
val.budgeted_qty = val.cost/val.price_unit
else:
val.cost = 0.0
#val.cost = val.budgeted_qty * val.price_unit

View File

@ -44,7 +44,7 @@
<field name="budgeted_revenue"
attrs="{'invisible': [('pricing_type','=','fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}"/>
<field name="hour_distribution" widget="radio"
attrs="{'invisible': [('project_type','!=','hours_in_consultant')]}"/>
attrs="{'invisible': ['|',('project_type','!=','hours_in_consultant'),('pricing_type','=','fixed_rate')]}"/>
<field name="manager_per" attrs="{'invisible': [('hour_distribution','!=','Percentage')]}"/>
<field name="employee_per" attrs="{'invisible': [('hour_distribution','!=','Percentage')]}"/>
<field name="expenses_per" attrs="{'invisible': [('pricing_type','=','fixed_rate')]}"/>