Start and end time added

This commit is contained in:
projectsodoo 2021-01-04 22:21:58 +05:30
parent 9cb9b085e6
commit 21b2edc61d
3 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,8 @@ class Project(models.Model):
" them or by someone of their company.")
allow_billable = fields.Boolean("Billable", default=True, help="Invoice your time and material from tasks.")
start_date = fields.Date(string='Start Date')
end_date = fields.Date(string='End Date')
budgeted_hours = fields.Float(string='Total Budgeted Hours', digits=(16, 2))
budgeted_revenue = fields.Float(string='Budgeted Revenue', digits=(16, 2))
expenses_per = fields.Float(string='Expenses (%)', digits=(16, 2))
@ -50,6 +52,11 @@ class Project(models.Model):
profit_per = fields.Float(string='Porfit Percentage', digits=(16, 2), compute='_compute_calc', store=True)
consultant_cost = fields.Float("Sum of Cost", compute='onchange_compute_values', store=True)
_sql_constraints = [
('end_date_greater', 'check(end_date >= start_date)', 'Error ! Ending Date cannot be set before Beginning Date.')
]
@api.onchange('budgeted_revenue', 'expenses_per')
def onchange_expenses_per(self):
if self.budgeted_revenue > 0 and self.expenses_per > 0:

View File

@ -39,6 +39,8 @@
widget="radio"/>
<field name="project_type" attrs="{'invisible': [('pricing_type', '=', 'fixed_rate')]}"
widget="radio"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="budgeted_revenue"
attrs="{'invisible': [('pricing_type','=','fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}"/>
<field name="expenses_per" attrs="{'invisible': [('pricing_type','=','fixed_rate')]}"/>

View File

@ -32,6 +32,8 @@ class BudgetHrsAnalysis(models.Model):
Pro_emp.employee_id AS employee_id,
'Budgeted Hours' as hours_type,
CASE
--WHEN Pro.project_type='hours_no_limit' THEN Pro.budgeted_hours
--WHEN Pro.project_type='hours_in_consultant' and Pro_emp.id is not null THEN Pro_emp.budgeted_qty
WHEN Pro_emp.id is null THEN Pro.budgeted_hours
ELSE Pro_emp.budgeted_qty
END AS hours