Skip to content

Commit

Permalink
[MIG] mail_activity_plan: Migration to 16.0
Browse files Browse the repository at this point in the history
TT48098
  • Loading branch information
victoralmau committed Mar 20, 2024
1 parent 1daa97a commit 0955eb0
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 91 deletions.
12 changes: 6 additions & 6 deletions mail_activity_plan/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Mail activity plan
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ef0f39ca052a255455cd55b617ae72f2cfbc5d5a1810f73dd081c00c61f0bcd8
!! source digest: sha256:72b1f01ff803c46c44584bbf0c9daebdc530d4b095e410d3fa4abef26586e7a7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Mail activity plan
: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/15.0/mail_activity_plan
:target: https://github.com/OCA/social/tree/16.0/mail_activity_plan
: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_plan
:target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_plan
: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=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -60,7 +60,7 @@ 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_plan%0Aversion:%2015.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_plan%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.

Expand Down Expand Up @@ -101,6 +101,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_activity_plan>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_activity_plan>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions mail_activity_plan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Mail activity plan",
"version": "15.0.1.0.1",
"version": "16.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand All @@ -18,7 +18,7 @@
"demo": ["demo/mail_activity_plan_demo.xml"],
"assets": {
"web.assets_backend": [
"mail_activity_plan/static/src/js/mail_activity_plan.js",
"mail_activity_plan/static/src/js/mail_activity_plan.esm.js",
],
},
"maintainers": ["victoralmau"],
Expand Down
9 changes: 5 additions & 4 deletions mail_activity_plan/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?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">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -366,9 +367,9 @@ <h1 class="title">Mail activity plan</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ef0f39ca052a255455cd55b617ae72f2cfbc5d5a1810f73dd081c00c61f0bcd8
!! source digest: sha256:72b1f01ff803c46c44584bbf0c9daebdc530d4b095e410d3fa4abef26586e7a7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/15.0/mail_activity_plan"><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-15-0/social-15-0-mail_activity_plan"><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=15.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_plan"><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_plan"><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 allows to define activity plans linked to any document type that allows to
plan activities, and later launch them from the documents.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -407,7 +408,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<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.
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_plan%0Aversion:%2015.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_plan%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>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -437,7 +438,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_activity_plan">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_plan">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>
</div>
</div>
Expand Down
95 changes: 95 additions & 0 deletions mail_activity_plan/static/src/js/mail_activity_plan.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/** @odoo-module **/

import {FormController} from "@web/views/form/form_controller";
import {ListController} from "@web/views/list/list_controller";
import {onWillStart} from "@odoo/owl";
import {useService} from "@web/core/utils/hooks";
import {_lt} from "@web/core/l10n/translation";
import {patch} from "@web/core/utils/patch";

patch(FormController.prototype, "mail_activity_plan.FormControllerPatch", {
async _actionWizardMailActivityPlan() {
this.actionService.doAction(
"mail_activity_plan.action_wizard_mail_activity_plan",
{
additionalContext: {
default_res_model: this.props.resModel,
active_ids: [this.props.resId],
},
on_close: () => {
this.update({}, {reload: false});
},
}
);
},
setup() {
this._super();
this.actionService = useService("action");
this.orm = useService("orm");
onWillStart(async () => {
await this._showWizardMailActivityPlan();
});
},
async _showWizardMailActivityPlan() {
const planCount = await this.orm.call(
"mail.activity.plan",
"get_total_plans_from_model",
[this.props.resModel]
);
this.showWizardMailActivityPlan = planCount !== 0;
},
getActionMenuItems() {
const actionMenus = this._super();
if (actionMenus && this.showWizardMailActivityPlan) {
actionMenus.other.push({
description: _lt("Launch Activity Plan"),
callback: () => this._actionWizardMailActivityPlan(),
});
}
return actionMenus;
},
});

patch(ListController.prototype, "mail_activity_plan", {
async _actionWizardMailActivityPlan() {
const resIds = await this.getSelectedResIds();
this.actionService.doAction(
"mail_activity_plan.action_wizard_mail_activity_plan",
{
additionalContext: {
default_res_model: this.props.resModel,
active_ids: resIds,
},
on_close: () => {
this.update({}, {reload: false});
},
}
);
},
setup() {
this._super();
this.actionService = useService("action");
this.orm = useService("orm");
onWillStart(async () => {
await this._showWizardMailActivityPlan();
});
},
async _showWizardMailActivityPlan() {
const planCount = await this.orm.call(
"mail.activity.plan",
"get_total_plans_from_model",
[this.props.resModel]
);
this.showWizardMailActivityPlan = planCount !== 0;
},
getActionMenuItems() {
const actionMenus = this._super();
if (actionMenus && this.showWizardMailActivityPlan) {
actionMenus.other.push({
description: _lt("Launch Activity Plan"),
callback: () => this._actionWizardMailActivityPlan(),
});
}
return actionMenus;
},
});
67 changes: 0 additions & 67 deletions mail_activity_plan/static/src/js/mail_activity_plan.js

This file was deleted.

16 changes: 4 additions & 12 deletions mail_activity_plan/tests/test_mail_activity_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.exceptions import UserError
from odoo.tests import Form, common, new_test_user
from odoo.tests import Form, new_test_user
from odoo.tests.common import users

from odoo.addons.base.tests.common import BaseCommon

class TestMailActivityPlan(common.TransactionCase):

class TestMailActivityPlan(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.user_plan = new_test_user(
cls.env,
login="test_user_plan",
Expand Down

0 comments on commit 0955eb0

Please sign in to comment.