diff --git a/project_task_subtask/README.rst b/project_task_subtask/README.rst index dc23d21..4182df7 100644 --- a/project_task_subtask/README.rst +++ b/project_task_subtask/README.rst @@ -17,7 +17,7 @@ Project Task Checklist :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-it--projects--llc%2Fmisc--addons-lightgray.png?logo=github - :target: https://github.com/it-projects-llc/misc-addons/tree/15.0/project_task_subtask + :target: https://github.com/it-projects-llc/misc-addons/tree/17.0/project_task_subtask :alt: it-projects-llc/misc-addons |badge1| |badge2| |badge3| @@ -85,7 +85,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -115,6 +115,6 @@ Contributors Maintainers ----------- -This module is part of the `it-projects-llc/misc-addons `_ project on GitHub. +This module is part of the `it-projects-llc/misc-addons `_ project on GitHub. You are welcome to contribute. diff --git a/project_task_subtask/__manifest__.py b/project_task_subtask/__manifest__.py index 18d9de9..d5f2566 100644 --- a/project_task_subtask/__manifest__.py +++ b/project_task_subtask/__manifest__.py @@ -3,7 +3,7 @@ "summary": """Use checklist to be ensure that all your tasks are performed and to make easy control over them""", # noqa: B950 "category": """Project Management""", "images": ["images/checklist_main.png"], - "version": "15.0.1.0.0", + "version": "17.0.1.0.0", "author": "IT-Projects LLC", "support": "it@it-projects.info", "website": "https://github.com/it-projects-llc/misc-addons", @@ -17,8 +17,6 @@ "assets": { "web.assets_backend": [ "/project_task_subtask/static/src/css/kanban_styles.css", - "/project_task_subtask/static/src/js/one2many_renderer.js", - "/project_task_subtask/static/src/js/tours/tour.js", ], "web.assets_qweb": [ "/project_task_subtask/static/src/xml/templates.xml", diff --git a/project_task_subtask/pyproject.toml b/project_task_subtask/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/project_task_subtask/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/project_task_subtask/static/src/js/one2many_renderer.js b/project_task_subtask/static/src/js/one2many_renderer.js deleted file mode 100644 index ce12f02..0000000 --- a/project_task_subtask/static/src/js/one2many_renderer.js +++ /dev/null @@ -1,219 +0,0 @@ -odoo.define("project_task_subtask.one2many_renderer", function (require) { - "use strict"; - var FieldOne2Many = require("web.relational_fields").FieldOne2Many; - var BasicModel = require("web.BasicModel"); - - var core = require("web.core"); - var QWeb = core.qweb; - - FieldOne2Many.include({ - check_task_tree_mode: function () { - if ( - this.view && - this.view.arch.tag === "tree" && - this.record && - this.record.model === "project.task" && - this.name === "subtask_ids" - ) { - return true; - } - return false; - }, - - sort_data: function () { - var user_id = this.record.context.uid; - - var new_rows = _.filter(this.value.data, function (d) { - return !d.res_id; - }); - var data = _.difference(this.value.data, new_rows); - - _.each(data, function (d) { - d.u_name = d.data.user_id.data.display_name; - }); - - var name_index = _.sortBy( - _.uniq( - _.map(data, function (d) { - return d.data.user_id.data.display_name; - }) - ) - ); - - data = _.sortBy(data, "u_name"); - _.each(data, function (d) { - d.deadline = d.data.deadline; - if (d.data.user_id.data.id === user_id) { - d.index = 0; - } else { - d.index = - (_.indexOf(name_index, d.data.user_id.data.display_name) + 1) * - 1000000; - } - }); - - data = _.sortBy(data, "deadline"); - _.each(data, function (d) { - d.index += _.indexOf(data, d); - if (!d.deadline) { - d.index += 90000; - } - if (d.data.state === "todo") { - // Continue - } else if (d.data.state === "waiting") { - d.index += 100000; - } else if (d.data.state === "done") { - d.index += 400000; - } else { - // Makes cancelled subtasks stay last in line - d.index += (name_index.length + 2) * 1000000; - if (d.data.user_id.data.id !== user_id) { - d.index += - (_.indexOf(name_index, d.data.user_id.data.display_name) + - 1) * - 1000000; - } - } - }); - data = _.sortBy(data, "index"); - _.each(new_rows, function (r) { - data.push(r); - }); - this.default_sorting = this.value.data; - this.value.data = data; - }, - - _render: function () { - if (this.check_task_tree_mode() && this.getParent().list_is_sorted) { - this.sort_data(); - } - return this._super(arguments); - }, - - reset: function (record, ev, fieldChanged) { - var self = this; - return this._super.apply(this, arguments).then(function (res) { - if (self.check_task_tree_mode() && self.getParent().list_is_sorted) { - self._render(); - } - }); - }, - - _renderButtons: function () { - var self = this; - if (this.check_task_tree_mode()) { - this.$buttons = $( - QWeb.render("SubtaskSortButtons", { - check_button: this.getParent().list_is_sorted, - }) - ); - this.$buttons.on( - "click", - ".o_pager_sort", - this._update_custom_sort_buttons.bind(this) - ); - this.$buttons.on( - "click", - ".o_pager_unsort", - this._update_custom_unsort_buttons.bind(this) - ); - } - return this._super(arguments); - }, - - _update_custom_sort_buttons: function () { - this.getParent().list_is_sorted = true; - this.default_sorting = this.value.data; - this._render(); - }, - - _update_custom_unsort_buttons: function () { - this.getParent().list_is_sorted = false; - this.value.data = this.default_sorting; - this._render(); - }, - }); - - BasicModel.include({ - _sortList: function (list) { - // Taken from odoo - if (!list.static) { - // Only sort x2many lists - return; - } - var self = this; - // ----- - - if (list.model === "project.task.subtask" && list.orderedResIDs) { - var rows = []; - var new_rows = []; - _.each(list.data, function (d) { - var r = self.localData[d]; - if (Number(r.res_id) === r.res_id) { - rows.push(r); - } else { - new_rows.push(r); - } - }); - rows = this.sort_data(rows, list.context.uid, this); - _.each(new_rows, function (r) { - rows.push(r); - }); - list.orderedResIDs = _.pluck(rows, "res_id"); - return this._setDataInRange(list); - } - - return this._super(list); - }, - - sort_data: function (data, user_id, parent) { - user_id = user_id || 1; - - _.each(data, function (d) { - d.u_name = parent.localData[d.data.user_id].data.display_name; - }); - - var name_index = _.sortBy( - _.uniq( - _.map(data, function (d) { - return parent.localData[d.data.user_id].data.display_name; - }) - ) - ); - - data = _.sortBy(data, "u_name"); - _.each(data, function (d) { - d.deadline = d.data.deadline; - if (parent.localData[d.data.user_id].data.id === user_id) { - d.index = 0; - } else { - d.index = - (_.indexOf( - name_index, - parent.localData[d.data.user_id].data.display_name - ) + - 1) * - 1000000; - } - }); - - data = _.sortBy(data, "deadline"); - _.each(data, function (d) { - d.index += _.indexOf(data, d); - if (!d.deadline) { - d.index += 90000; - } - if (d.data.state === "todo") { - // Continue - } else if (d.data.state === "waiting") { - d.index += 100000; - } else if (d.data.state === "done") { - d.index += 400000; - } else { - d.index += 700000; - } - }); - return _.sortBy(data, "index"); - }, - }); -}); diff --git a/project_task_subtask/static/src/js/tours/tour.js b/project_task_subtask/static/src/js/tours/tour.js deleted file mode 100644 index c898566..0000000 --- a/project_task_subtask/static/src/js/tours/tour.js +++ /dev/null @@ -1,60 +0,0 @@ -odoo.define("project_task_subtask.tour", function (require) { - "use strict"; - - var core = require("web.core"); - var tour = require("web_tour.tour"); - - var _t = core._t; - - var steps = [ - tour.stepUtils.showAppsMenuItem(), - { - trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', - content: _t( - "Want a better way to manage your projects? It starts here." - ), - position: "right", - edition: "community", - }, - { - trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', - content: _t( - "Want a better way to manage your projects? It starts here." - ), - position: "bottom", - edition: "enterprise", - }, - { - trigger: ".o_project_kanban_main", - content: "open project", - timeout: 10000, - }, - { - trigger: ".o_loading", - content: "waiting for loading to finish", - timeout: 5000, - }, - { - trigger: ".o_content", - content: "just click", - timeout: 1000, - }, - { - trigger: ".o_kanban_project_tasks .oe_kanban_content", - content: "open task", - timeout: 20000, - }, - { - trigger: ".o_pager_sort", - content: "sort", - timeout: 10000, - }, - { - trigger: ".o_pager_unsort", - content: "unsort", - timeout: 10000, - }, - ]; - - tour.register("task_subtask", {url: "/web"}, steps); -}); diff --git a/project_task_subtask/static/src/xml/templates.xml b/project_task_subtask/static/src/xml/templates.xml deleted file mode 100644 index 7a61354..0000000 --- a/project_task_subtask/static/src/xml/templates.xml +++ /dev/null @@ -1,23 +0,0 @@ - - diff --git a/project_task_subtask/tests/__init__.py b/project_task_subtask/tests/__init__.py deleted file mode 100644 index 027ead8..0000000 --- a/project_task_subtask/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# License MIT (https://opensource.org/licenses/MIT). - -from . import test_subtask_sort_button diff --git a/project_task_subtask/tests/test_subtask_sort_button.py b/project_task_subtask/tests/test_subtask_sort_button.py deleted file mode 100644 index 4bfbc6f..0000000 --- a/project_task_subtask/tests/test_subtask_sort_button.py +++ /dev/null @@ -1,9 +0,0 @@ -import odoo.tests - - -class TestUi(odoo.tests.HttpCase): - def test_01_subtask_sort_button(self): - self.env["ir.module.module"].search( - [("name", "=", "project_task_subtask")], limit=1 - ).state = "installed" - self.start_tour("/web", "task_subtask", login="admin")