From cb34cbfbfbf62978c26d441046b6eee7e1c6bfff 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 +- mail_activity_done/readme/USAGE.rst | 0 .../static/description/index.html | 399 ++++++++++++++++++ .../static/src/js/mail_activity.js | 23 +- .../tests/test_mail_activity_done.py | 6 +- 6 files changed, 497 insertions(+), 9 deletions(-) create mode 100644 mail_activity_done/README.rst 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 00000000..390a0dc6 --- /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 f7dede38..6affa954 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/readme/USAGE.rst b/mail_activity_done/readme/USAGE.rst new file mode 100644 index 00000000..e69de29b diff --git a/mail_activity_done/static/description/index.html b/mail_activity_done/static/description/index.html new file mode 100644 index 00000000..050e7768 --- /dev/null +++ b/mail_activity_done/static/description/index.html @@ -0,0 +1,399 @@ + + + + + + +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 0d711b00..cd45dfd5 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 58f1b620..f0b2b1b0 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")