From d698bba14ab3a3dad9fe534bd2a2b66a625ad5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?= Date: Mon, 14 Jan 2019 09:04:02 +0100 Subject: [PATCH] [MIG] Migrate module mail_activity_done to v12 --- mail_activity_done/README.rst | 76 ++++ mail_activity_done/__manifest__.py | 2 +- .../i18n/mail_activity_done.pot | 97 ++++ mail_activity_done/readme/USAGE.rst | 0 .../static/description/index.html | 421 ++++++++++++++++++ .../static/src/js/mail_activity.js | 23 +- .../tests/test_mail_activity_done.py | 6 +- 7 files changed, 616 insertions(+), 9 deletions(-) create mode 100644 mail_activity_done/README.rst create mode 100644 mail_activity_done/i18n/mail_activity_done.pot create mode 100644 mail_activity_done/readme/USAGE.rst create mode 100644 mail_activity_done/static/description/index.html diff --git a/mail_activity_done/README.rst b/mail_activity_done/README.rst new file mode 100644 index 0000000..390a0dc --- /dev/null +++ b/mail_activity_done/README.rst @@ -0,0 +1,76 @@ +================== +Mail Activity Done +================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/12.0/mail_activity_done + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_activity_done + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module implements the capability to keep activities that have been +completed, for future reporting, by setting them with the boolean 'Done'. + +The activities that have been completed will not appear in the chatter. + +**Table of contents** + +.. contents:: + :local: + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester (www.eficent.com) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_activity_done/__manifest__.py b/mail_activity_done/__manifest__.py index f7dede3..6affa95 100644 --- a/mail_activity_done/__manifest__.py +++ b/mail_activity_done/__manifest__.py @@ -2,7 +2,7 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). { "name": "Mail Activity Done", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "author": "Eficent," "Odoo Community Association (OCA)", "license": "LGPL-3", diff --git a/mail_activity_done/i18n/mail_activity_done.pot b/mail_activity_done/i18n/mail_activity_done.pot new file mode 100644 index 0000000..5b05019 --- /dev/null +++ b/mail_activity_done/i18n/mail_activity_done.pot @@ -0,0 +1,97 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_done +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_activity_done +#. openerp-web +#: code:addons/mail_activity_done/static/src/js/mail_activity.js:31 +#, python-format +msgid "%d days overdue" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model,name:mail_activity_done.model_mail_activity +msgid "Activity" +msgstr "" + +#. module: mail_activity_done +#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search +msgid "Completed Activities" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done +msgid "Completed Date" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done +#: selection:mail.activity,state:0 +msgid "Done" +msgstr "" + +#. module: mail_activity_done +#. openerp-web +#: code:addons/mail_activity_done/static/src/js/mail_activity.js:37 +#, python-format +msgid "Due in %d days" +msgstr "" + +#. module: mail_activity_done +#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search +msgid "Open Activities" +msgstr "" + +#. module: mail_activity_done +#: selection:mail.activity,state:0 +msgid "Overdue" +msgstr "" + +#. module: mail_activity_done +#: selection:mail.activity,state:0 +msgid "Planned" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state +msgid "State" +msgstr "" + +#. module: mail_activity_done +#. openerp-web +#: code:addons/mail_activity_done/static/src/js/mail_activity.js:25 +#: selection:mail.activity,state:0 +#, python-format +msgid "Today" +msgstr "" + +#. module: mail_activity_done +#. openerp-web +#: code:addons/mail_activity_done/static/src/js/mail_activity.js:35 +#, python-format +msgid "Tomorrow" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model,name:mail_activity_done.model_res_users +msgid "Users" +msgstr "" + +#. module: mail_activity_done +#. openerp-web +#: code:addons/mail_activity_done/static/src/js/mail_activity.js:29 +#, python-format +msgid "Yesterday" +msgstr "" + diff --git a/mail_activity_done/readme/USAGE.rst b/mail_activity_done/readme/USAGE.rst new file mode 100644 index 0000000..e69de29 diff --git a/mail_activity_done/static/description/index.html b/mail_activity_done/static/description/index.html new file mode 100644 index 0000000..3687de9 --- /dev/null +++ b/mail_activity_done/static/description/index.html @@ -0,0 +1,421 @@ + + + + + + +Mail Activity Done + + + +
+

Mail Activity Done

+ + +

Beta License: LGPL-3 OCA/social Translate me on Weblate Try me on Runbot

+

This module implements the capability to keep activities that have been +completed, for future reporting, by setting them with the boolean ‘Done’.

+

The activities that have been completed will not appear in the chatter.

+

Table of contents

+ +
+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_activity_done/static/src/js/mail_activity.js b/mail_activity_done/static/src/js/mail_activity.js index 0d711b0..cd45dfd 100644 --- a/mail_activity_done/static/src/js/mail_activity.js +++ b/mail_activity_done/static/src/js/mail_activity.js @@ -3,6 +3,8 @@ odoo.define('mail.Activity.done', function(require) { "use strict"; + + var mailUtils = require('mail.utils'); var core = require('web.core'); var utils = require('mail.utils'); var time = require('web.time'); @@ -46,14 +48,21 @@ odoo.define('mail.Activity.done', function(require) { }; var Activity = mail_activity.include({ - + /** + * @override + * @private + */ _render: function () { - _.each(this.activities, function (activity) { - if (activity.note) { - activity.note = utils.parse_and_transform(activity.note, utils.add_link); + _.each(this._activities, function (activity) { + var note = mailUtils.parseAndTransform(activity.note || '', mailUtils.inline); + var is_blank = (/^\s*$/).test(note); + if (!is_blank) { + activity.note = mailUtils.parseAndTransform(activity.note, mailUtils.addLink); + } else { + activity.note = ''; } }); - var activities = setDelayLabel(this.activities); + var activities = setDelayLabel(this._activities); if (activities.length) { var nbActivities = _.countBy(activities, 'state'); this.$el.html(QWeb.render('mail.activity_items', { @@ -61,8 +70,8 @@ odoo.define('mail.Activity.done', function(require) { nbPlannedActivities: nbActivities.planned, nbTodayActivities: nbActivities.today, nbOverdueActivities: nbActivities.overdue, - date_format: time.getLangDateFormat(), - datetime_format: time.getLangDatetimeFormat(), + dateFormat: time.getLangDateFormat(), + datetimeFormat: time.getLangDatetimeFormat(), })); } else { this.$el.empty(); diff --git a/mail_activity_done/tests/test_mail_activity_done.py b/mail_activity_done/tests/test_mail_activity_done.py index 58f1b62..f0b2b1b 100644 --- a/mail_activity_done/tests/test_mail_activity_done.py +++ b/mail_activity_done/tests/test_mail_activity_done.py @@ -1,6 +1,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase +from datetime import date class TestMailActivityDoneMethods(TransactionCase): @@ -21,6 +22,7 @@ class TestMailActivityDoneMethods(TransactionCase): 'res_id': self.env.ref("base.res_partner_1").id, 'res_model_id': self.env['ir.model']._get('res.partner').id, 'user_id': self.employee.id, + 'date_deadline': date.today(), }) def test_mail_activity_done(self): @@ -28,4 +30,6 @@ class TestMailActivityDoneMethods(TransactionCase): self.assertEquals(self.act1.state, 'done') def test_activity_user_count(self): - self.employee.activity_user_count() + act_count = self.employee.sudo(self.employee).activity_user_count() + self.assertEqual(len(act_count), 1, + "Number of activities should be equal to one")