From 1361d0720e05410308b2863fc98a3a3cee5f4d84 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 25 Jan 2021 12:24:12 +0100 Subject: [PATCH 1/6] [FIX] web: customization of text in button for kanban example never used Before this commit, the customization of text in button to apply kanban example is never used because the variable which contains the text is missspelled and thus is always undefined. That's why, we always have the default text in this button. This commit changes the `options.applyExampleText` to `options.applyExamplesText` to get the text customization in project module for instance and adds a test in order to check that the text is well rendered. Co-authored-by: Laurent Stukkens (LTU) task-2440564 Closes #65095 --- .../kanban/kanban_column_quick_create.js | 2 +- addons/web/static/tests/views/kanban_tests.js | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js index c4bed5faa05..928f80ab60f 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js @@ -32,7 +32,7 @@ var ColumnQuickCreate = Widget.extend({ */ init: function (parent, options) { this._super.apply(this, arguments); - this.applyExamplesText = options.applyExampleText || _t("Use This For My Kanban"); + this.applyExamplesText = options.applyExamplesText || _t("Use This For My Kanban"); this.examples = options.examples; this.folded = true; this.isMobile = false; diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index 0450876be78..f3de29c8b42 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -3801,6 +3801,47 @@ QUnit.module('Views', { kanban.destroy(); }); + QUnit.test("quick create column's apply button's display text", async function (assert) { + assert.expect(1); + + const applyExamplesText = 'Use This For My Test'; + kanbanExamplesRegistry.add('test', { + applyExamplesText: applyExamplesText, + examples:[{ + name: "A first example", + columns: ["Column 1", "Column 2", "Column 3"], + description: "Some description", + }, { + name: "A second example", + columns: ["Col 1", "Col 2"], + }], + }); + + var kanban = await createView({ + View: KanbanView, + model: 'partner', + data: this.data, + arch: '' + + '' + + '' + + '
' + + '
' + + '
', + groupBy: ['product_id'], + }); + + // open the quick create + await testUtils.dom.click(kanban.$('.o_column_quick_create .o_quick_create_folded')); + + // click to see the examples + await testUtils.dom.click(kanban.$('.o_column_quick_create .o_kanban_examples')); + + const $primaryActionButton = $('.modal footer.modal-footer button.btn-primary > span'); + assert.strictEqual($primaryActionButton.text(), applyExamplesText, 'the primary button should display the value of applyExamplesText'); + + kanban.destroy(); + }); + QUnit.test('quick create column and examples background with ghostColumns titles', async function (assert) { assert.expect(4); From 5fb1d3a97eb2eab4652750f87eaf041965f88b63 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 25 Jan 2021 12:35:10 +0100 Subject: [PATCH 2/6] [IMP] project: no open the user form view in project.task Before this commit, the user can click on the user_id field in project.task form view to see the user form view of the user linked in the current task. This commit adds an option (no_open=True) in this field to prevent the user to access the user form view. task-2440564 --- addons/project/views/project_views.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index ea7d69ad89d..09bfe76d64c 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -692,6 +692,8 @@ Date: Mon, 25 Jan 2021 12:55:22 +0100 Subject: [PATCH 3/6] [IMP] project: rename the priority field to Starred in project.task task-2440564 --- addons/project/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 03568f9cbb4..dbefa4a0919 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -571,7 +571,7 @@ class Task(models.Model): priority = fields.Selection([ ('0', 'Normal'), ('1', 'Important'), - ], default='0', index=True, string="Priority") + ], default='0', index=True, string="Starred") sequence = fields.Integer(string='Sequence', index=True, default=10, help="Gives the sequence order when displaying a list of tasks.") stage_id = fields.Many2one('project.task.type', string='Stage', compute='_compute_stage_id', From b6c6105e59d5673e1552b1c0fa40c97574b386ae Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 26 Jan 2021 11:16:51 +0100 Subject: [PATCH 4/6] [IMP] project: hide Share button in project form view if not manager Before this commit, the user who is not a Project Manager can share the project based on the visibility of the project. This commit hides this button for this user, only the Project Manager can use this button. task-2440564 --- addons/project/views/project_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 09bfe76d64c..5cacb406143 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -248,7 +248,7 @@
-
From 1eec92546c7c8ffadede8d9906a0134094331e82 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 26 Jan 2021 11:18:53 +0100 Subject: [PATCH 5/6] [IMP] sale_project: hide the project overview if not manager Before this commit, the user who is not a Project Manager can access to the project overview. This commit removes this access to give this access only for the Project Manager. task-2440564 --- addons/sale_timesheet/views/project_task_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/views/project_task_views.xml b/addons/sale_timesheet/views/project_task_views.xml index 4e688813fe9..4a44ba1c735 100644 --- a/addons/sale_timesheet/views/project_task_views.xml +++ b/addons/sale_timesheet/views/project_task_views.xml @@ -7,7 +7,7 @@
-
{'always_reload': True} diff --git a/addons/sale_timesheet/views/project_task_views.xml b/addons/sale_timesheet/views/project_task_views.xml index 4a44ba1c735..c11c5e547b7 100644 --- a/addons/sale_timesheet/views/project_task_views.xml +++ b/addons/sale_timesheet/views/project_task_views.xml @@ -12,7 +12,7 @@ type="object" name="action_view_so" icon="fa-dollar" attrs="{'invisible': ['|', '|', ('allow_billable', '=', False), ('sale_order_id', '=', False), ('pricing_type', '=', 'task_rate')]}" string="Sales Order" - groups="sales_team.group_sale_salesman"/> + groups="sales_team.group_sale_salesman_all_leads"/>