diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/sale_timesheet/static | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/sale_timesheet/static')
6 files changed, 312 insertions, 0 deletions
diff --git a/addons/sale_timesheet/static/img/product_product_time_product.png b/addons/sale_timesheet/static/img/product_product_time_product.png Binary files differnew file mode 100644 index 00000000..c9d7a77d --- /dev/null +++ b/addons/sale_timesheet/static/img/product_product_time_product.png diff --git a/addons/sale_timesheet/static/src/js/project_overview.js b/addons/sale_timesheet/static/src/js/project_overview.js new file mode 100644 index 00000000..6f40b30d --- /dev/null +++ b/addons/sale_timesheet/static/src/js/project_overview.js @@ -0,0 +1,56 @@ +odoo.define('sale_timesheet.project_overview', function (require) { + "use strict"; + + var qweb = require('web.qweb'); + var viewRegistry = require('web.view_registry'); + + const Controller = qweb.Controller.extend({ + events: _.extend({}, qweb.Controller.prototype.events, { + 'click .project_overview_foldable': '_onFoldToggle', + }), + + _onFoldToggle(ev) { + const {model, resId} = ev.target.dataset; + const shouldOpen = ev.target.classList.contains('fa-caret-right'); + if (model === 'sale.order' && shouldOpen) { + this._openSaleOrder(resId); + } + else if (model === 'sale.order.line' && shouldOpen) { + this._openSaleOrderLine(resId); + } + else { + const targetClass = `.${model.replace(/\./g, '_')}_${resId || 'None'}`; + this.$(targetClass).hide(); + } + $(ev.target).toggleClass('fa-caret-right'); + $(ev.target).toggleClass('fa-caret-down'); + }, + + _openSaleOrder(id) { + id = id || 'None'; + const targetClass = `.sale_order_${id}`; + this.$(`.o_timesheet_forecast_sale_order_line${targetClass}`).show(); + this.$(`.o_timesheet_forecast_hr_employee${targetClass}`).hide(); + this.$(`.o_timesheet_forecast_sale_order_line${targetClass} .fa`).removeClass('fa-caret-down'); + this.$(`.o_timesheet_forecast_sale_order_line${targetClass} .fa`).addClass('fa-caret-right'); + + }, + + _openSaleOrderLine(id) { + id = id || 'None'; + const targetClass = `.sale_order_line_${id}`; + this.$(`.o_timesheet_forecast_hr_employee${targetClass}`).show(); + }, + }); + + var ProjectOverview = qweb.View.extend({ + withSearchBar: true, + searchMenuTypes: ['filter', 'favorite'], + + config: _.extend({}, qweb.View.prototype.config, { + Controller: Controller, + }), + }); + + viewRegistry.add('project_overview', ProjectOverview); +}); diff --git a/addons/sale_timesheet/static/src/js/sale_project_kanban_controller.js b/addons/sale_timesheet/static/src/js/sale_project_kanban_controller.js new file mode 100644 index 00000000..2c252c6f --- /dev/null +++ b/addons/sale_timesheet/static/src/js/sale_project_kanban_controller.js @@ -0,0 +1,68 @@ +odoo.define('sale_timesheet.sale_project_kanban_controller', function (require) { +"use strict"; + +var core = require('web.core'); +var ProjectKanbanController = require('project.project_kanban'); +var session = require('web.session'); + +var QWeb = core.qweb; + +// YTI TODO : Master remove file + +var SaleProjectKanbanController = ProjectKanbanController.include({ + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + _showCreateSOButton: async function () { + var self = this; + this.activeProjectIds = this.initialState.context.active_ids; + + if (!this.activeProjectIds || this.activeProjectIds.length !== 1) { + this.showCreateSaleOrder = false; + return; + } + var canCreateSO = await session.user_has_group('sales_team.group_sale_salesman'); + if (canCreateSO) { + await this._rpc({ + model: 'project.project', + method: 'search_count', + args: [[ + ["id", "in", this.activeProjectIds], + ["bill_type", "=", "customer_project"], + ["sale_order_id", "=", false], + ["allow_billable", "=", true], + ["allow_timesheets", "=", true], + ]], + }).then(function (projectCount) { + self.showCreateSaleOrder = projectCount !== 0; + }); + } else { + this.showCreateSaleOrder = false; + } + }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * @private + * @param {MouseEvent} ev + */ + _onCreateSaleOrder: function (ev) { + ev.preventDefault(); + this.do_action('sale_timesheet.project_project_action_multi_create_sale_order', { + additional_context: { + 'active_id': this.activeProjectIds && this.activeProjectIds[0], + 'active_model': "project.project", + }, + on_close: async () => await this.reload() + }); + }, +}); + +return SaleProjectKanbanController; + +}); diff --git a/addons/sale_timesheet/static/src/scss/sale_timesheet.scss b/addons/sale_timesheet/static/src/scss/sale_timesheet.scss new file mode 100644 index 00000000..c23f7459 --- /dev/null +++ b/addons/sale_timesheet/static/src/scss/sale_timesheet.scss @@ -0,0 +1,165 @@ +$canceled-color: gray; + + +.o_timesheet_plan_sale_timesheet { + + .o_title { + margin-top: 30px; + margin-bottom: 30px; + } + + [type='action'] { + color: $o-brand-primary; + cursor: pointer; + } + + .o_timesheet_plan_stat_buttons { + text-align: right; + float: none; + width: auto; + } + + .o_profitability_wrapper { + display: flex; + flex: 1; + flex-wrap: wrap; + + .o_profitability_section { + display: flex; + flex: 1; + justify-content: flex-start; + } + + } + + .o_timesheet_plan_sale_timesheet_dashboard { + + .table { + margin-top: 15px; + a { + cursor: pointer; + } + } + .table > thead > tr > th, .table > thead > tr > td, + .table > tbody > tr > th, .table > tbody > tr > td { + border: none; + } + .table > tbody > tr > td.o_timesheet_plan_dashboard_cell { + text-align: right; + } + .table > tbody > tr > td.o_timesheet_plan_dashboard_total { + border-top: 1px solid; + text-align: right; + } + + .section { + + } + + } + + .o_timesheet_plan_sale_timesheet_people_time { + + .o_progress_billable_time { + background-color: #f0ad4e; + color: white; + cursor: pointer; + } + .o_progress_billable_fixed { + background-color: #5bc0de; + color: white; + cursor: pointer; + } + .o_progress_non_billable_project { + background-color: theme-color('primary'); + color: white; + cursor: pointer; + } + .o_progress_non_billable_timesheet { + background-color: rgb(11, 194, 1); + color: white; + cursor: pointer; + } + .o_progress_non_billable { + background-color: purple; + color: white; + cursor: pointer; + } + .o_progress_canceled { + background-color: $canceled-color; + color: white; + cursor: pointer; + } + .progress { + border-radius: 3px; + } + + .o_timesheet_plan_badge { + margin-bottom: 10px; + > .badge { + border: none; + font-size: unset; + a { + color: white; + } + } + } + + .table > thead > tr > td, + .table > tbody > tr > th, .table > tbody > tr > td { + border: none; + padding: 0px; + } + + .table > thead > tr > th { + border: none; + padding-left: 0px;; + } + } + + .o_project_plan_project_timesheet_forecast { + + margin-top: 50px; + + th{ + text-align: center; + vertical-align: top; + } + th.o_right_bordered, td.o_right_bordered { + border-right: 2px solid $o-brand-primary; + text-align: center; + } + + .o_timesheet_forecast_sale_order{ + font-weight: bold; + & > td:first-child { + color: $o-brand-primary; + } + } + .o_timesheet_forecast_sale_order_line{ + td:first-child { + padding-left: 15px; + } + td:first-child > a { + margin-left: 15px; + cursor: pointer; + } + } + .o_timesheet_forecast_hr_employee{ + td:first-child { + padding-left: 30px; + } + } + + .o_timesheet_plan_redirect { + cursor: pointer; + } + + .o_canceled_tag { + background-color: $canceled-color; + color: white; + border: 0px; + } + } + +} diff --git a/addons/sale_timesheet/static/src/scss/sale_timesheet_portal.scss b/addons/sale_timesheet/static/src/scss/sale_timesheet_portal.scss new file mode 100644 index 00000000..4898a5b8 --- /dev/null +++ b/addons/sale_timesheet/static/src/scss/sale_timesheet_portal.scss @@ -0,0 +1,15 @@ +.o_timesheet_accordion { + .card-header { + a { + text-decoration: none; + &:after { + content: "\f0d7"; + font-family: 'FontAwesome'; + } + &.collapsed:after { + content: "\f0da"; + font-family: 'FontAwesome'; + } + } + } +} diff --git a/addons/sale_timesheet/static/src/xml/sale_project_templates.xml b/addons/sale_timesheet/static/src/xml/sale_project_templates.xml new file mode 100644 index 00000000..0801ecf2 --- /dev/null +++ b/addons/sale_timesheet/static/src/xml/sale_project_templates.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates xml:space="preserve"> + + <button t-name="SaleProjectKanbanView.buttons" type="button" class="btn btn-secondary o_create_sale_order"> + Create Sales Order + </button> + +</templates> |
