Add initiator id on journal

Each country/bank has its own requirement about the ID to use on the initiator
party so we add an option on the journal to define which identifier to use.

issue8063
review284021004
This commit is contained in:
Cédric Krier
2019-10-08 18:24:45 +02:00
parent 2a27aba3e8
commit b48ca01e70
2 changed files with 34 additions and 14 deletions
+32 -12
View File
@@ -3,19 +3,39 @@
this repository contains the full copyright notices and license terms. -->
<py:strip xmlns:py="http://genshi.edgewall.org/">
<!-- CFONB forbid PstlAdr -->
<py:def function="PartyIdentification(party, id=True, name=True)">
<py:def function="PartyIdentification(party, id=None, with_name=True)">
<!-- EPC limits to 70 instead of 140 -->
<Nm py:if="name">${party.name[:70]}</Nm>
<Id py:if="id and party.sepa_creditor_identifier_used">
<PrvtId>
<Othr>
<Id>${party.sepa_creditor_identifier_used}</Id>
<SchmeNm>
<Prtry>SEPA</Prtry>
</SchmeNm>
<!-- Issr -->
</Othr>
</PrvtId>
<Nm py:if="with_name">${party.name[:70]}</Nm>
<Id py:if="id">
<py:with vars="identifier = party.get_sepa_identifier(id)">
<OrgId py:if="identifier['Type'] == 'OrgId'">
<BICOrBEI py:if="identifier.get('BICOrBEI')">${identifier['BICOrBEI']}</BICOrBEI>
<Othr py:if="identifier.get('Id')">
<Id>${identifier['Id']}</Id>
<SchmeNm py:if="identifier.get('SchmeNm')">
<Cd py:if="identifier['SchmeNm'].get('Cd')">${identifier['SchmeNm']['Cd']}</Cd>
<Prtry py:if="identifier['SchmeNm'].get('Prtry')">${identifier['SchmeNm']['Cd']}</Prtry>
</SchmeNm>
<Issr py:if="identifier.get('Issr')">${identifier['Issr']}</Issr>
</Othr>
</OrgId>
<PrvtId py:if="identifier['Type'] == 'PrvtId'">
<DtAndPlcOfBirth py:if="identifier.get('DtAndPlcOfBirth')">
<BirthDt>${identifier['DtAndPlcOfBirth']['BirthDt'].isoformat()}</BirthDt>
<PrvcOfBirth py:if="identifier['DtAndPlcOfBirth'].get('PrvcOfBirth')">${identifier['DtAndPlcOfBirth']['PrvcOfBirth']}</PrvcOfBirth>
<CityOfBirth>${identifier['DtAndPlcOfBirth']['CityOfBirth']}</CityOfBirth>
<CtryOfBirth>${identifier['DtAndPlcOfBirth']['CtryOfBirth']}</CtryOfBirth>
</DtAndPlcOfBirth>
<Othr py:if="identifier.get('Id')">
<Id>${identifier['Id']}</Id>
<SchmeNm py:if="identifier.get('SchmeNm')">
<Cd py:if="identifier['SchmeNm'].get('Cd')">${identifier['SchmeNm']['Cd']}</Cd>
<Prtry py:if="identifier['SchmeNm'].get('Prtry')">${identifier['SchmeNm']['Prtry']}</Prtry>
</SchmeNm>
<Issr py:if="identifier.get('Issr')">${identifier['Issr']}</Issr>
</Othr>
</PrvtId>
</py:with>
</Id>
<!-- CtryOfRes -->
<!-- CtctDtls -->
+2 -2
View File
@@ -55,7 +55,7 @@ this repository contains the full copyright notices and license terms. -->
</PmtTpInf>
<ReqdColltnDt>${key['date'].isoformat()}</ReqdColltnDt>
<Cdtr>
${PartyIdentification(group.company.party, id=False)}
${PartyIdentification(group.company.party)}
</Cdtr>
<CdtrAcct>
${Account(group.journal.sepa_bank_account_number)}
@@ -66,7 +66,7 @@ this repository contains the full copyright notices and license terms. -->
<!-- UltmtCdtr -->
<ChrgBr>${group.journal.sepa_charge_bearer}</ChrgBr>
<CdtrSchmeId>
${PartyIdentification(group.company.party, name=False)}
${PartyIdentification(group.company.party, id='sepa', with_name=False)}
</CdtrSchmeId>
<DrctDbtTxInf py:for="payment in payments">
<PmtId>