diff --git a/addons/sale_timesheet/controllers/main.py b/addons/sale_timesheet/controllers/main.py index 975b79523a9..4435f1e8a60 100644 --- a/addons/sale_timesheet/controllers/main.py +++ b/addons/sale_timesheet/controllers/main.py @@ -24,7 +24,7 @@ class SaleTimesheetController(http.Controller): 'domain': domain, } hour_rounding = request.env.ref('product.product_uom_hour').rounding - billable_types = ['non_billable', 'billable_time', 'billable_fixed'] + billable_types = ['non_billable', 'non_billable_project', 'billable_time', 'billable_fixed'] # -- Dashboard (per billable type) dashboard_values = { @@ -69,6 +69,7 @@ class SaleTimesheetController(http.Controller): repartition_employee.setdefault(employee_id, dict( employee_id=data['employee_id'][0], employee_name=data['employee_id'][1], + non_billable_project=0.0, non_billable=0.0, billable_time=0.0, billable_fixed=0.0, diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py index 96f4aa23bd9..9d9c9ace01a 100644 --- a/addons/sale_timesheet/models/account.py +++ b/addons/sale_timesheet/models/account.py @@ -11,7 +11,8 @@ class AccountAnalyticLine(models.Model): timesheet_invoice_type = fields.Selection([ ('billable_time', 'Billable Time'), ('billable_fixed', 'Billable Fixed'), - ('non_billable', 'Non Billable')], string="Billable Type", readonly=True, copy=False) + ('non_billable', 'Non Billable'), + ('non_billable_project', 'No task found')], string="Billable Type", readonly=True, copy=False) timesheet_invoice_id = fields.Many2one('account.invoice', string="Invoice", readonly=True, copy=False, help="Invoice created from the timesheet") timesheet_revenue = fields.Monetary("Revenue", default=0.0, readonly=True, currency_field='company_currency_id', copy=False) @@ -83,14 +84,14 @@ class AccountAnalyticLine(models.Model): timesheet_uom = self.env.user.company_id.project_time_mode_id # default values - billable_type = 'non_billable' + billable_type = 'non_billable_project' if not timesheet.task_id else 'non_billable' unit_amount = timesheet.unit_amount so_line = timesheet.so_line revenue = 0.0 billable_type = 'non_billable' # set the revenue and billable type according to the product and the SO line - if so_line.product_id.type == 'service' and so_line.product_id.service_type == 'timesheet': + if timesheet.task_id and so_line.product_id.type == 'service' and so_line.product_id.service_type == 'timesheet': # find the analytic account to convert revenue into its currency analytic_account = timesheet.account_id # convert the unit of mesure into hours diff --git a/addons/sale_timesheet/static/src/less/sale_timesheet.less b/addons/sale_timesheet/static/src/less/sale_timesheet.less index b420a53a2a2..8eba97fb085 100644 --- a/addons/sale_timesheet/static/src/less/sale_timesheet.less +++ b/addons/sale_timesheet/static/src/less/sale_timesheet.less @@ -35,6 +35,10 @@ background-color: #5bc0de; color: white; } + .o_progress_non_billable_project { + background-color: @brand-primary; + color: white; + } .o_progress_non_billable { background-color: gray; color: white; diff --git a/addons/sale_timesheet/views/hr_timesheet_templates.xml b/addons/sale_timesheet/views/hr_timesheet_templates.xml index 14fc5fd6195..01c8523ce75 100644 --- a/addons/sale_timesheet/views/hr_timesheet_templates.xml +++ b/addons/sale_timesheet/views/hr_timesheet_templates.xml @@ -19,21 +19,21 @@
| + | Hours |
|
Time and material | -+ | Rates |
|
Time and material | -+ | Profitability | @@ -61,13 +61,13 @@ |
|---|---|---|---|---|---|---|---|---|---|---|
|
- |
- Non Billable | +No task found |
- |
- Non Billable | +No task found |
|
Cost | |||
|
+ |
+ Non Billable | +
+ |
+ Non Billable | ++ | + | |||||
|
Billable fixed
Billable time
+ No task found
Non billable
|