[FIX] base: Address must stay readonly when field use_parent_address is checked

When you change the country of your company, each field of a company address keeps
its attrs. This is why the company address stays on readonly when use_parent_address
is checked.

Closes #4808
opw: 627033
This commit is contained in:
Denis Ledoux 2015-02-13 16:01:07 +01:00
parent 4e2025719b
commit 3fed8ca58d
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ class format_address(object):
doc = etree.fromstring(arch)
for node in doc.xpath("//div[@class='address_format']"):
tree = etree.fromstring(v)
for child in node.xpath("//field"):
if child.attrib.get('modifiers'):
for field in tree.xpath("//field[@name='%s']" % child.attrib.get('name')):
field.attrib['modifiers'] = child.attrib.get('modifiers')
node.getparent().replace(node, tree)
arch = etree.tostring(doc)
break