Skip to content

Commit

Permalink
fixup! saved
Browse files Browse the repository at this point in the history
  • Loading branch information
em230418 committed Nov 24, 2023
1 parent b7ada1b commit a00181c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tg_website_sale_affiliate/data/mail_template_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<field name="subject">Affiliate Invitation</field>
<field name="email_from">"${object.company_id.name | safe}" &lt;${(object.company_id.email or user.email) | safe}&gt;</field>
<field name="email_to">${object.partner_id.email_formatted | safe}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="html">
Hello, ${object.name}! You affiliate link: <a href="${referal_link}">${referal_link}</a>
<p>Hello, ${object.name}! You affiliate link: <a href="${object.referal_link}">${object.referal_link}</a></p>
</field>
</record>
</data>
Expand Down
4 changes: 4 additions & 0 deletions tg_website_sale_affiliate/models/sale_affiliate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def _subscribe_partner(self):
for record in self:
record.message_subscribe(partner_ids=record.partner_id.ids)

def _send_invitation(self):
template = self.env.ref("tg_website_sale_affiliate.send_invitation_mail_template")
template.send_mail(self.id, force_send=True, raise_exception=True)

@api.model_create_multi
def create(self, vals_list):
records = super(SaleAffiliate, self).create(vals_list)
Expand Down
9 changes: 9 additions & 0 deletions tg_website_sale_affiliate/views/sale_affiliate_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@
</xpath>
</field>
</record>

<record id="action_send_password_reset_instructions" model="ir.actions.server">
<field name="name">Send invitation</field>
<field name="model_id" ref="website_sale_affiliate.model_sale_affiliate"/>
<field name="groups_id" eval="[(4, ref('base.group_erp_manager'))]"/>
<field name="binding_model_id" ref="website_sale_affiliate.model_sale_affiliate" />
<field name="state">code</field>
<field name="code">records._send_invitation()</field>
</record>
</odoo>

0 comments on commit a00181c

Please sign in to comment.