Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mail_activity_reply_creator: Migration to 18.0 #1565

Open
wants to merge 10 commits into
base: 18.0
Choose a base branch
from
103 changes: 103 additions & 0 deletions mail_activity_reply_creator/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
===========================
Mail Activity Reply Creator
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:25547488c3bf13b185d6f375ac4c18391f030077dda3b30f13d83bb525d2e1ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/18.0/mail_activity_reply_creator
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_activity_reply_creator
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module aims to facilitate back-and-forth activity assignment
between users by automatically selecting activity creator as the
assignee of the followup activity when using button "Done & schedule
next". Use case:

Mitchell Admin assigns activity "to do" to Marc Demo > Marc Demo clicks
"done and schedule next" on the activity > in new activity form,
"assigned to" is set to Mitchell Admin (unless a different default user
is set for the selected activity type).

Furthermore, the module corrects a behavior that can induce user to
assigning a new activity to themselves instead of the previously
selected user. Use case:

Mitchell Admin creates a new activity, selects "Marc Demo" as "assigned
to", but then changes activity type.

In standard behavior "assigned to" is reset to "Mitchell Admin"; with
this module, the user selection is maintained when changing activity
type (unless a different default user is set for the selected activity
type).

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reply_creator%0Aversion:%2018.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
-------

* Ilyas
* Ooops

Contributors
------------

- Ooops404 <https://ooops404.com>

- Ilyas <[email protected]>

- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)

- Bhavesh Heliconia

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/18.0/mail_activity_reply_creator>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mail_activity_reply_creator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions mail_activity_reply_creator/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Ooops404
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Mail Activity Reply Creator",
"summary": "Assign new to its creator",
"version": "18.0.1.0.0",
"category": "Social",
"website": "https://github.com/OCA/social",
"author": "Ilyas, Ooops, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["mail"],
}
31 changes: 31 additions & 0 deletions mail_activity_reply_creator/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_reply_creator
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-04-05 16:31+0000\n"
"Last-Translator: Francesco Foresti <[email protected]>\n"
"Language-Team: none\n"
"Language: it\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.14.1\n"

#. module: mail_activity_reply_creator
#: model:ir.model,name:mail_activity_reply_creator.model_mail_activity
msgid "Activity"
msgstr "Attività"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
19 changes: 19 additions & 0 deletions mail_activity_reply_creator/i18n/mail_activity_reply_creator.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_reply_creator
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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_reply_creator
#: model:ir.model,name:mail_activity_reply_creator.model_mail_activity
msgid "Activity"
msgstr ""
1 change: 1 addition & 0 deletions mail_activity_reply_creator/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mail_activity
43 changes: 43 additions & 0 deletions mail_activity_reply_creator/models/mail_activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2023 Ooops404
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models


class MailActivity(models.Model):
_inherit = "mail.activity"

@api.onchange("activity_type_id")
def _onchange_activity_type_id(self):
original_user_id = self.user_id
res = super()._onchange_activity_type_id()
if (
original_user_id != self.env.user
and not self.activity_type_id.default_user_id
):
# keep already set user
self.user_id = original_user_id

Check warning on line 18 in mail_activity_reply_creator/models/mail_activity.py

View check run for this annotation

Codecov / codecov/patch

mail_activity_reply_creator/models/mail_activity.py#L18

Added line #L18 was not covered by tests
return res

def action_feedback_schedule_next(self, feedback=False):
create_uid = self.create_uid.id
action = super().action_feedback_schedule_next(feedback)
if action:
action["context"]["source_activity_create_uid"] = create_uid
return action

@api.model
def default_get(self, fields):
res = super().default_get(fields)
if self._context.get("source_activity_create_uid") and not self.env.context.get(
"no_recursion"
):
default_activity_type_id = self.with_context(
no_recursion=True
)._default_activity_type()
if (
not default_activity_type_id
or not default_activity_type_id.default_user_id
):
# assign to prev. activity creator
res["user_id"] = self.env.context["source_activity_create_uid"]
return res
3 changes: 3 additions & 0 deletions mail_activity_reply_creator/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions mail_activity_reply_creator/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Ooops404 \<<https://ooops404.com>\>
- Ilyas \<<[email protected]>\>
- [Heliconia Solutions Pvt. Ltd.\](<https://www.heliconia.io>)
- Bhavesh Heliconia
21 changes: 21 additions & 0 deletions mail_activity_reply_creator/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This module aims to facilitate back-and-forth activity assignment
between users by automatically selecting activity creator as the
assignee of the followup activity when using button "Done & schedule
next". Use case:

Mitchell Admin assigns activity "to do" to Marc Demo \> Marc Demo clicks
"done and schedule next" on the activity \> in new activity form,
"assigned to" is set to Mitchell Admin (unless a different default user
is set for the selected activity type).

Furthermore, the module corrects a behavior that can induce user to
assigning a new activity to themselves instead of the previously
selected user. Use case:

Mitchell Admin creates a new activity, selects "Marc Demo" as "assigned
to", but then changes activity type.

In standard behavior "assigned to" is reset to "Mitchell Admin"; with
this module, the user selection is maintained when changing activity
type (unless a different default user is set for the selected activity
type).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading