Skip to content

Commit

Permalink
Merge PR #1168 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by StefanRijnhart
  • Loading branch information
OCA-git-bot committed Sep 27, 2023
2 parents f6a888c + 054c690 commit cd65862
Show file tree
Hide file tree
Showing 20 changed files with 1,263 additions and 0 deletions.
91 changes: 91 additions & 0 deletions mail_activity_done/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
==================
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/15.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-15-0/social-15-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/15.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'.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

#. Access to an activity from the systray activities menu.
#. Once finished, open the activity and mark it as Done.

To check activities:

#. Go to Settings -> Technical -> Activities
#. To see finished activities filter by Completed Activities

Bug Tracker
===========

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.
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:%2015.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.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* Jordi Ballester <[email protected]> (www.forgeflow.com)
* Eduardo Magdalena <[email protected]> (C2i Change 2 improve http://www.c2i.es)
* Radovan Skolnik <[email protected]> (https://www.kema.sk)
* Manuel Regidor <[email protected]> (https://www.sygel.es)
* Bernat Puig <[email protected]> (www.forgeflow.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 <https://github.com/OCA/social/tree/16.0/mail_activity_done>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions mail_activity_done/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_load_hook, pre_init_hook, uninstall_hook
20 changes: 20 additions & 0 deletions mail_activity_done/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2018-22 ForgeFlow <http://www.forgeflow.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Mail Activity Done",
"version": "16.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "LGPL-3",
"category": "Discuss",
"website": "https://github.com/OCA/social",
"depends": ["mail"],
"data": ["views/mail_activity_views.xml"],
"assets": {
"web.assets_backend": [
"mail_activity_done/static/src/js/mail_activity.esm.js",
],
},
"pre_init_hook": "pre_init_hook",
"post_load": "post_load_hook",
"uninstall_hook": "uninstall_hook",
}
94 changes: 94 additions & 0 deletions mail_activity_done/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright 2018-22 ForgeFlow <http://www.forgeflow.com>
# Copyright 2018 Odoo, S.A.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import Command, fields

from odoo.addons.mail.models.mail_activity import MailActivity


def pre_init_hook(cr):
"""The objective of this hook is to default to false all values of field
'done' of mail.activity
"""
cr.execute(
"""SELECT column_name
FROM information_schema.columns
WHERE table_name='mail_activity' AND
column_name='done'"""
)
if not cr.fetchone():
cr.execute(
"""
ALTER TABLE mail_activity ADD COLUMN done boolean;
"""
)

cr.execute(
"""
UPDATE mail_activity
SET done = False
"""
)


def post_load_hook():
def _new_action_done(self, feedback=False, attachment_ids=None):
"""Overwritten method"""
if "done" not in self._fields:
return self._action_done_original(
feedback=feedback, attachment_ids=attachment_ids
)
# marking as 'done'
messages = self.env["mail.message"]
next_activities_values = []
for activity in self:
# extract value to generate next activities
if activity.chaining_type == "trigger":
vals = activity.with_context(
activity_previous_deadline=activity.date_deadline
)._prepare_next_activity_values()
next_activities_values.append(vals)

# post message on activity, before deleting it
record = self.env[activity.res_model].browse(activity.res_id)
activity.done = True
activity.active = False
activity.date_done = fields.Date.today()
record.message_post_with_view(
"mail.message_activity_done",
values={
"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,
attachment_ids=[
Command.link(attachment_id) for attachment_id in attachment_ids
]
if attachment_ids
else [],
)
messages |= record.message_ids[0]

next_activities = self.env["mail.activity"].create(next_activities_values)

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):
"""The objective of this hook is to remove all activities that are done
upon module uninstall
"""
cr.execute(
"""
DELETE FROM mail_activity
WHERE done=True
"""
)
107 changes: 107 additions & 0 deletions mail_activity_done/i18n/hu.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# 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 <[email protected]>\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.esm.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_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.esm.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.esm.js:0
#, python-format
msgid "Today"
msgstr "Ma"

#. module: mail_activity_done
#. openerp-web
#: code:addons/mail_activity_done/static/src/js/mail_activity.esm.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.esm.js:0
#, python-format
msgid "Yesterday"
msgstr "Tegnap"
Loading

0 comments on commit cd65862

Please sign in to comment.