[MIG]mail_activity_done: Migration to 14.0

This commit is contained in:
manu 2021-08-13 12:53:43 +02:00 committed by Bernat Puig Font
parent 88e375f09a
commit add4366818
14 changed files with 295 additions and 103 deletions

View File

@ -856,4 +856,4 @@ Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <http://www.gnu.org/philosophy/why-not-lgpl.html>.
************************************************************************** **************************************************************************

View File

@ -14,13 +14,13 @@ Mail Activity Done
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github .. |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 :target: https://github.com/OCA/social/tree/14.0/mail_activity_done
:alt: OCA/social :alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |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 :target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_activity_done
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/12.0 :target: https://runbot.odoo-community.org/runbot/205/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -41,7 +41,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_done%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_done%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -51,12 +51,15 @@ Credits
Authors Authors
~~~~~~~ ~~~~~~~
* Eficent * ForgeFlow
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Jordi Ballester <jordi.ballester@eficent.com> (www.eficent.com) * Jordi Ballester <jordi.ballester@forgeflow.com> (www.forgeflow.com)
* Eduardo Magdalena <emagdalena@c2i.es> (C2i Change 2 improve http://www.c2i.es)
* Radovan Skolnik <radovan@skolnik.info> (https://www.kema.sk)
* Manuel Regidor <manuel.regidor@sygel.es> (https://www.sygel.es)
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -71,6 +74,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mail_activity_done>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mail_activity_done>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -1,18 +1,14 @@
# Copyright 2018 Eficent <http://www.eficent.com> # Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{ {
"name": "Mail Activity Done", "name": "Mail Activity Done",
"version": "12.0.2.0.0", "version": "14.0.1.0.1",
"author": "Eficent," "Odoo Community Association (OCA)", "author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "LGPL-3", "license": "LGPL-3",
"category": "Discuss", "category": "Discuss",
"depends": [ "website": "https://github.com/OCA/social",
"mail", "depends": ["mail"],
], "data": ["views/templates.xml", "views/mail_activity_views.xml"],
"data": [
"views/templates.xml",
"views/mail_activity_views.xml",
],
"pre_init_hook": "pre_init_hook", "pre_init_hook": "pre_init_hook",
"post_load": "post_load_hook", "post_load": "post_load_hook",
"uninstall_hook": "uninstall_hook", "uninstall_hook": "uninstall_hook",

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L. # Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
# Copyright 2018 Odoo, S.A. # Copyright 2018 Odoo, S.A.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields from odoo import fields
@ -32,30 +32,70 @@ def pre_init_hook(cr):
def post_load_hook(): def post_load_hook():
def new_action_feedback(self, feedback=False): def _new_action_done(self, feedback=False, attachment_ids=None):
"""Overwritten method"""
if "done" not in self._fields: if "done" not in self._fields:
return self.action_feedback_original(feedback=feedback) return self._action_done_original(
message = self.env["mail.message"] feedback=feedback, attachment_ids=attachment_ids
if feedback: )
self.write(dict(feedback=feedback)) # marking as 'done'
messages = self.env["mail.message"]
next_activities_values = []
for activity in self: for activity in self:
# extract value to generate next activities
if activity.force_next:
# context key is required in the onchange to set deadline
Activity = self.env["mail.activity"].with_context(
activity_previous_deadline=activity.date_deadline
)
vals = Activity.default_get(Activity.fields_get())
vals.update(
{
"previous_activity_type_id": activity.activity_type_id.id,
"res_id": activity.res_id,
"res_model": activity.res_model,
"res_model_id": self.env["ir.model"]
._get(activity.res_model)
.id,
}
)
virtual_activity = Activity.new(vals)
virtual_activity._onchange_previous_activity_type_id()
virtual_activity._onchange_activity_type_id()
next_activities_values.append(
virtual_activity._convert_to_write(virtual_activity._cache)
)
# post message on activity, before deleting it
record = self.env[activity.res_model].browse(activity.res_id) record = self.env[activity.res_model].browse(activity.res_id)
activity.done = True activity.done = True
activity.active = False activity.active = False
activity.date_done = fields.Date.today() activity.date_done = fields.Date.today()
record.message_post_with_view( record.message_post_with_view(
"mail.message_activity_done", "mail.message_activity_done",
values={"activity": activity}, values={
subtype_id=self.env.ref("mail.mt_activities").id, "activity": activity,
"feedback": feedback,
"display_assignee": activity.user_id != self.env.user,
},
subtype_id=self.env["ir.model.data"].xmlid_to_res_id(
"mail.mt_activities"
),
mail_activity_type_id=activity.activity_type_id.id, mail_activity_type_id=activity.activity_type_id.id,
attachment_ids=[(4, attachment_id) for attachment_id in attachment_ids]
if attachment_ids
else [],
) )
message |= record.message_ids[0] messages |= record.message_ids[0]
return message.ids and message.ids[0] or False
if not hasattr(MailActivity, "action_feedback_original"): next_activities = self.env["mail.activity"].create(next_activities_values)
MailActivity.action_feedback_original = MailActivity.action_feedback
MailActivity.action_feedback = new_action_feedback return messages, next_activities
if not hasattr(MailActivity, "_action_done_original"):
MailActivity._action_done_original = MailActivity._action_done
MailActivity._action_done = _new_action_done
def uninstall_hook(cr, registry): def uninstall_hook(cr, registry):

View File

@ -0,0 +1,109 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_done
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-16 14:36+0000\n"
"Last-Translator: Tamás Dombos <tdombos@gmail.com>\n"
"Language-Team: none\n"
"Language: hu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format
msgid "%d days overdue"
msgstr "%d nap késésben"
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active
msgid "Active"
msgstr "Aktív"
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_event_event__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_event_registration__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
msgid "Activities"
msgstr "Tevékenységek"
#. module: mail_activity_done
#: model:ir.model,name:mail_activity_done.model_mail_activity
msgid "Activity"
msgstr "Tevékenység"
#. module: mail_activity_done
#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin
msgid "Activity Mixin"
msgstr "Tevékenység mixin"
#. module: mail_activity_done
#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search
#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
msgid "Completed Activities"
msgstr "Elkészült tevékenységek"
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done
msgid "Completed Date"
msgstr "Elkészülés dátuma"
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
msgid "Done"
msgstr "Kész"
#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format
msgid "Due in %d days"
msgstr "%d napon belül esedékes"
#. module: mail_activity_done
#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
msgid "Open Activities"
msgstr "Nyitott tevékenységek"
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
msgid "State"
msgstr "Állapot"
#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format
msgid "Today"
msgstr "Ma"
#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format
msgid "Tomorrow"
msgstr "Holnap"
#. module: mail_activity_done
#: model:ir.model,name:mail_activity_done.model_res_users
msgid "Users"
msgstr "Felhasználók"
#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format
msgid "Yesterday"
msgstr "Tegnap"

View File

@ -1,12 +1,12 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * mail_activity_done # * mail_activity_done
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -15,7 +15,7 @@ msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#. openerp-web #. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:31 #: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format #, python-format
msgid "%d days overdue" msgid "%d days overdue"
msgstr "" msgstr ""
@ -26,7 +26,16 @@ msgid "Active"
msgstr "" msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_event_event__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_event_registration__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids #: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids #: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids
#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids #: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids
msgid "Activities" msgid "Activities"
@ -53,34 +62,45 @@ msgstr ""
msgid "Completed Date" msgid "Completed Date"
msgstr "" msgstr ""
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__display_name
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__display_name
#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__display_name
msgid "Display Name"
msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done #: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done
#: selection:mail.activity,state:0 #: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done
msgid "Done" msgid "Done"
msgstr "" msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#. openerp-web #. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:37 #: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format #, python-format
msgid "Due in %d days" msgid "Due in %d days"
msgstr "" msgstr ""
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__id
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__id
#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__id
msgid "ID"
msgstr ""
#. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity____last_update
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin____last_update
#: model:ir.model.fields,field_description:mail_activity_done.field_res_users____last_update
msgid "Last Modified on"
msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail #: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail
msgid "Open Activities" msgid "Open Activities"
msgstr "" 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 #. module: mail_activity_done
#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state #: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state
msgid "State" msgid "State"
@ -88,15 +108,14 @@ msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#. openerp-web #. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:25 #: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#: selection:mail.activity,state:0
#, python-format #, python-format
msgid "Today" msgid "Today"
msgstr "" msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#. openerp-web #. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:35 #: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format #, python-format
msgid "Tomorrow" msgid "Tomorrow"
msgstr "" msgstr ""
@ -108,8 +127,7 @@ msgstr ""
#. module: mail_activity_done #. module: mail_activity_done
#. openerp-web #. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.js:29 #: code:addons/mail_activity_done/static/src/js/mail_activity.js:0
#, python-format #, python-format
msgid "Yesterday" msgid "Yesterday"
msgstr "" msgstr ""

View File

@ -1,14 +0,0 @@
# Copyright 2019 Eficent <http://www.eficent.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
def migrate(cr, version):
if not version:
return
cr.execute(
"""
UPDATE mail_activity SET
active = False
WHERE done=True;
"""
)

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent <http://www.eficent.com> # Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models from odoo import api, fields, models
@ -9,19 +9,57 @@ class MailActivity(models.Model):
active = fields.Boolean(default=True) active = fields.Boolean(default=True)
done = fields.Boolean(default=False) done = fields.Boolean(default=False)
state = fields.Selection(selection_add=[("done", "Done")], compute="_compute_state") state = fields.Selection(
date_done = fields.Date( selection_add=[("done", "Done")],
"Completed Date", compute="_compute_state",
index=True, search="_search_state",
readonly=True,
) )
date_done = fields.Date("Completed Date", index=True, readonly=True)
@api.depends("date_deadline", "done") @api.depends("date_deadline", "done")
def _compute_state(self): def _compute_state(self):
super(MailActivity, self)._compute_state() super()._compute_state()
for record in self.filtered(lambda activity: activity.done): for record in self.filtered(lambda activity: activity.done):
record.state = "done" record.state = "done"
def _search_state(self, operator, operand):
if not operand:
# checking for is (not) set
if operator == "=":
# is not set - never happens actually so we create impossible domain
return [("id", "=", False)]
else:
# is set - always - return empty domain
return []
else:
# checking for value
if operand == "done":
if operator == "=":
return ["&", ("done", operator, True), ("active", "=", False)]
else:
return ["&", ("done", operator, False), ("active", "=", True)]
else:
if operator == "=":
return [
"&",
(
"date_deadline",
{"today": "=", "overdue": "<", "planned": ">"}[operand],
fields.Date.today(),
),
("done", "=", False),
]
else:
return [
"|",
(
"date_deadline",
{"today": "!=", "overdue": ">=", "planned": "<="}[operand],
fields.Date.today(),
),
("done", "=", True),
]
class MailActivityMixin(models.AbstractModel): class MailActivityMixin(models.AbstractModel):

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent <http://www.eficent.com> # Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models, modules from odoo import api, fields, models, modules
@ -26,11 +26,7 @@ class ResUsers(models.Model):
GROUP BY m.id, states, act.res_model; GROUP BY m.id, states, act.res_model;
""" """
self.env.cr.execute( self.env.cr.execute(
query, query, {"today": fields.Date.context_today(self), "user_id": self.env.uid}
{
"today": fields.Date.context_today(self),
"user_id": self.env.uid,
},
) )
activity_data = self.env.cr.dictfetchall() activity_data = self.env.cr.dictfetchall()
model_ids = [a["id"] for a in activity_data] model_ids = [a["id"] for a in activity_data]

View File

@ -1 +1,4 @@
* Jordi Ballester <jordi.ballester@eficent.com> (www.eficent.com) * Jordi Ballester <jordi.ballester@forgeflow.com> (www.forgeflow.com)
* Eduardo Magdalena <emagdalena@c2i.es> (C2i Change 2 improve http://www.c2i.es)
* Radovan Skolnik <radovan@skolnik.info> (https://www.kema.sk)
* Manuel Regidor <manuel.regidor@sygel.es> (https://www.sygel.es)

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_activity_done"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_activity_done"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mail_activity_done"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_activity_done"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module implements the capability to keep activities that have been <p>This module implements the capability to keep activities that have been
completed, for future reporting, by setting them with the boolean Done.</p> completed, for future reporting, by setting them with the boolean Done.</p>
<p>The activities that have been completed will not appear in the chatter.</p> <p>The activities that have been completed will not appear in the chatter.</p>
@ -388,7 +388,7 @@ completed, for future reporting, by setting them with the boolean Done.</p
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_done%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_done%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -396,13 +396,16 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2> <h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Eficent</li> <li>ForgeFlow</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2> <h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Jordi Ballester &lt;<a class="reference external" href="mailto:jordi.ballester&#64;eficent.com">jordi.ballester&#64;eficent.com</a>&gt; (www.eficent.com)</li> <li>Jordi Ballester &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt; (www.forgeflow.com)</li>
<li>Eduardo Magdalena &lt;<a class="reference external" href="mailto:emagdalena&#64;c2i.es">emagdalena&#64;c2i.es</a>&gt; (C2i Change 2 improve <a class="reference external" href="http://www.c2i.es">http://www.c2i.es</a>)</li>
<li>Radovan Skolnik &lt;<a class="reference external" href="mailto:radovan&#64;skolnik.info">radovan&#64;skolnik.info</a>&gt; (<a class="reference external" href="https://www.kema.sk">https://www.kema.sk</a>)</li>
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt; (<a class="reference external" href="https://www.sygel.es">https://www.sygel.es</a>)</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -412,7 +415,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_activity_done">OCA/social</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mail_activity_done">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
// Copyright2018 Eficent <http://www.eficent.com> // Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
// License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). // License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
odoo.define("mail.Activity.done", function (require) { odoo.define("mail.Activity.done", function (require) {
@ -6,7 +6,6 @@ odoo.define("mail.Activity.done", function (require) {
var mailUtils = require("mail.utils"); var mailUtils = require("mail.utils");
var core = require("web.core"); var core = require("web.core");
var utils = require("mail.utils");
var time = require("web.time"); var time = require("web.time");
var mail_activity = require("mail.Activity"); var mail_activity = require("mail.Activity");
@ -20,23 +19,24 @@ odoo.define("mail.Activity.done", function (require) {
_.each(activities, function (activity) { _.each(activities, function (activity) {
var to_display = ""; var to_display = "";
var deadline = moment(activity.date_deadline).startOf("day"); var deadline = moment(activity.date_deadline).startOf("day");
var diff = deadline.diff(today, "days", true); // True means no rounding // On next line, true means no rounding
var diff = deadline.diff(today, "days", true);
if (diff === 0) { if (diff === 0) {
to_display = _t("Today"); to_display = _t("Today");
} else if (diff < 0) { } else if (diff < 0) {
// Overdue // This block is for overdue
// eslint-disable-line no-lonely-if
if (diff === -1) { if (diff === -1) {
to_display = _t("Yesterday"); to_display = _t("Yesterday");
} else { } else {
to_display = _.str.sprintf(_t("%d days overdue"), Math.abs(diff)); to_display = _.str.sprintf(_t("%d days overdue"), Math.abs(diff));
} }
// This block is for due
} else if (diff === 1) {
// eslint-disable-line no-lonely-if
to_display = _t("Tomorrow");
} else { } else {
// Due to_display = _.str.sprintf(_t("Due in %d days"), Math.abs(diff));
if (diff === 1) {
to_display = _t("Tomorrow");
} else {
to_display = _.str.sprintf(_t("Due in %d days"), Math.abs(diff));
}
} }
activity.label_delay = to_display; activity.label_delay = to_display;
}); });
@ -47,7 +47,7 @@ odoo.define("mail.Activity.done", function (require) {
return open_activities; return open_activities;
}; };
var Activity = mail_activity.include({ mail_activity.include({
/** /**
* @override * @override
* @private * @private
@ -59,13 +59,13 @@ odoo.define("mail.Activity.done", function (require) {
mailUtils.inline mailUtils.inline
); );
var is_blank = /^\s*$/.test(note); var is_blank = /^\s*$/.test(note);
if (!is_blank) { if (is_blank) {
activity.note = "";
} else {
activity.note = mailUtils.parseAndTransform( activity.note = mailUtils.parseAndTransform(
activity.note, activity.note,
mailUtils.addLink mailUtils.addLink
); );
} else {
activity.note = "";
} }
}); });
var activities = setDelayLabel(this._activities); var activities = setDelayLabel(this._activities);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<!-- <!--
Copyright 2018 Eficent <https://www.eficent.com> Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<record id="mail_activity_view_form_popup" model="ir.ui.view"> <record id="mail_activity_view_form_popup" model="ir.ui.view">
@ -59,7 +59,7 @@
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="inherit_id" ref="mail.res_partner_view_search_inherit_mail" /> <field name="inherit_id" ref="mail.res_partner_view_search_inherit_mail" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter name="activities_my" position="after"> <filter name="activities_overdue" position="before">
<filter <filter
string="Open Activities" string="Open Activities"
name="activities_open" name="activities_open"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<!-- <!--
Copyright 2018 Eficent <http://www.eficent.com> Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<template <template