[IMP] ir_qweb: added country flag management in contact widget
bzr revid: tde@openerp.com-20140411091621-q0c2ndzv9xpptzqo
This commit is contained in:
@@ -819,6 +819,8 @@ class Contact(orm.AbstractModel):
|
||||
_inherit = 'ir.qweb.field.many2one'
|
||||
|
||||
def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None):
|
||||
if options is None:
|
||||
options = {}
|
||||
opf = options.get('fields') or ["name", "address", "phone", "mobile", "fax", "email"]
|
||||
|
||||
if not getattr(record, field_name):
|
||||
@@ -838,6 +840,7 @@ class Contact(orm.AbstractModel):
|
||||
'country_id': field_browse.country_id and field_browse.country_id.name_get()[0][1],
|
||||
'email': field_browse.email,
|
||||
'fields': opf,
|
||||
'object': field_browse,
|
||||
'options': options
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
<data>
|
||||
<template id="contact">
|
||||
<address t-ignore="true" class="mb0" itemscope="itemscope" itemtype="http://schema.org/Organization">
|
||||
<div t-att-class="'name' not in fields and 'css_non_editable_mode_hidden'"><span itemprop="name" t-esc="name"/></div>
|
||||
<div t-att-class="'name' not in fields and 'css_non_editable_mode_hidden'">
|
||||
<span itemprop="name" t-esc="name"/>
|
||||
<t t-if="options.get('country_image') and 'country_id' in fields and object.country_id and object.country_id.image">
|
||||
<span t-field="object.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/>
|
||||
</t>
|
||||
</div>
|
||||
<div itemprop="address" itemscope="itemscope" itemtype="http://schema.org/PostalAddress">
|
||||
<div t-if="address and 'address' in fields" class='css_editable_mode_hidden'>
|
||||
<i t-if="not options.get('no_marker')" class='fa fa-map-marker'/> <span itemprop="streetAddress" t-raw="address.replace('\n', options.get('no_tag_br') and ', ' or ('<br/>%s' % ('' if options.get('no_marker') else '&nbsp; &nbsp; ')))"/>
|
||||
|
||||
Reference in New Issue
Block a user