[FIX] base: translate place holders in partner view

Placeholders for City, ZIP and State were not translated
Fixes #4340 (and one of #1755), opw 616589
This commit is contained in:
Martin Trigaux 2014-12-23 11:05:44 +01:00
parent b7e2f5be8b
commit 44d155d3d4
1 changed files with 10 additions and 10 deletions

View File

@ -34,25 +34,25 @@ from openerp.tools.translate import _
ADDRESS_FORMAT_LAYOUTS = {
'%(city)s %(state_code)s\n%(zip)s': """
<div class="address_format">
<field name="city" placeholder="City" style="width: 50%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 47%" options='{"no_open": true}'/>
<field name="city" placeholder="%(city)s" style="width: 50%%"/>
<field name="state_id" class="oe_no_button" placeholder="%(state)s" style="width: 47%%" options='{"no_open": true}'/>
<br/>
<field name="zip" placeholder="ZIP"/>
<field name="zip" placeholder="%(zip)s"/>
</div>
""",
'%(zip)s %(city)s': """
<div class="address_format">
<field name="zip" placeholder="ZIP" style="width: 40%"/>
<field name="city" placeholder="City" style="width: 57%"/>
<field name="zip" placeholder="%(zip)s" style="width: 40%%"/>
<field name="city" placeholder="%(city)s" style="width: 57%%"/>
<br/>
<field name="state_id" class="oe_no_button" placeholder="State" options='{"no_open": true}'/>
<field name="state_id" class="oe_no_button" placeholder="%(state)s" options='{"no_open": true}'/>
</div>
""",
'%(city)s\n%(state_name)s\n%(zip)s': """
<div class="address_format">
<field name="city" placeholder="City"/>
<field name="state_id" class="oe_no_button" placeholder="State" options='{"no_open": true}'/>
<field name="zip" placeholder="ZIP"/>
<field name="city" placeholder="%(city)s"/>
<field name="state_id" class="oe_no_button" placeholder="%(state)s" options='{"no_open": true}'/>
<field name="zip" placeholder="%(zip)s"/>
</div>
"""
}
@ -66,7 +66,7 @@ class format_address(object):
if k in fmt:
doc = etree.fromstring(arch)
for node in doc.xpath("//div[@class='address_format']"):
tree = etree.fromstring(v)
tree = etree.fromstring(v % {'city': _('City'), 'zip': _('ZIP'), 'state': _('State')})
node.getparent().replace(node, tree)
arch = etree.tostring(doc)
break