Add more address lines information when parsing camt

This commit is contained in:
Emanuel Cino
2019-02-07 17:02:56 +01:00
committed by OCA-git-bot
parent 65d882b1ae
commit c91d83dbc8
2 changed files with 11 additions and 3 deletions

View File

@@ -262,8 +262,8 @@
<Dbtr>
<Nm>3rd party Media</Nm>
<PstlAdr>
<StrtNm>SOMESTREET 570-A</StrtNm>
<TwnNm>1276 ML HOUSCITY</TwnNm>
<AdrLine>SOMESTREET 570-A</AdrLine>
<AdrLine>1276 ML HOUSCITY</AdrLine>
<Ctry>NL</Ctry>
</PstlAdr>
</Dbtr>

View File

@@ -33,6 +33,13 @@ class CamtDetailsParser(models.AbstractModel):
'./ns:BldgNb', namespaces={'ns': ns})
if building_node:
address_values['building'] = building_node[0].text
generic_nodes = address_node[0].xpath(
'./ns:AdrLine', namespaces={'ns': ns})
if generic_nodes:
address_values.update({
'address_line_' + str(i): node.text
for i, node in enumerate(generic_nodes)
})
zip_node = address_node[0].xpath(
'./ns:PstCd', namespaces={'ns': ns})
if zip_node:
@@ -58,7 +65,8 @@ class CamtDetailsParser(models.AbstractModel):
"""
Hook for formatting the partner address read in CAMT bank statement.
:param address_values: dict: all address values found in statement
Possible keys are ['street', 'building', 'zip', 'city']
Possible keys are ['street', 'building', 'address_line_xxx',
'zip', 'city']
Not all keys may be present.
:return: str: formatted address
"""