Skip to content
Permalink
Browse files

⚡️ add message-template

  • Loading branch information...
KolushovAlexandr authored and fedoranvar committed Jul 12, 2019
1 parent a553aec commit 4ff9b27aba5b011dba3eee93d426fbd9376d2cb7
Showing with 58 additions and 0 deletions.
  1. +4 −0 pos_mail/__manifest__.py
  2. +34 −0 pos_mail/models/models.py
  3. +20 −0 pos_mail/views/mail_template.xml
@@ -24,6 +24,10 @@
"data": [
"views/assets.xml",
"views/views.xml",
<<<<<<< HEAD
=======
"views/mail_template.xml",
>>>>>>> 01e9cec5b... :tada::one::two: pos_mail (#664)
],
"demo": [
],
@@ -44,7 +44,15 @@ def send_receipt_via_mail(self, partner_id, body_from_ui, pos_reference):
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

<<<<<<< HEAD
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)
}
>>>>>>> 01e9cec5b... :tada::one::two: pos_mail (#664)

@api.multi
def set_values(self):
@@ -62,3 +70,29 @@ def get_values(self):
mail_message=mail_message,
)
return res
<<<<<<< HEAD
=======

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
''')
>>>>>>> 01e9cec5b... :tada::one::two: pos_mail (#664)
@@ -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 4ff9b27

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