diff options
| author | jem-odoo <jem@openerp.com> | 2018-04-11 14:41:48 +0200 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2018-04-11 16:19:13 +0200 |
| commit | c9098db40bee5ecee94415bcbe3b3ecbd2a107cb (patch) | |
| tree | 1d7090e425e1d989f8878bb7f56f85d5441421bb /addons | |
| parent | 99ce19c7f315967053ae980509870f7b3a01f893 (diff) | |
[FIX] sale_timesheet: non billable task from plan project
We want to retrieve easily the non billable task from
project plan. This commit makes the "Non billable" label
clickable, in the "Hours" sections, and trigger the actions
to display non billable tasks of projects matching the search
of the overview.
Task #1834454
Diffstat (limited to 'addons')
4 files changed, 25 insertions, 2 deletions
diff --git a/addons/sale_timesheet/controllers/main.py b/addons/sale_timesheet/controllers/main.py index 1f34ba9f773..d5d0aa00ccb 100644 --- a/addons/sale_timesheet/controllers/main.py +++ b/addons/sale_timesheet/controllers/main.py @@ -21,7 +21,8 @@ class SaleTimesheetController(http.Controller): values = self._plan_prepare_values(projects) view = request.env.ref('sale_timesheet.timesheet_plan') return { - 'html_content': view.render(values) + 'html_content': view.render(values), + 'project_ids': projects.ids, } def _plan_prepare_values(self, projects): diff --git a/addons/sale_timesheet/static/src/js/timesheet_plan.js b/addons/sale_timesheet/static/src/js/timesheet_plan.js index dba77ff9003..d657b421479 100644 --- a/addons/sale_timesheet/static/src/js/timesheet_plan.js +++ b/addons/sale_timesheet/static/src/js/timesheet_plan.js @@ -15,6 +15,7 @@ var ProjectPlan = AbstractAction.extend(ControlPanelMixin, { "click a[type='action']": "_onClickAction", "click .o_timesheet_plan_redirect": '_onRedirect', "click .oe_stat_button": "_onClickStatButton", + "click .o_timesheet_plan_non_billable_task": "_onClickNonBillableTask", "click .o_timesheet_plan_sale_timesheet_people_time .progress-bar": '_onClickEmployeeProgressbar', }, /** @@ -25,6 +26,7 @@ var ProjectPlan = AbstractAction.extend(ControlPanelMixin, { this.action = action; this.action_manager = parent; this.set('title', action.name || _t('Overview')); + this.project_ids = []; }, /** * @override @@ -121,6 +123,7 @@ var ProjectPlan = AbstractAction.extend(ControlPanelMixin, { params: {domain: domain}, }).then(function(result){ self._refreshPlan(result.html_content); + self.project_ids = result.project_ids; }); }, /** @@ -228,6 +231,22 @@ var ProjectPlan = AbstractAction.extend(ControlPanelMixin, { * @private * @param {MouseEvent} event */ + _onClickNonBillableTask: function (event) { + var self = this; + this.do_action({ + name: _t('Non Billable Tasks'), + type: 'ir.actions.act_window', + view_type: 'form', + view_mode: 'form', + res_model: 'project.task', + views: [[false, 'list'], [false, 'form']], + domain: [['project_id', 'in', this.project_ids || []], ['sale_line_id', '=', false]] + }); + }, + /** + * @private + * @param {MouseEvent} event + */ _onRedirect: function (event) { event.preventDefault(); var $target = $(event.target); diff --git a/addons/sale_timesheet/static/src/less/sale_timesheet.less b/addons/sale_timesheet/static/src/less/sale_timesheet.less index 194f5d591de..6a0662f3b83 100644 --- a/addons/sale_timesheet/static/src/less/sale_timesheet.less +++ b/addons/sale_timesheet/static/src/less/sale_timesheet.less @@ -16,6 +16,9 @@ .table { margin-top: 15px; + a { + cursor: pointer; + } } .table > thead > tr > th, .table > thead > tr > td, .table > tbody > tr > th, .table > tbody > tr > td { diff --git a/addons/sale_timesheet/views/hr_timesheet_templates.xml b/addons/sale_timesheet/views/hr_timesheet_templates.xml index be2f850719f..3e81a1a1d7c 100644 --- a/addons/sale_timesheet/views/hr_timesheet_templates.xml +++ b/addons/sale_timesheet/views/hr_timesheet_templates.xml @@ -96,7 +96,7 @@ <td class="o_timesheet_plan_dashboard_cell"> <t t-esc="dashboard['hours']['non_billable']" t-options="{'widget': 'float_time'}"/> </td> - <td>Non billable</td> + <td><a class="o_timesheet_plan_non_billable_task">Non billable</a></td> <td class="o_timesheet_plan_dashboard_cell"> <t t-esc="dashboard['rates']['non_billable']"/> % </td> |
