[MRG] add simplified form view of template for product
bzr revid: tpa@tinyerp.com-20140123111229-8c1d7gf2osv6cql0
This commit is contained in:
@@ -26,6 +26,20 @@ class product_template(osv.osv):
|
||||
'email_template_id': fields.many2one('email.template','Product Email Template'),
|
||||
}
|
||||
|
||||
class email_template(osv.osv):
|
||||
_inherit = 'email.template'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
res = super(email_template, self).default_get(cr, uid, fields, context)
|
||||
if context.get('form_view_ref') == 'account_product_template.view_email_template_form_product':
|
||||
res['email_from'] = '${(user.email)|safe}'
|
||||
res['email_to'] = '${(object.partner_id.email)|safe}'
|
||||
res['partner_to'] = '${object.partner_id.id}'
|
||||
res['name'] = context.get('product_name')
|
||||
res['subject'] = context.get('product_name')
|
||||
res['model_id'] = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.invoice')], context=context)
|
||||
return res
|
||||
|
||||
class account_invoice(osv.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
|
||||
@@ -1,14 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_email_template_form_product" model="ir.ui.view">
|
||||
<field name="name">email.template.form</field>
|
||||
<field name="model">email.template</field>
|
||||
<field name="priority">100</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Templates" version="7.0">
|
||||
<sheet>
|
||||
<field name="email_from" invisible="1"/>
|
||||
<field name="partner_to" invisible="1"/>
|
||||
<field name="subject" invisible="1"/>
|
||||
<field name="model_id" invisible="1"/>
|
||||
<h3>Body</h3>
|
||||
<field name="body_html" placeholder="Rich-text/HTML content of the message (placeholders may be used here)"/>
|
||||
<field name="attachment_ids" nolabel="1" widget="many2many_binary"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="product_normal_form_view_template" model="ir.ui.view">
|
||||
<field name="name">product.normal.procurement.locations.inherit</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="list_price" position="after">
|
||||
<field name="email_template_id" domain="[('model','=','account.invoice')]"/>
|
||||
<field name="email_template_id" domain="[('model','=','account.invoice')]" context="{'form_view_ref':'account_product_template.view_email_template_form_product','product_name': name}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user