Skip to content
Permalink
Browse files

⚡️ add message-template

  • Loading branch information...
KolushovAlexandr authored and fedoranvar committed Jul 12, 2019
1 parent a553aec commit d4697a0d708997bc28266565fe82c646865b5d7a
Showing with 49 additions and 1 deletion.
  1. +1 −0 pos_mail/__manifest__.py
  2. +28 −1 pos_mail/models/models.py
  3. +20 −0 pos_mail/views/mail_template.xml
@@ -24,6 +24,7 @@
"data": [
"views/assets.xml",
"views/views.xml",
"views/mail_template.xml",
],
"demo": [
],
@@ -44,7 +44,11 @@ def send_receipt_via_mail(self, partner_id, body_from_ui, pos_reference):
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

mail_message = fields.Text('Mail Message Template')
# mail_message = fields.Text('Mail Message Template')
mail_message = fields.Many2one('pos.mail.template', string='Mail Message Template', help='Keep empty to edit template manually')
_columns = {
'template': fields.Html('Template', sanitize=False)
}

@api.multi
def set_values(self):
@@ -62,3 +66,26 @@ def get_values(self):
mail_message=mail_message,
)
return res

class PosMailTemplate(models.TransientModel):
_name = "pos.mail.template"

name = fields.Char('Name')
comment = fields.Text('Internal note')
template = fields.Html('Template', sanitize=False, help='''You can use variables:
* ${user.name}
* ${user.function} (job position)
* ${user.partner_id.company_id.name} (company in a partner form)
* ${user.company_id.name} (current company)
* ${user.email}
* ${user.phone}
* ${user.mobile}
* etc. (contact your administrator for further information)
You can use control structures:
% if user.mobile
Mobile: ${user.mobile}
% endif
''')
@@ -0,0 +1,20 @@
<odoo>
<record model="ir.ui.view" id="view_pos_mail_template">
<field name="name">pos.mail.template.form</field>
<field name="model">pos.mail.template</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mail_Message">
<header>
<button name="action_update_template" string="Update template" type="object"/>
<button name="action_delete_template" string="Delete template" type="object"/>
</header>
<group>
<field name="name" class="oe_inline"/>
<field name="comment" class="oe_inline"/>
</group>
<field name="template" />
</form>
</field>
</record>
</odoo>

0 comments on commit d4697a0

Please sign in to comment.
You can’t perform that action at this time.