mirror of https://github.com/OCA/social.git
parent
1daa97a94e
commit
2689e1d334
|
@ -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
|
||||
|
@ -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|
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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.
|
||||
|
|
|
@ -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)",
|
||||
|
@ -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"],
|
||||
|
|
|
@ -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>
|
||||
|
@ -366,9 +367,9 @@ ul.auto-toc {
|
|||
!! 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&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&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>
|
||||
|
@ -407,7 +408,7 @@ linked to a model (Contact for example).</p>
|
|||
<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">
|
||||
|
@ -437,7 +438,7 @@ mission is to support the collaborative development of Odoo features and
|
|||
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>
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
});
|
|
@ -1,67 +0,0 @@
|
|||
odoo.define("mail_activity_plan.mail_activity_plan", function (require) {
|
||||
"use strict";
|
||||
|
||||
const ListController = require("web.ListController");
|
||||
const FormController = require("web.FormController");
|
||||
var core = require("web.core");
|
||||
var _t = core._t;
|
||||
|
||||
const MailActivityPlanExtension = {
|
||||
_showWizardMailActivityPlan: function () {
|
||||
return this._rpc({
|
||||
model: "mail.activity.plan",
|
||||
method: "get_total_plans_from_model",
|
||||
args: [this.modelName],
|
||||
}).then((planCount) => {
|
||||
this.showWizardMailActivityPlan = planCount !== 0;
|
||||
});
|
||||
},
|
||||
willStart: function () {
|
||||
return Promise.all([
|
||||
this._super.apply(this, arguments),
|
||||
this._showWizardMailActivityPlan(),
|
||||
]);
|
||||
},
|
||||
_getActionMenuItems: function () {
|
||||
var menuItems = this._super.apply(this, arguments);
|
||||
if (menuItems && this.showWizardMailActivityPlan) {
|
||||
menuItems.items.other.push({
|
||||
description: _t("Launch Activity Plan"),
|
||||
callback: () => this._actionWizardMailActivityPlan(),
|
||||
});
|
||||
}
|
||||
return menuItems;
|
||||
},
|
||||
};
|
||||
ListController.include(MailActivityPlanExtension);
|
||||
FormController.include(MailActivityPlanExtension);
|
||||
|
||||
ListController.include({
|
||||
async _actionWizardMailActivityPlan() {
|
||||
const state = this.model.get(this.handle);
|
||||
const resIds = await this.getSelectedIdsWithDomain();
|
||||
this.do_action("mail_activity_plan.action_wizard_mail_activity_plan", {
|
||||
additional_context: {
|
||||
default_res_model: state.model,
|
||||
active_ids: resIds,
|
||||
},
|
||||
on_close: () => {
|
||||
this.update({}, {reload: false});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
FormController.include({
|
||||
async _actionWizardMailActivityPlan() {
|
||||
this.do_action("mail_activity_plan.action_wizard_mail_activity_plan", {
|
||||
additional_context: {
|
||||
default_res_model: this.modelName,
|
||||
active_ids: this.model.localIdsToResIds([this.handle]),
|
||||
},
|
||||
on_close: () => {
|
||||
this.update({}, {reload: false});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -94,14 +94,19 @@
|
|||
<field name="group_ids" widget="many2many_tags" />
|
||||
</group>
|
||||
</group>
|
||||
<group name="activities_group" string="Activities">
|
||||
<field
|
||||
name="plan_activity_type_ids"
|
||||
nolabel="1"
|
||||
context="{'tree_view_ref': 'mail_activity_plan.view_mail_activity_plan_activity_type_tree', 'form_view_ref':'mail_activity_plan.view_mail_activity_plan_activity_type_form', 'default_model': model}"
|
||||
<notebook>
|
||||
<page
|
||||
name="activities_group"
|
||||
string="Activities"
|
||||
attrs="{'invisible': [('model_id', '=', False)]}"
|
||||
/>
|
||||
</group>
|
||||
>
|
||||
<field
|
||||
name="plan_activity_type_ids"
|
||||
nolabel="1"
|
||||
context="{'tree_view_ref': 'mail_activity_plan.view_mail_activity_plan_activity_type_tree', 'form_view_ref':'mail_activity_plan.view_mail_activity_plan_activity_type_form', 'default_model': model}"
|
||||
/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue