Mailing : actions #42
18
golem_mail/__init__.py
Normal file
18
golem_mail/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import wizard
|
32
golem_mail/__manifest__.py
Normal file
32
golem_mail/__manifest__.py
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{
|
||||
'name': 'GOLEM Mail',
|
||||
'summary': 'GOLEM Mail',
|
||||
'description': ''' GOLEM Mail ''',
|
||||
'version': '10.0.0.0.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'depends': ['mail', 'contacts'],
|
||||
'data': ['wizard/golem_mail_presend_wizard_views.xml']
|
||||
}
|
19
golem_mail/wizard/__init__.py
Normal file
19
golem_mail/wizard/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from . import golem_mail_presend_wizard, golem_mail_recipient, mail_compose_message
|
53
golem_mail/wizard/golem_mail_presend_wizard.py
Normal file
53
golem_mail/wizard/golem_mail_presend_wizard.py
Normal file
@ -0,0 +1,53 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
""" GOLEM Mail Presend Wizard """
|
||||
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class GolemMailPresendWizard(models.TransientModel):
|
||||
""" GOLEM Mail Presend Wizard """
|
||||
_name = 'golem.mail.presend.wizard'
|
||||
|
||||
recipient_ids = fields.One2many('golem.mail.recipient', 'presend_wizard_id')
|
||||
|
||||
@api.multi
|
||||
def edit_email(self):
|
||||
""" Call mail_compose_message wizard """
|
||||
self.ensure_one()
|
||||
wizard = self[0]
|
||||
emails = wizard.recipient_ids.filtered(lambda r: not r.partner_id).mapped('email')
|
||||
semails = list(set([item.strip() for item in emails]))
|
||||
partners = wizard.recipient_ids.filtered(lambda r: not r.opt_out).mapped('partner_id').ids
|
||||
return {
|
||||
'name' : _('Search results'),
|
||||
'type' : 'ir.actions.act_window',
|
||||
'res_model' : 'mail.compose.message',
|
||||
'context' : {
|
||||
'default_composition_mode': 'mass_mail',
|
||||
'default_partner_to': "\\",
|
||||
'default_use_template': True,
|
||||
'default_template_id': self.env.ref('mail.email_template_partner').id,
|
||||
'default_no_auto_thread': False,
|
||||
'default_from_presend_wizard': True,
|
||||
'partners_from_wizard': partners,
|
||||
'emails_from_wizard': semails},
|
||||
'view_mode': 'form',
|
||||
'target': 'new'
|
||||
}
|
45
golem_mail/wizard/golem_mail_presend_wizard_views.xml
Normal file
45
golem_mail/wizard/golem_mail_presend_wizard_views.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="golem_mail_presend_wizard_form">
|
||||
<field name="name">GOLEM Mail Presend Wizard Form</field>
|
||||
<field name="model">golem.mail.presend.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="recipient_ids">
|
||||
<tree editable="bottom" colors="red: opt_out == True;">
|
||||
<field name="partner_id" readonly="1"/>
|
||||
<field name="firstname" readonly="1"/>
|
||||
<field name="lastname" readonly="1"/>
|
||||
<field name="phone" readonly="1"/>
|
||||
<field name="email"/>
|
||||
<field name="opt_out" readonly="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<footer>
|
||||
<button name="edit_email" string="Next"
|
||||
type="object" class="oe_highlight"/>
|
||||
<button string="Close" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
46
golem_mail/wizard/golem_mail_recipient.py
Normal file
46
golem_mail/wizard/golem_mail_recipient.py
Normal file
@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
""" GOLEM Mail Recipient Management """
|
||||
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class GolemMailRecipient(models.TransientModel):
|
||||
""" GOLEM Mail Recipient """
|
||||
_name = 'golem.mail.recipient'
|
||||
|
||||
partner_id = fields.Many2one('res.partner')
|
||||
email = fields.Char()
|
||||
firstname = fields.Char()
|
||||
lastname = fields.Char()
|
||||
phone = fields.Char()
|
||||
opt_out = fields.Boolean()
|
||||
presend_wizard_id = fields.Many2one('golem.mail.presend.wizard')
|
||||
|
||||
@api.multi
|
||||
@api.constrains('partner_id')
|
||||
def fill_related_fields(self):
|
||||
""" fill related fields from partner_id """
|
||||
for recipient in self:
|
||||
if recipient.partner_id:
|
||||
recipient.email = recipient.partner_id.email
|
||||
recipient.firstname = recipient.partner_id.firstname
|
||||
recipient.lastname = recipient.partner_id.lastname
|
||||
recipient.phone = recipient.partner_id.phone
|
||||
recipient.opt_out = recipient.partner_id.opt_out
|
144
golem_mail/wizard/mail_compose_message.py
Normal file
144
golem_mail/wizard/mail_compose_message.py
Normal file
@ -0,0 +1,144 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
""" Mail Compose Message Adaptations """
|
||||
|
||||
from odoo import _, api, fields, models, SUPERUSER_ID, tools
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
|
||||
class MailComposer(models.TransientModel):
|
||||
""" Mail Compose Message Adaptations """
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
from_presend_wizard = fields.Boolean()
|
||||
|
||||
@api.multi
|
||||
def send_mail(self, auto_commit=False):
|
||||
""" Process the wizard content and proceed with sending the related
|
||||
email(s), rendering any template patterns on the fly if needed. """
|
||||
for wizard in self:
|
||||
# Duplicate attachments linked to the email.template.
|
||||
# Indeed, basic mail.compose.message wizard duplicates attachments in mass
|
||||
# mailing mode. But in 'single post' mode, attachments of an email template
|
||||
# also have to be duplicated to avoid changing their ownership.
|
||||
if wizard.attachment_ids and wizard.composition_mode != 'mass_mail' and wizard.template_id:
|
||||
new_attachment_ids = []
|
||||
for attachment in wizard.attachment_ids:
|
||||
if attachment in wizard.template_id.attachment_ids:
|
||||
new_attachment_ids.append(attachment.copy({'res_model': 'mail.compose.message', 'res_id': wizard.id}).id)
|
||||
else:
|
||||
new_attachment_ids.append(attachment.id)
|
||||
wizard.write({'attachment_ids': [(6, 0, new_attachment_ids)]})
|
||||
|
||||
# Mass Mailing
|
||||
mass_mode = wizard.composition_mode in ('mass_mail', 'mass_post')
|
||||
|
||||
Mail = self.env['mail.mail']
|
||||
ActiveModel = self.env[wizard.model if wizard.model else 'mail.thread']
|
||||
if wizard.template_id:
|
||||
# template user_signature is added when generating body_html
|
||||
# mass mailing: use template auto_delete value -> note, for emails mass mailing only
|
||||
Mail = Mail.with_context(mail_notify_user_signature=False)
|
||||
ActiveModel = ActiveModel.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete)
|
||||
if not hasattr(ActiveModel, 'message_post'):
|
||||
ActiveModel = self.env['mail.thread'].with_context(thread_model=wizard.model)
|
||||
if wizard.composition_mode == 'mass_post':
|
||||
# do not send emails directly but use the queue instead
|
||||
# add context key to avoid subscribing the author
|
||||
ActiveModel = ActiveModel.with_context(mail_notify_force_send=False, mail_create_nosubscribe=True)
|
||||
# wizard works in batch mode: [res_id] or active_ids or active_domain
|
||||
if mass_mode and wizard.use_active_domain and wizard.model:
|
||||
res_ids = self.env[wizard.model].search(safe_eval(wizard.active_domain)).ids
|
||||
elif mass_mode and wizard.model and self._context.get('active_ids'):
|
||||
if wizard.from_presend_wizard:
|
||||
res_ids = self._context['partners_from_wizard']
|
||||
else:
|
||||
res_ids = self._context['active_ids']
|
||||
else:
|
||||
res_ids = [wizard.res_id]
|
||||
|
||||
batch_size = int(self.env['ir.config_parameter'].sudo().get_param('mail.batch_size')) or self._batch_size
|
||||
sliced_res_ids = [res_ids[i:i + batch_size] for i in range(0, len(res_ids), batch_size)]
|
||||
|
||||
if wizard.composition_mode == 'mass_mail' or wizard.is_log or (wizard.composition_mode == 'mass_post' and not wizard.notify): # log a note: subtype is False
|
||||
subtype_id = False
|
||||
elif wizard.subtype_id:
|
||||
subtype_id = wizard.subtype_id.id
|
||||
else:
|
||||
subtype_id = self.sudo().env.ref('mail.mt_comment', raise_if_not_found=False).id
|
||||
batch_mails = Mail
|
||||
for res_ids in sliced_res_ids:
|
||||
all_mail_values = wizard.get_mail_values(res_ids)
|
||||
for res_id, mail_values in all_mail_values.iteritems():
|
||||
if wizard.composition_mode == 'mass_mail':
|
||||
batch_mails |= Mail.create(mail_values)
|
||||
else:
|
||||
ActiveModel.browse(res_id).message_post(
|
||||
message_type=wizard.message_type,
|
||||
subtype_id=subtype_id,
|
||||
**mail_values)
|
||||
if self.env.context.get('emails_from_wizard', False):
|
||||
mails = self._context['emails_from_wizard']
|
||||
emails_values = wizard.get_mail_values_from_mails(mails)
|
||||
for email_val in emails_values:
|
||||
batch_mails |= Mail.create(email_val)
|
||||
|
||||
if wizard.composition_mode == 'mass_mail':
|
||||
batch_mails.send(auto_commit=auto_commit)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def get_mail_values_from_mails(self, mails):
|
||||
self.ensure_one()
|
||||
mail_values = {
|
||||
'subject': self.subject,
|
||||
'body': self.body or '',
|
||||
'parent_id': self.parent_id and self.parent_id.id,
|
||||
'partner_ids': [partner.id for partner in self.partner_ids],
|
||||
'attachment_ids': [attach.id for attach in self.attachment_ids],
|
||||
'author_id': self.author_id.id,
|
||||
'email_from': self.email_from,
|
||||
'record_name': self.record_name,
|
||||
'no_auto_thread': self.no_auto_thread,
|
||||
'mail_server_id': self.mail_server_id.id,
|
||||
}
|
||||
mail_values.update(notification=not self.auto_delete_message,
|
||||
model=self.model,
|
||||
record_name=False)
|
||||
# auto deletion of mail_mail
|
||||
if self.auto_delete or self.template_id.auto_delete:
|
||||
mail_values['auto_delete'] = True
|
||||
mail_values['reply_to'] = mail_values['email_from']
|
||||
mail_values['body_html'] = mail_values.get('body', '')
|
||||
attachment_ids = []
|
||||
for attach_id in mail_values.pop('attachment_ids'):
|
||||
new_attach_id = self.env['ir.attachment'].browse(attach_id).copy({
|
||||
'res_model': self._name,
|
||||
'res_id': self.id
|
||||
})
|
||||
attachment_ids.append(new_attach_id.id)
|
||||
mail_values['attachment_ids'] = self.env['mail.thread']._message_preprocess_attachments(
|
||||
mail_values.pop('attachments', []),
|
||||
attachment_ids, 'mail.message', 0)
|
||||
emails_result = []
|
||||
for email in mails:
|
||||
mail_values['email_to'] = email
|
||||
emails_result.append(dict(mail_values))
|
||||
return emails_result
|
18
golem_mail_activity_registration/__init__.py
Normal file
18
golem_mail_activity_registration/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import models
|
32
golem_mail_activity_registration/__manifest__.py
Normal file
32
golem_mail_activity_registration/__manifest__.py
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{
|
||||
'name': 'GOLEM Mail Activity Registration',
|
||||
'summary': 'GOLEM Mail Activity Registration',
|
||||
'description': ''' GOLEM Mail Activity Registration ''',
|
||||
'version': '10.0.0.0.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'depends': ['golem_activity_registration'],
|
||||
'data': ['views/golem_mail_activity_views.xml']
|
||||
}
|
19
golem_mail_activity_registration/models/__init__.py
Normal file
19
golem_mail_activity_registration/models/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from . import golem_activity
|
57
golem_mail_activity_registration/models/golem_activity.py
Normal file
57
golem_mail_activity_registration/models/golem_activity.py
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" GOLEM Activity adaptations """
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemActivity(models.Model):
|
||||
""" GOLEM Activity adaptations """
|
||||
_inherit = 'golem.activity'
|
||||
|
||||
@api.multi
|
||||
def activity_members_mass_mailing(self):
|
||||
return self.get_mass_mailing_action('members')
|
||||
|
||||
|
||||
@api.multi
|
||||
def get_mass_mailing_action(self, action_type):
|
||||
""" Call activity mass mailing presend wizard """
|
||||
presend_wizard = self.env['golem.mail.presend.wizard'].create({})
|
||||
if action_type == 'animators':
|
||||
partners = self.mapped('animator_id').ids
|
||||
for partner in partners:
|
||||
self.env['golem.mail.recipient'].create({'partner_id': partner,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
act_name = 'Activity animators mass mailing'
|
||||
elif action_type == 'members':
|
||||
partner_ids = self.mapped('activity_registration_ids').mapped(
|
||||
'member_id').mapped('partner_id').ids
|
||||
for partner in partner_ids:
|
||||
self.env['golem.mail.recipient'].create({'partner_id': partner,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
act_name = 'Activity members mass mailing'
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': act_name,
|
||||
'res_model': 'golem.mail.presend.wizard',
|
||||
'res_id': presend_wizard.id,
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'target': 'new'
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- golem activity form adaptations -->
|
||||
<record id="golem_activity_form_inherit_golem_mail_activity_registration"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Golem Activity form adaptations golem mail activity registration</field>
|
||||
<field name="model">golem.activity</field>
|
||||
<field name="inherit_id" ref="golem_activity.golem_activity_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<sheet position="before">
|
||||
<header>
|
||||
<button name="activity_members_mass_mailing" string="Activity members mass mailing"
|
||||
type="object" class="oe_highlight"/>
|
||||
</header>
|
||||
</sheet>
|
||||
</field>
|
||||
</record>
|
||||
<!-- Activity members mass mailing action-->
|
||||
<record id="action_activity_members_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Activity members mass mailing</field>
|
||||
<field name="model_id" ref="golem_activity.model_golem_activity"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action('members')
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_activity_members_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'golem.activity'" />
|
||||
<field name="name">Family Members mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_activity_members_mass_mailing" />
|
||||
</record>
|
||||
|
||||
<!-- Activity animators mass mailing action-->
|
||||
<record id="action_activity_animators_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Activity animators mass mailing</field>
|
||||
<field name="model_id" ref="golem_activity.model_golem_activity"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action('animators')
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_activity_animators_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'golem.activity'" />
|
||||
<field name="name">Activity animators mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_activity_animators_mass_mailing" />
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
18
golem_mail_family/__init__.py
Normal file
18
golem_mail_family/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import models
|
31
golem_mail_family/__manifest__.py
Normal file
31
golem_mail_family/__manifest__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{
|
||||
'name': 'GOLEM Mail Family',
|
||||
'summary': 'GOLEM Mail Family',
|
||||
'description': ''' GOLEM Mail Family ''',
|
||||
'version': '10.0.0.0.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'depends': ['golem_family'],
|
||||
'data': ['views/golem_mail_family_views.xml']
|
||||
}
|
19
golem_mail_family/models/__init__.py
Normal file
19
golem_mail_family/models/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from . import golem_family
|
55
golem_mail_family/models/golem_family.py
Normal file
55
golem_mail_family/models/golem_family.py
Normal file
@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" GOLEM Family adaptations """
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemFamily(models.Model):
|
||||
""" GOLEM Family adaptations """
|
||||
_inherit = 'golem.family'
|
||||
|
||||
@api.multi
|
||||
def family_members_mass_mailing(self):
|
||||
return self.get_mass_mailing_action('members')
|
||||
|
||||
@api.multi
|
||||
def get_mass_mailing_action(self, action_type):
|
||||
""" Call family mass mailing presend wizard """
|
||||
presend_wizard = self.env['golem.mail.presend.wizard'].create({})
|
||||
if action_type == 'family':
|
||||
emails = self.mapped('email')
|
||||
for email in emails:
|
||||
self.env['golem.mail.recipient'].create({'email': email,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
act_name = 'Family mass mailing'
|
||||
elif action_type == 'members':
|
||||
partner_ids = self.mapped('member_ids').ids
|
||||
for partner in partner_ids:
|
||||
self.env['golem.mail.recipient'].create({'partner_id': partner,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
act_name = 'Family members mass mailing'
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': act_name,
|
||||
'res_model': 'golem.mail.presend.wizard',
|
||||
'res_id': presend_wizard.id,
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'target': 'new'
|
||||
}
|
71
golem_mail_family/views/golem_mail_family_views.xml
Normal file
71
golem_mail_family/views/golem_mail_family_views.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- golem family form adaptations -->
|
||||
<record id="golem_family_form_inherit_golem_mail_family"
|
||||
model="ir.ui.view">
|
||||
<field name="name">Golem Family form adaptations golem mail family</field>
|
||||
<field name="model">golem.family</field>
|
||||
<field name="inherit_id" ref="golem_family.golem_family_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<sheet position="before">
|
||||
<header>
|
||||
<button name="family_members_mass_mailing" string="Family members mass mailing"
|
||||
type="object" class="oe_highlight"
|
||||
attrs="{'invisible': [('member_ids', '=', False)]}"/>
|
||||
</header>
|
||||
</sheet>
|
||||
</field>
|
||||
</record>
|
||||
<!-- Family member mass mailing action-->
|
||||
<record id="action_family_members_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Family members mass mailing</field>
|
||||
<field name="model_id" ref="golem_family.model_golem_family"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action('members')
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_family_members_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'golem.family'" />
|
||||
<field name="name">Family Members mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_family_members_mass_mailing" />
|
||||
</record>
|
||||
|
||||
<!-- Family mass mailing action-->
|
||||
<record id="action_family_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Family mass mailing</field>
|
||||
<field name="model_id" ref="golem_family.model_golem_family"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action('family')
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_family_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'golem.family'" />
|
||||
<field name="name">Family mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_family_mass_mailing" />
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
18
golem_mail_member/__init__.py
Normal file
18
golem_mail_member/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import models
|
33
golem_mail_member/__manifest__.py
Normal file
33
golem_mail_member/__manifest__.py
Normal file
@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{
|
||||
'name': 'GOLEM Mail Member',
|
||||
'summary': 'GOLEM Mail Member',
|
||||
'description': ''' GOLEM Mail Member ''',
|
||||
'version': '10.0.0.0.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'depends': ['golem_member'],
|
||||
'data': ['views/golem_mail_member_views.xml',
|
||||
'views/golem_mail_res_partner_views.xml',
|
||||
'data/res_partner_data.xml']
|
||||
}
|
27
golem_mail_member/data/res_partner_data.xml
Normal file
27
golem_mail_member/data/res_partner_data.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- Base Accounting settings call -->
|
||||
<function model="golem.res.partner.config" name="res_partner_settings" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
19
golem_mail_member/models/__init__.py
Normal file
19
golem_mail_member/models/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from . import golem_member, golem_res_partner_config
|
67
golem_mail_member/models/golem_member.py
Normal file
67
golem_mail_member/models/golem_member.py
Normal file
@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" GOLEM Member adaptations """
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemMember(models.Model):
|
||||
""" GOLEM Member adaptations """
|
||||
_inherit = 'golem.member'
|
||||
|
||||
@api.multi
|
||||
def get_mass_mailing_action(self):
|
||||
""" Call member mass mailing presend wizard """
|
||||
partners = self.mapped('partner_id').ids
|
||||
presend_wizard = self.env['golem.mail.presend.wizard'].create(
|
||||
{'partner_ids': [(6, 0, partners)]})
|
||||
for partner in partners:
|
||||
self.env['golem.mail.recipient'].create({'partner_id': partner,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Member mass mailing',
|
||||
'res_model': 'golem.mail.presend.wizard',
|
||||
'res_id': presend_wizard.id,
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
class ResPartner(models.Model):
|
||||
""" Res Partner adaptations """
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.multi
|
||||
def get_mass_mailing_action(self):
|
||||
""" Call res partner mass mailing presend wizard """
|
||||
partners = self.ids
|
||||
presend_wizard = self.env['golem.mail.presend.wizard'].create(
|
||||
{'partner_ids': [(6, 0, partners)]})
|
||||
for partner in partners:
|
||||
self.env['golem.mail.recipient'].create({'partner_id': partner,
|
||||
'presend_wizard_id': presend_wizard.id})
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Member mass mailing',
|
||||
'res_model': 'golem.mail.presend.wizard',
|
||||
'res_id': presend_wizard.id,
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'target': 'new'
|
||||
}
|
32
golem_mail_member/models/golem_res_partner_config.py
Normal file
32
golem_mail_member/models/golem_res_partner_config.py
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" GOLEM Res Partner Configuration """
|
||||
|
||||
from odoo import models, api, _
|
||||
|
||||
|
||||
class ResPartnerConfig(models.AbstractModel):
|
||||
""" GOLEM Res Partner Configuration """
|
||||
_name = 'golem.res.partner.config'
|
||||
_description = 'GOLEM Res Partner Configuration'
|
||||
|
||||
@api.model
|
||||
def res_partner_settings(self):
|
||||
""" Res partner mas mailing remove """
|
||||
if self.env.ref('base.action_partner_mass_mail'):
|
||||
self.env.ref('base.action_partner_mass_mail').unlink()
|
38
golem_mail_member/views/golem_mail_member_views.xml
Normal file
38
golem_mail_member/views/golem_mail_member_views.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- Add action to members list-->
|
||||
<record id="action_member_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Member mass mailing</field>
|
||||
<field name="model_id" ref="golem_member.model_golem_member"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action()
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_member_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'golem.member'" />
|
||||
<field name="name">Member mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_member_mass_mailing" />
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
38
golem_mail_member/views/golem_mail_res_partner_views.xml
Normal file
38
golem_mail_member/views/golem_mail_res_partner_views.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- Add action to members list-->
|
||||
<record id="action_golem_res_partner_mass_mailing" model="ir.actions.server">
|
||||
<field name="name">Partner mass mailing</field>
|
||||
<field name="model_id" ref="base.model_res_partner"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.get_mass_mailing_action()
|
||||
</field>
|
||||
</record>
|
||||
<record id="ir_golem_res_partner_mass_mailing" model="ir.values">
|
||||
<field name="key2" eval="'client_action_multi'" />
|
||||
<field name="model" eval="'res.partner'" />
|
||||
<field name="name">Partner mass mailing</field>
|
||||
<field name="value"
|
||||
eval="'ir.actions.server,%d'%action_golem_res_partner_mass_mailing" />
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user