mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-21 17:02:02 +02:00
Initial commit: Mail packages
This commit is contained in:
commit
4e53507711
1948 changed files with 751201 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { KanbanController } from "@web/views/kanban/kanban_controller";
|
||||
import { kanbanView } from '@web/views/kanban/kanban_view';
|
||||
import { registry } from '@web/core/registry';
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
|
||||
export class MailingContactController extends KanbanController {
|
||||
async setup() {
|
||||
super.setup();
|
||||
this.actionService = useService("action");
|
||||
}
|
||||
|
||||
onImport() {
|
||||
const context = this.props.context;
|
||||
const actionParams = { additionalContext: context };
|
||||
if (!context.default_mailing_list_ids && context.active_model === 'mailing.list' && context.active_ids) {
|
||||
actionParams.additionalContext.default_mailing_list_ids = context.active_ids;
|
||||
}
|
||||
this.actionService.doAction('mass_mailing.mailing_contact_import_action', actionParams);
|
||||
}
|
||||
};
|
||||
|
||||
registry.category('views').add('mailing_contact_kanban', {
|
||||
...kanbanView,
|
||||
Controller: MailingContactController,
|
||||
buttonTemplate: 'MailingContactKanbanView.buttons',
|
||||
});
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { ListController } from "@web/views/list/list_controller";
|
||||
import { listView } from '@web/views/list/list_view';
|
||||
import { registry } from '@web/core/registry';
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
|
||||
/**
|
||||
* List view for the <mailing.contact> model.
|
||||
*
|
||||
* Add an import button to open the wizard <mailing.contact.import>. This wizard
|
||||
* allows the user to import contacts line by line.
|
||||
*/
|
||||
export class MailingContactListController extends ListController {
|
||||
async setup() {
|
||||
super.setup();
|
||||
this.actionService = useService("action");
|
||||
}
|
||||
|
||||
onImport() {
|
||||
const context = this.props.context;
|
||||
const actionParams = { additionalContext: context };
|
||||
if (!context.default_mailing_list_ids && context.active_model === 'mailing.list' && context.active_ids) {
|
||||
actionParams.additionalContext.default_mailing_list_ids = context.active_ids;
|
||||
}
|
||||
this.actionService.doAction('mass_mailing.mailing_contact_import_action', actionParams);
|
||||
}
|
||||
};
|
||||
|
||||
registry.category('views').add('mailing_contact_list', {
|
||||
...listView,
|
||||
Controller: MailingContactListController,
|
||||
buttonTemplate: 'MailingContactListView.buttons',
|
||||
});
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="mailing_contact_views" xml:space="preserve">
|
||||
<t t-name="MailingContactListView.buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//t[@t-if='props.showButtons']" position="inside">
|
||||
<button type="button" class="btn btn-secondary o_mass_mailing_import_contact" t-on-click="onImport">
|
||||
Import
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t t-name="MailingContactKanbanView.buttons" t-inherit="web.KanbanView.Buttons" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//div[@t-if='props.showButtons']" position="inside">
|
||||
<button type="button" class="btn btn-secondary o_mass_mailing_import_contact" t-on-click="onImport">
|
||||
Import
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue