add percentage count method
This commit is contained in:
parent
997665c9c0
commit
76e8a89d43
|
@ -93,12 +93,24 @@ class ProjectResourceLine(models.Model):
|
|||
|
||||
@api.onchange('price_unit', 'budgeted_qty')
|
||||
def _calculate_total_cost(self):
|
||||
# if self.env.context.get('active_model') == 'project.project' and self.env.context.get('active_id'):
|
||||
# pro = self.env['project.project'].browse(self.env.context.get('active_id'))
|
||||
if self.project_id.project_type == 'hours_in_consultant':
|
||||
if self.hour_distribution == 'Manual':
|
||||
self.cost = self.price_unit * self.budgeted_qty
|
||||
|
||||
@api.onchange('price_unit', 'distribution_per', 'employee_id', 'role', 'budgeted_qty')
|
||||
def _compute_total_cost(self):
|
||||
for val in self:
|
||||
if val.project_id.project_type == 'hours_in_consultant':
|
||||
if val.hour_distribution == 'Percentage':
|
||||
if val.role == 'Manager':
|
||||
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)
|
||||
if val.price_unit > 0.0:
|
||||
val.budgeted_qty = val.cost / val.price_unit
|
||||
|
||||
@api.onchange('start_date', 'end_date')
|
||||
def _onchange_start_end_date(self):
|
||||
# if self.start_date:
|
||||
|
|
Loading…
Reference in New Issue