[MIG] mail_activity_reply_creator: Migration to 16.0

pull/1504/head
Alessio Renda 2024-11-20 11:41:16 +01:00
parent c090c9c52d
commit efa3b79e19
6 changed files with 30 additions and 28 deletions

View File

@ -36,17 +36,17 @@ jobs:
matrix: matrix:
include: include:
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest - container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
include: "mail_post_defer" include: "mail_post_defer,mail_activity_reply_creator"
name: test with Odoo name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest - container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
include: "mail_post_defer" include: "mail_post_defer,mail_activity_reply_creator"
name: test with OCB name: test with OCB
makepot: "true" makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest - container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
exclude: "mail_post_defer" exclude: "mail_post_defer,mail_activity_reply_creator"
name: test with Odoo name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest - container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
exclude: "mail_post_defer" exclude: "mail_post_defer,mail_activity_reply_creator"
name: test with OCB name: test with OCB
makepot: "true" makepot: "true"
services: services:

View File

@ -7,7 +7,7 @@ Mail Activity Reply Creator
!! 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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:78f3a5c417c8a61413fe1dc5166433c24a103edf66aafb69a55f567c17577243 !! source digest: sha256:25547488c3bf13b185d6f375ac4c18391f030077dda3b30f13d83bb525d2e1ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@ -17,13 +17,13 @@ Mail Activity Reply Creator
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-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/14.0/mail_activity_reply_creator :target: https://github.com/OCA/social/tree/16.0/mail_activity_reply_creator
: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-14-0/social-14-0-mail_activity_reply_creator :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_reply_creator
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=14.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -58,7 +58,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 to smash it by providing a detailed and welcomed 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:%2014.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_reply_creator%0Aversion:%2016.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.
@ -91,6 +91,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/14.0/mail_activity_reply_creator>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_activity_reply_creator>`_ 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

@ -3,7 +3,7 @@
{ {
"name": "Mail Activity Reply Creator", "name": "Mail Activity Reply Creator",
"summary": "Assign new to its creator", "summary": "Assign new to its creator",
"version": "14.0.1.0.1", "version": "16.0.1.0.0",
"category": "Social", "category": "Social",
"website": "https://github.com/OCA/social", "website": "https://github.com/OCA/social",
"author": "Ilyas, Ooops, Odoo Community Association (OCA)", "author": "Ilyas, Ooops, Odoo Community Association (OCA)",

View File

@ -9,13 +9,14 @@ class MailActivity(models.Model):
@api.onchange("activity_type_id") @api.onchange("activity_type_id")
def _onchange_activity_type_id(self): def _onchange_activity_type_id(self):
original_user_id = self.user_id original_user_id = self.user_id
super()._onchange_activity_type_id() res = super()._onchange_activity_type_id()
if ( if (
original_user_id != self.env.user original_user_id != self.env.user
and not self.activity_type_id.default_user_id and not self.activity_type_id.default_user_id
): ):
# keep already set user # keep already set user
self.user_id = original_user_id self.user_id = original_user_id
return res
def action_feedback_schedule_next(self, feedback=False): def action_feedback_schedule_next(self, feedback=False):
create_uid = self.create_uid.id create_uid = self.create_uid.id
@ -32,7 +33,7 @@ class MailActivity(models.Model):
): ):
default_activity_type_id = self.with_context( default_activity_type_id = self.with_context(
no_recursion=True no_recursion=True
)._default_activity_type_id() )._default_activity_type()
if ( if (
not default_activity_type_id not default_activity_type_id
or not default_activity_type_id.default_user_id or not default_activity_type_id.default_user_id

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
@ -9,10 +8,11 @@
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ :Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ; margin-left: 2em ;
margin-right: 2em } margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */ pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee } pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 } pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@ -301,7 +301,7 @@ span.option {
span.pre { span.pre {
white-space: pre } white-space: pre }
span.problematic { span.problematic, pre.problematic {
color: red } color: red }
span.section-subtitle { span.section-subtitle {
@ -367,9 +367,9 @@ 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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:78f3a5c417c8a61413fe1dc5166433c24a103edf66aafb69a55f567c17577243 !! source digest: sha256:25547488c3bf13b185d6f375ac4c18391f030077dda3b30f13d83bb525d2e1ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/14.0/mail_activity_reply_creator"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_activity_reply_creator"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mail_activity_reply_creator"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_reply_creator"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module aims to facilitate back-and-forth activity assignment between users by <p>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 automatically selecting activity creator as the assignee of the followup activity when
using button “Done &amp; schedule next”. Use case:</p> using button “Done &amp; schedule next”. Use case:</p>
@ -401,7 +401,7 @@ a different default user is set for the selected activity type).</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 to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reply_creator%0Aversion:%2014.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_reply_creator%0Aversion:%2016.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">
@ -425,11 +425,13 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2> <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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/14.0/mail_activity_reply_creator">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/16.0/mail_activity_reply_creator">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,9 +1,9 @@
# Copyright 2023 Ooops404 # Copyright 2023 Ooops404
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import SavepointCase from odoo.tests.common import TransactionCase
class TestMailActivityReplyCreator(SavepointCase): class TestMailActivityReplyCreator(TransactionCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@ -18,16 +18,15 @@ class TestMailActivityReplyCreator(SavepointCase):
cls.activity_type_1 = activity_type_model.create( cls.activity_type_1 = activity_type_model.create(
{ {
"name": "Act Type Without Default Responsible", "name": "Act Type Without Default Responsible",
"res_model_id": cls.partner_ir_model.id, "res_model": cls.partner_ir_model.model,
"default_user_id": False, "default_user_id": False,
} }
) )
cls.activity_type_2 = activity_type_model.create( cls.activity_type_2 = activity_type_model.create(
{ {
"name": "Act Type 2", "name": "Act Type 2",
"res_model_id": cls.partner_ir_model.id, "res_model": cls.partner_ir_model.model,
"default_user_id": False, "default_user_id": False,
"default_next_type_id": cls.activity_type_1.id,
} }
) )
cls.act1 = ( cls.act1 = (
@ -66,7 +65,7 @@ class TestMailActivityReplyCreator(SavepointCase):
def test_schedule_new_activity_user(self): def test_schedule_new_activity_user(self):
prev_act_uid = self.act1.create_uid prev_act_uid = self.act1.create_uid
action = self.act1.action_feedback_schedule_next() action = self.act1.action_feedback_schedule_next()
new_act = self.env["mail.activity"].with_context(action["context"]).create({}) new_act = self.env["mail.activity"].with_context(**action["context"]).create({})
# by default current user will be responsible. # by default current user will be responsible.
# module set responsible as prev. activity creator. # module set responsible as prev. activity creator.
self.assertEqual(new_act.user_id, prev_act_uid) self.assertEqual(new_act.user_id, prev_act_uid)