Mailing : actions #42

Open
youssef wants to merge 33 commits from youssef/GOLEM:Mailing_actions into master
2 changed files with 22 additions and 2 deletions
Showing only changes of commit 8d9f7f64a1 - Show all commits

View File

@ -24,6 +24,10 @@ 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 """
@ -33,13 +37,13 @@ class GolemFamily(models.Model):
for email in emails:
self.env['golem.mail.recipient'].create({'email': email,
'presend_wizard_id': presend_wizard.id})
act_name = 'Family mass mailing'
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'
act_name = 'Family members mass mailing'
return {
'type': 'ir.actions.act_window',
'name': act_name,

View File

@ -18,6 +18,22 @@ 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>