Merge lp:~luc-demeyer/account-financial-tools/7.0-account_pain into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Luc De Meyer (Noviat)
Status: Work in progress
Proposed branch: lp:~luc-demeyer/account-financial-tools/7.0-account_pain
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 2229 lines (+2153/-0)
13 files modified
account_pain/README.txt (+3/-0)
account_pain/__init__.py (+25/-0)
account_pain/__openerp__.py (+65/-0)
account_pain/account_move_line.py (+104/-0)
account_pain/account_pain_wizard.xml (+36/-0)
account_pain/account_payment.py (+233/-0)
account_pain/account_payment_view.xml (+143/-0)
account_pain/i18n/fr.po (+78/-0)
account_pain/i18n/nl.po (+78/-0)
account_pain/wizard/__init__.py (+24/-0)
account_pain/wizard/pain_wizard.py (+303/-0)
account_pain/wizard/payment_order_create.py (+140/-0)
account_pain/xsd/pain.001.001.03.xsd (+921/-0)
To merge this branch: bzr merge lp:~luc-demeyer/account-financial-tools/7.0-account_pain
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Disapprove
Raphaël Valyi - http://www.akretion.com Needs Fixing
Pedro Manuel Baeza Needs Information
Review via email: mp+192256@code.launchpad.net

Description of the change

add support for SEPA payments (ISO 20022)

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Luc, maybe account-payment repository is better for this module?

Regards.

review: Needs Information
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Pedro

I think SEPA-related stuff belongs to the banking-addons https://launchpad.net/banking-addons

By the way, there is already a module for SEPA Credit Transfer in the banking-addons (account_banking_sepa_credit_transfer), so it would be interesting to see if there are some features that are in this module but are not in the module account_banking_sepa_credit_transfer and merge the features of the 2 modules.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Luc,

cool to see Noviat joining the OCA effort. I won't comment functionally but certainly the remarks of Alexis and Pedro are valid.

Technically, there a few caveats that the watchdogs will remind you if I don't, so let's do it:

* please use orm.Model instead of osv.osv which is deprecated now
* also use orm.TransientModel instead of osv.memory
* also you use context={} in methods definitions at lines 309, 324, 327 and 458. You better use the ugly context=None + test against None plumbing instead. Indeed the mutable {} would eventually remain from a method call to another, see http://effbot.org/zone/default-values.htm eventually (Hey but I guess you knew it already).

Regards.

review: Needs Fixing
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Luc,

I gladly welcome the initiative of Noviat of bringing their great modules under the umbrella of the community projects!

With regards to this particular module, I must agree with Alexis that his module overlaps greatly with this module. Now before Stéphane Bidoul made a great effort to decouple the banking addons export modules from the whole bank statement import and reconciliation bit, there would have been a legitimate place for a standalone module like this. But since Alexis' SEPA export module can now also be used with only a very thin boilerplate architecture (account_banking_payment_export), I have to disagree with adopting this module too.

Looking at what this module adds is as announced, heavily biased for Belgium. This is awkward in a module that has potential use in all of Europe, but it would be perfectly alright to refactor them out into a module on top of account_banking_sepa_credit_transfer. Additionally, I see that you allow sale refunds to be selected in the payment order. Given its general usefulness, this should probably be adopted in account_banking_payment_export. Same for improving support for multi-currency environments.

I hope that my review is not discouraging you. Your input is much appreciated, but the point of the community repositories is also to combine focus and avoid double work.

Cheers,
Stefan.

review: Disapprove
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, I told about account-payment repository because I see that this feature is developed following account-payment approach instead of banking-payment, the same as, for example, spanish bank formats export.

Maybe the two approaches can coexist?

Regards.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Pedro,

just to mention: in Brazil we are also account-payment biased so far (we
were inspired by NaN module like 4 years ago now). And we still have to
develop SEPA like format but for Brazil (CNAB). So we have more or less the
same problem as you. I'm not sure yet what approach is the best, but we
should definitely keep convergence in mind with account-payment and
banking-payment. I also mention that it looks that NaN and Ziakzak recently
ported the account-payment approach to Tryton (so they stick we it).

Regards.

On Wed, Oct 23, 2013 at 6:25 AM, Pedro Manuel Baeza
<email address hidden>wrote:

> Hi, I told about account-payment repository because I see that this
> feature is developed following account-payment approach instead of
> banking-payment, the same as, for example, spanish bank formats export.
>
> Maybe the two approaches can coexist?
>
> Regards.
> --
>
> https://code.launchpad.net/~luc-demeyer/account-financial-tools/7.0-account_pain/+merge/192256
> You are reviewing the proposed merge of
> lp:~luc-demeyer/account-financial-tools/7.0-account_pain into
> lp:account-financial-tools.
>

124. By Luc De Meyer

technical update

Revision history for this message
Luc De Meyer (Noviat) (luc-demeyer) wrote :

I updated the https://code.launchpad.net/~luc-demeyer/account-financial-tools/7.0-account_pain branch with the technical changes documented below.

Luc

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Raphaël Valyi - http://www.akretion.com
Sent: woensdag 23 oktober 2013 6:05
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-tools/7.0-account_pain into lp:account-financial-tools

Review: Needs Fixing

Hello Luc,

cool to see Noviat joining the OCA effort. I won't comment functionally but certainly the remarks of Alexis and Pedro are valid.

Technically, there a few caveats that the watchdogs will remind you if I don't, so let's do it:

* please use orm.Model instead of osv.osv which is deprecated now
* also use orm.TransientModel instead of osv.memory
* also you use context={} in methods definitions at lines 309, 324, 327 and 458. You better use the ugly context=None + test against None plumbing instead. Indeed the mutable {} would eventually remain from a method call to another, see http://effbot.org/zone/default-values.htm eventually (Hey but I guess you knew it already).

Regards.

--
https://code.launchpad.net/~luc-demeyer/account-financial-tools/7.0-account_pain/+merge/192256
You are the owner of lp:~luc-demeyer/account-financial-tools/7.0-account_pain.

Revision history for this message
Luc De Meyer (Noviat) (luc-demeyer) wrote :

I am in favor of one SEPA community module in stead of multiple.

Hence the best approach would be to merge the functionality.
After a quick comparison module from Alexis I think it's no too hard to do.
We should merge the functionality which will require some changes to both the 'account_banking_sepa_credit_transfer' as the underlying 'account_banking_payment_export' and allow for SEPA localisation modules on top of the 'account_banking_sepa_credit_transfer'.
Once this is done, we can migrate our 'account_pain' install base to the new module. We are also working on new functionalities and these would than become more widely available.

Alexis, Stefan,

What about a physical meeting where we run through the requirements and after this produce a new version that can be used as well as the basis for other country specific SEPA extensions.
We can host such a session in our Brussels offices (centrally located between France and Holland, I'll pay dinner, lunch, drinks, ... to compensate for your travel costs).

Regards,
Luc

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Raphaël Valyi - http://www.akretion.com
Sent: woensdag 23 oktober 2013 15:24
To: Pedro Manuel Baeza
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-tools/7.0-account_pain into lp:account-financial-tools

Hello Pedro,

just to mention: in Brazil we are also account-payment biased so far (we were inspired by NaN module like 4 years ago now). And we still have to develop SEPA like format but for Brazil (CNAB). So we have more or less the same problem as you. I'm not sure yet what approach is the best, but we should definitely keep convergence in mind with account-payment and banking-payment. I also mention that it looks that NaN and Ziakzak recently ported the account-payment approach to Tryton (so they stick we it).

Regards.

On Wed, Oct 23, 2013 at 6:25 AM, Pedro Manuel Baeza
<email address hidden>wrote:

> Hi, I told about account-payment repository because I see that this
> feature is developed following account-payment approach instead of
> banking-payment, the same as, for example, spanish bank formats export.
>
> Maybe the two approaches can coexist?
>
> Regards.
> --
>
> https://code.launchpad.net/~luc-demeyer/account-financial-tools/7.0-ac
> count_pain/+merge/192256 You are reviewing the proposed merge of
> lp:~luc-demeyer/account-financial-tools/7.0-account_pain into
> lp:account-financial-tools.
>

--
https://code.launchpad.net/~luc-demeyer/account-financial-tools/7.0-account_pain/+merge/192256
You are the owner of lp:~luc-demeyer/account-financial-tools/7.0-account_pain.

125. By Luc De Meyer

technical update

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Here is result of the Akretion-Noviat code sprint on SEPA credit transfer to add the additionnal features of the module account_pain inside the module account_banking_sepa_credit_transfer :

https://code.launchpad.net/~akretion-team/banking-addons/70-akretion-noviat-sepa-sprint

But before I propose this branch for a merge on lp:banking-addons, I will need to have the following MP approved : https://code.launchpad.net/~akretion-team/banking-addons/70-sepa-credit-transfer-update/+merge/194948

Unmerged revisions

125. By Luc De Meyer

technical update

124. By Luc De Meyer

technical update

123. By Luc De Meyer

add account_pain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_pain'
=== added file 'account_pain/README.txt'
--- account_pain/README.txt 1970-01-01 00:00:00 +0000
+++ account_pain/README.txt 2013-10-31 17:26:11 +0000
@@ -0,0 +1,3 @@
1Installation tips
2=================
3
04
=== added file 'account_pain/__init__.py'
--- account_pain/__init__.py 1970-01-01 00:00:00 +0000
+++ account_pain/__init__.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import account_payment
24from . import account_move_line
25from . import wizard
026
=== added file 'account_pain/__openerp__.py'
--- account_pain/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_pain/__openerp__.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,65 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': 'ISO 20022 XML payment files',
24 'version': '0.1',
25 'license': 'AGPL-3',
26 'author': 'Noviat',
27 'category': 'Generic Modules/Accounting',
28 'description': """
29
30ISO 20022 XML payment files
31===========================
32
33Module to generate Customer Credit Transfer Initiation message ISO 20022 XML - pain.001.001.03.
34
35This module implements the following subset of the ISO 20022 specifications:
36
37European Credit Transfers:
38--------------------------
39* debtor and creditor account in SEPA countries
40* debtor account in Company currency
41* creditor account in Company currency
42* creditor account identified by BIC & IBAN
43* support for single payments
44
45The module also prohibits the removal of a confirmed Payment Order.
46Such a removal is still possible via the 'Undo Payment' button available to users of the 'Accounting / Manager' group.
47
48Features targeted for the Belgian market (cf. febelfin guidelines):
49
50* creditor account identified by IBAN (without BIC) for BE IBAN accounts
51* support for belgian structured communication format
52* by default, the right part of the VAT number (KBO/BCE number) is used to identify the Initiating Party
53
54 """,
55 'depends': ['account','base_iban', 'account_payment'],
56 'demo_xml': [],
57 'init_xml': [],
58 'update_xml' : [
59# 'security/ir.model.access.csv',
60 'account_pain_wizard.xml',
61 'account_payment_view.xml',
62 ],
63 'active': False,
64 'installable': True,
65}
066
=== added file 'account_pain/account_move_line.py'
--- account_pain/account_move_line.py 1970-01-01 00:00:00 +0000
+++ account_pain/account_move_line.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,104 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tools.translate import _
24from openerp.osv import fields, orm
25from operator import itemgetter
26import logging
27_logger = logging.getLogger(__name__)
28
29class account_move_line(orm.Model):
30 _inherit = "account.move.line"
31
32 def amount_to_pay(self, cr, uid, ids, name, arg={}, context=None):
33 """ Return the amount still to pay regarding all the payment orders
34 (excepting cancelled orders)"""
35 if not ids:
36 return {}
37 amounts_residual = self.read(cr, uid, ids, ['amount_residual'], context=context)
38 cr.execute("""SELECT ml.id,
39 (SELECT coalesce(sum(amount_currency),0)
40 FROM payment_line pl
41 INNER JOIN payment_order po
42 ON (pl.order_id = po.id)
43 WHERE move_line_id = ml.id
44 AND po.state != 'cancel') AS pl_amount
45 FROM account_move_line ml
46 WHERE id IN %s""", (tuple(ids),))
47 amounts_paylines = dict(cr.fetchall())
48 amounts_to_pay = {}
49 for entry in amounts_residual:
50 k = entry['id']
51 v = entry['amount_residual'] - amounts_paylines[k]
52 amounts_to_pay[k] = v
53 return amounts_to_pay
54
55 def _to_pay_search(self, cr, uid, obj, name, args, context=None):
56 if not args:
57 return []
58 if not context: context={}
59 context['all_fiscalyear'] = True
60 line_obj = self.pool.get('account.move.line')
61 query = line_obj._query_get(cr, uid, context={})
62 query += 'AND l.blocked = False '
63 where = ' and '.join(map(lambda x: '''(SELECT
64 CASE WHEN l.amount_currency < 0
65 THEN - l.amount_currency
66 ELSE l.credit
67 END - coalesce(sum(pl.amount_currency), 0)
68 FROM payment_line pl
69 INNER JOIN payment_order po ON (pl.order_id = po.id)
70 WHERE move_line_id = l.id
71 AND po.state != 'cancel'
72 ) %(operator)s %%s ''' % {'operator': x[1]}, args))
73 sql_args = tuple(map(itemgetter(2), args))
74
75 cr.execute(('''SELECT id
76 FROM account_move_line l
77 WHERE account_id IN (select id
78 FROM account_account
79 WHERE type in %s AND active)
80 AND reconcile_id IS null
81 AND credit > 0
82 AND ''' + where + ' AND ' + query), (('payable','receivable'),)+sql_args ) # fix Noviat to include sale refunds
83
84 res = cr.fetchall()
85 if not res:
86 return [('id', '=', '0')]
87 return [('id', 'in', map(lambda x:x[0], res))]
88
89 _columns = {
90 'amount_to_pay': fields.function(amount_to_pay, method=True,
91 type='float', string='Amount to pay', fnct_search=_to_pay_search),
92 }
93
94 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
95 if view_type == 'tree':
96 mod_obj = self.pool.get('ir.model.data')
97 if context is None:
98 context = {}
99 if context.get('account_payment', False):
100 model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_move_line_tree_account_pain')], context=context)
101 view_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
102 return super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
103
104# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0105
=== added file 'account_pain/account_pain_wizard.xml'
--- account_pain/account_pain_wizard.xml 1970-01-01 00:00:00 +0000
+++ account_pain/account_pain_wizard.xml 2013-10-31 17:26:11 +0000
@@ -0,0 +1,36 @@
1<?xml version="1.0" ?>
2<openerp>
3 <data>
4
5 <record id="account_pain_save_view" model="ir.ui.view">
6 <field name="name">ISO 20022 payment file</field>
7 <field name="model">account.pain.create</field>
8 <field name="priority">1</field>
9 <field name="arch" type="xml">
10 <form string="The ISO 20022 payment file has been created" version="7.0">
11 <p>Click on link below to download the XML File</p>
12 <p>
13 <b>
14 <field name="pain_data" readonly="1" filename="pain_fname"/>
15 <field name="pain_fname" invisible="1"/>
16 </b>
17 </p>
18 <separator colspan="4"/>
19 <field name="note" colspan="4" attrs="{'invisible':[('note','=',False)]}"/>
20 <separator colspan="4"/>
21 </form>
22 </field>
23 </record>
24
25 <record id="action_account_pain_create" model="ir.actions.act_window">
26 <field name="name">The ISO 20022 payment file has been created</field>
27 <field name="type">ir.actions.act_window</field>
28 <field name="res_model">account.pain.create</field>
29 <field name="view_type">form</field>
30 <field name="view_mode">form</field>
31 <field name="view_id" ref="account_pain_save_view"/>
32 <field name="target">new</field>
33 </record>
34
35 </data>
36</openerp>
037
=== added file 'account_pain/account_payment.py'
--- account_pain/account_payment.py 1970-01-01 00:00:00 +0000
+++ account_pain/account_payment.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,233 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tools.translate import _
24from openerp.osv import fields, orm
25
26from openerp import netsvc
27import re
28import logging
29_logger = logging.getLogger(__name__)
30
31def check_bba_comm(val):
32 supported_chars = '0-9+*/ '
33 pattern = re.compile('[^' + supported_chars + ']')
34 if pattern.findall(val or ''):
35 return False
36 bbacomm = re.sub('\D', '', val or '')
37 if len(bbacomm) == 12:
38 base = int(bbacomm[:10])
39 mod = base % 97 or 97
40 if mod == int(bbacomm[-2:]):
41 return True
42 return False
43
44class payment_mode(orm.Model):
45 _inherit= 'payment.mode'
46
47 def _initiatingparty_default(self, cr, uid, field, context=None):
48 #_logger.warn('_initiatingparty_default, field=%s, context=%s', field, context)
49 company = self.pool.get('res.users').browse(cr, uid, uid).company_id
50 vat = company.partner_id.vat
51 # Belgium, febelfin specs
52 if vat and vat[0:2].upper() == 'BE':
53 kbo_nr = vat[2:].replace(' ','')
54 if field == 'id':
55 return kbo_nr
56 else:
57 return 'KBO-BCE'
58 else:
59 # complete for other countries
60 return False
61
62 def _initiatingparty_id_default(self, cr, uid, context=None):
63 return self._initiatingparty_default(cr, uid, 'id', context=context)
64
65 def _initiatingparty_issr_default(self, cr, uid, context=None):
66 return self._initiatingparty_default(cr, uid, 'issr', context=context)
67
68 _columns = {
69 'type': fields.selection([
70 ('manual', 'Manual'),
71 ('iso20022', 'ISO 20022')],
72 'Type', select=1,
73 help='Select the Payment Type for the Payment Mode.'),
74 'bank_id': fields.many2one('res.partner.bank', "Bank account",
75 required=False, help='Bank Account for the Payment Mode'),
76 'initgpty_id': fields.char('Initiating Party Id', size=35,
77 help="Identifier of the Initiating Party."
78 "\nSpecify KBO-BCE number for Belgium."
79 "\n(Field: InitgPty.Id.OrgId.Othr.Id)"),
80 'initgpty_issr': fields.char('Initiating Party Id Issuer', size=35,
81 help="Issuer of the Identifier of the Initiating Party."
82 "\nSpecify 'KBO-BCE' for Belgium."
83 "\n(Field: InitgPty.Id.OrgId.Othr.Issr)"),
84 }
85 _defaults = {
86 'initgpty_id': _initiatingparty_id_default,
87 'initgpty_issr': _initiatingparty_issr_default,
88 }
89
90 def _check_initiatingparty_id(self, cr, uid, ids, context=None):
91 pm = self.browse(cr, uid, ids[0], context=context)
92 if pm.initgpty_issr and not pm.initgpty_id:
93 return False
94 return True
95
96 _constraints = [
97 (_check_initiatingparty_id, "Configuration Error! Please complete the 'Initiating Party Id' field.", ['initgpty_id'])
98 ]
99
100class payment_order(orm.Model):
101 _inherit = 'payment.order'
102
103 def get_wizard(self, type):
104 if type == 'iso20022':
105 return 'account_pain','action_account_pain_create'
106 else:
107 return super(payment_order, self).get_wizard(type)
108
109 def action_open(self, cr, uid, ids, *args):
110 for payment in self.browse(cr, uid, ids):
111 for line in payment.line_ids:
112 if line.amount_currency <= 0:
113 raise orm.except_orm(_('Payment Instruction Error!'),
114 _("Unsupported Payment Instruction in Payment Line %s.\n" \
115 "The value '%s' is less than the minimum value allowed.")
116 % (line.name, line.amount_currency))
117 return super(payment_order, self).action_open(cr, uid, ids, *args)
118
119 def unlink(self, cr, uid, ids, context=None):
120 for order in self.browse(cr, uid, ids, context=context):
121 if order.state == 'done':
122 raise orm.except_orm(_('Error'),
123 _("You can not remove a Payment Order that has already been processed !" \
124 "\nIf such an action is required, you should first cancel the Order."))
125 return super(payment_order, self).unlink(cr, uid, ids, context=context)
126
127 def button_undo_payment(self, cr, uid, ids, context=None):
128 att_obj = self.pool.get('ir.attachment')
129 for order in self.browse(cr, uid, ids, context=context):
130 att_ids = att_obj.search(cr, uid, [('res_model', '=', 'payment.order'), ('res_id', '=', order.id)])
131 if att_ids:
132 att_obj.unlink(cr, uid, att_ids)
133 self.write(cr, uid, order.id, {'state': 'draft'})
134 wf_service = netsvc.LocalService("workflow")
135 wf_service.trg_delete(uid, 'payment.order', order.id, cr)
136 wf_service.trg_create(uid, 'payment.order', order.id, cr)
137 return True
138
139class payment_line(orm.Model):
140 _inherit = 'payment.line'
141
142 def _get_struct_comm_types(self, cr, uid, context=None):
143 res = self.pool.get('account.invoice').fields_get(cr, uid, ['reference_type'], context)['reference_type']['selection']
144 res.pop([i for i,x in enumerate(res) if x[0] == 'none'][0])
145 bba_list = [i for i,x in enumerate(res) if x[0] == 'bba']
146 if not bba_list:
147 res.append(('bba', 'BBA Structured Communication'))
148 return res
149
150 def _check_communication(self, cr, uid, ids):
151 for line in self.browse(cr, uid, ids):
152 if line.state == 'structured':
153 if line.struct_comm_type == 'bba':
154 return check_bba_comm(line.communication)
155 return True
156
157 def fields_get(self, cr, uid, fields=None, context=None):
158 fields = super(payment_line,self).fields_get(cr, uid, fields, context)
159 if context is None:
160 context = {}
161 if context.get('payment_line_readonly'):
162 for field in fields:
163 fields[field]['readonly'] = True
164 return fields
165
166 def unlink(self, cr, uid, ids, context=None):
167 if context is None:
168 context = {}
169 if context.get('payment_line_readonly'):
170 raise orm.except_orm(_('Warning'), _('Delete operation not allowed !' \
171 '\nPlease go to the associated Payment Order in order to delete this payment line'))
172 return super(payment_line, self).unlink(cr, uid, ids, context=context)
173
174 def create(self, cr, uid, vals, context=None):
175 # copy structured communication of payment line is created by referencing an invoice
176 if vals.has_key('move_line_id') and vals['move_line_id']:
177 move_line = self.pool.get('account.move.line').browse(cr, uid, vals['move_line_id'], context)
178 inv = move_line.invoice
179 if inv and inv.reference_type != 'none':
180 vals['state'] = 'structured'
181 vals['struct_comm_type'] = inv.reference_type
182 vals['communication'] = inv.reference
183 # verify correctness of bba structured communication when created via the payment line form
184 if vals.has_key('state') and (vals['state'] == 'structured'):
185 if vals.has_key('struct_comm_type') and (vals['struct_comm_type'] == 'bba'):
186 if vals.has_key('communication'):
187 bbacomm = vals['communication']
188 if check_bba_comm(bbacomm):
189 bbacomm = re.sub('\D', '', bbacomm)
190 vals['communication'] = '+++' + bbacomm[0:3] + '/' + bbacomm[3:7] + '/' + bbacomm[7:] + '+++'
191 else:
192 raise orm.except_orm(_('Payment Instruction Error!'),
193 _('Invalid BBA Structured Communication in Payment Line %s , please correct !') % vals['name'])
194 return super(payment_line, self).create(cr, uid, vals, context=context)
195
196 def write(self, cr, uid, ids, vals, context=None):
197 if type(ids) is int:
198 ids = [ids]
199 for line in self.browse(cr, uid, ids, context):
200 vals2 = vals.copy()
201 if vals.has_key('state'):
202 line_state = vals['state']
203 else:
204 line_state = line.state
205 if line_state == 'structured':
206 if vals.has_key('struct_comm_type'):
207 struct_comm_type = vals['struct_comm_type']
208 else:
209 struct_comm_type = line.struct_comm_type or ''
210 if struct_comm_type == 'bba':
211 if vals.has_key('communication'):
212 bbacomm = vals['communication']
213 else:
214 bbacomm = line.communication or ''
215 if check_bba_comm(bbacomm):
216 bbacomm = re.sub('\D', '', bbacomm)
217 vals2['communication'] = '+++' + bbacomm[0:3] + '/' + bbacomm[3:7] + '/' + bbacomm[7:] + '+++'
218 else:
219 raise orm.except_orm(_('Payment Instruction Error!'),
220 _('Invalid BBA Structured Communication in Payment Line %s , please correct !') % line.name)
221 super(payment_line, self).write(cr, uid, [line.id], vals2, context)
222 return True
223
224 _columns = {
225 'name': fields.char('Payment Line Ref.', size=64, required=True),
226 'state': fields.selection([('normal','Free Communication'), ('structured','Structured Communication')], 'Communication Type', required=True),
227 'struct_comm_type': fields.selection(_get_struct_comm_types, 'Structured Communication Type'),
228 }
229 _constraints = [
230 (_check_communication, 'Invalid BBA Structured Communication !', ['Communication']),
231 ]
232
233# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file234\ No newline at end of file
1235
=== added file 'account_pain/account_payment_view.xml'
--- account_pain/account_payment_view.xml 1970-01-01 00:00:00 +0000
+++ account_pain/account_payment_view.xml 2013-10-31 17:26:11 +0000
@@ -0,0 +1,143 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_payment_line_search" model="ir.ui.view">
6 <field name="name">payment.line.tree.search</field>
7 <field name="model">payment.line</field>
8 <field name="arch" type="xml">
9 <search string="Search Payment Lines">
10 <group>
11 <field name="order_id"/>
12 <field name="ml_inv_ref"/>
13 <field name="ml_maturity_date"/>
14 <field name="partner_id" select="1"/>
15 <field name="communication"/>
16 <field name="amount"/>
17 <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
18 <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
19 <field name="create_date"/>
20 <field name="name"/>
21 </group>
22 <newline/>
23 <group expand="0" string="Group By...">
24 <filter string="Payment Mode" context="{'group_by': 'bank_id'}" icon="terp-dolar"/>
25 </group>
26 </search>
27 </field>
28 </record>
29
30 <record id="action_payment_line_tree" model="ir.actions.act_window">
31 <field name="name">Payment Lines</field>
32 <field name="res_model">payment.line</field>
33 <field name="view_type">form</field>
34 <field name="view_mode">tree,form</field>
35 <field name="search_view_id" ref="view_payment_line_search"/>
36 <field name="view_id" ref="account_payment.view_payment_line_tree"/>
37 <field name="context">{'payment_line_readonly':1}</field>
38 </record>
39 <menuitem action="action_payment_line_tree" id="menu_action_payment_line" parent="account_payment.menu_main_payment" sequence="4"/>
40
41 <act_window domain="[('move_line_id.move_id.id', '=', move_id)]"
42 id="act_account_invoice_2_payment_line"
43 name="Payment Lines"
44 view_type="form"
45 context="{'payment_line_readonly':1}"
46 res_model="payment.line" src_model="account.invoice"/>
47
48
49 <record id="account_payment.action_create_payment_order" model="ir.actions.act_window">
50 <field name="view_id" ref="account_payment.view_create_payment_order"/>
51 </record>
52
53 <!-- change compared to view in account payment : 'name'-field replaced by 'invoice'-field -->
54 <record model="ir.ui.view" id="view_move_line_tree_account_pain">
55 <field name="name">account.pain.move.line.tree</field>
56 <field name="model">account.move.line</field>
57 <field name="priority" eval="1"/>
58 <field name="arch" type="xml">
59 <tree string="Account Entry Line">
60 <field name="partner_id"/>
61 <field name="ref"/>
62 <field name="invoice"/>
63 <field name="journal_id"/>
64 <field name="account_id"/>
65 <field name="date_maturity"/>
66 <field name="date"/>
67 <field name="debit" sum="Total debit"/>
68 <field name="credit" sum="Total credit"/>
69 <field name="amount_to_pay"/>
70 <field name="amount_currency"/>
71 <field name="currency_id"/>
72 <field name="period_id" invisible="1"/>
73 </tree>
74 </field>
75 </record>
76
77 <record id="view_payment_order_form_inherit" model="ir.ui.view">
78 <field name="name">payment.order.form.inherit</field>
79 <field name="model">payment.order</field>
80 <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
81 <field name="arch" type="xml">
82 <data>
83 <xpath expr="//field[@name='line_ids']//page[@string='Payment']//field[@name='state']" position="after">
84 <group colspan="4" attrs="{'invisible':[('state','=','normal')]}">
85 <field name="struct_comm_type" attrs="{'required':[('state','=','structured')]}"/>
86 </group>
87 </xpath>
88 <button name="cancel" position="after">
89 <button name="button_undo_payment" states="done" string="Undo Payment" type="object" groups="account.group_account_manager" icon="gtk-cancel"/>
90 </button>
91 <button name="set_done" position="replace">
92 <button name="%(account_payment.action_account_payment_make_payment)d" states="open" string="Make Payments" type="action" icon="gtk-execute"/>
93 </button>
94 </data>
95 </field>
96 </record>
97
98 <record id="view_payment_mode_search_inherit" model="ir.ui.view">
99 <field name="name">payment.mode.search.inherit</field>
100 <field name="model">payment.mode</field>
101 <field name="inherit_id" ref="account_payment.view_payment_mode_search"/>
102 <field name="arch" type="xml">
103 <field name="journal" position="after">
104 <field name="type"/>
105 </field>
106 </field>
107 </record>
108
109 <record id="view_payment_mode_tree_inherit" model="ir.ui.view">
110 <field name="name">payment.mode.tree.inherit</field>
111 <field name="model">payment.mode</field>
112 <field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
113 <field name="arch" type="xml">
114 <field name="journal" position="after">
115 <field name="type"/>
116 </field>
117 </field>
118 </record>
119
120 <record id="view_payment_mode_form_inherit" model="ir.ui.view">
121 <field name="name">payment.mode.form.inherit</field>
122 <field name="model">payment.mode</field>
123 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
124 <field name="arch" type="xml">
125 <field name="journal" position="after">
126 <field name="type"/>
127 </field>
128 <field name="bank_id" position="attributes">
129 <attribute name="attrs">{'required':[('type','=','iso20022')]}</attribute>
130 </field>
131 <field name="bank_id" position="after">
132 <field name="initgpty_id" attrs="{'invisible':[('type','!=','iso20022')]}"/>
133 <field name="initgpty_issr" attrs="{'invisible':[('type','!=','iso20022')]}"/>
134 </field>
135 <!--correct partner_id field for GTK client -->
136 <field name="partner_id" position="replace">
137 <field name="partner_id" invisible="1"/>
138 </field>
139 </field>
140 </record>
141
142 </data>
143</openerp>
0144
=== added directory 'account_pain/i18n'
=== added file 'account_pain/i18n/fr.po'
--- account_pain/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ account_pain/i18n/fr.po 2013-10-31 17:26:11 +0000
@@ -0,0 +1,78 @@
1# French translation of openobject-addons.
2# This file contains the translation of the following modules:
3# * account_pain
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: openobject-addons\n"
8"Report-Msgid-Bugs-To: support@noviat.be\n"
9"POT-Creation-Date: 2011-03-24 11:18:30.714000\n"
10"PO-Revision-Date: 2011-03-24 11:18:30.714000\n"
11"Last-Translator: Luc De Meyer (Noviat nv/sa)\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16
17#. module: account_pain
18#: view:account.pain.create:0
19msgid "The ISO 20022 payment file has been created"
20msgstr "Le fichier de paiement ISO 20022 est généré"
21
22#. module: account_pain
23#: view:account.pain.create:0
24msgid "Click on 'Save as' to save the file on your local disk."
25msgstr "Sélectionnez 'Enregistrer sous' pour sauvegarder le fichier sur votre disque local."
26
27#. module: account_pain
28#: field:account.pain.create,pain_data:0
29msgid "Payment File"
30msgstr "Fichier de paiement"
31
32#. module: account_pain
33#: field:account.pain.create,pain_fname:0
34msgid "Filename"
35msgstr "Nom du fichier"
36
37#. module: account_pain
38#: field:account.pain.create,note:0
39msgid "Remarks"
40msgstr "Remarques"
41
42#. module: account_pain
43#: code:addons/account_pain/wizard/pain_wizard.py:0
44#, python-format
45msgid "Warning:\n"
46msgstr "Alerte:\n"
47
48#. module: account_pain
49#: code:addons/account_pain/wizard/pain_wizard.py:0
50#, python-format
51msgid "\nThe Payment Date on Payment Line %s has been changed."
52msgstr "\nLa date de paiement du ligne de paiement %s a changé."
53
54#. module: account_pain
55#: field:payment.line,name:0
56msgid "Payment Line Ref."
57msgstr "Ref. ligne de paiement"
58
59#. module: account_pain
60#: field:payment.line,struct_comm_type:0
61msgid "Structured Communication Type"
62msgstr "Type de communication structurée"
63
64#. module: account_pain
65#: selection:payment.line,struct_comm_type:0
66msgid "BBA Structured Communication"
67msgstr "Communication structurée belge (BBA)"
68
69#. module: account_pain
70#: selection:payment.line,state:0
71msgid "Free Communication"
72msgstr "Communication libre"
73
74#. module: account_pain
75#: selection:payment.line,state:0
76msgid "Structured Communication"
77msgstr "Communication structurée"
78
079
=== added file 'account_pain/i18n/nl.po'
--- account_pain/i18n/nl.po 1970-01-01 00:00:00 +0000
+++ account_pain/i18n/nl.po 2013-10-31 17:26:11 +0000
@@ -0,0 +1,78 @@
1# Dutch translation of openobject-addons.
2# This file contains the translation of the following modules:
3# * account_pain
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: openobject-addons\n"
8"Report-Msgid-Bugs-To: support@noviat.be\n"
9"POT-Creation-Date: 2011-03-24 11:18:30.654000\n"
10"PO-Revision-Date: 2011-03-24 11:18:30.654000\n"
11"Last-Translator: Luc De Meyer (Noviat nv/sa)\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16
17#. module: account_pain
18#: view:account.pain.create:0
19msgid "The ISO 20022 payment file has been created"
20msgstr "Het ISO 20022 betalingsbestand is aangemaakt"
21
22#. module: account_pain
23#: view:account.pain.create:0
24msgid "Click on 'Save as' to save the file on your local disk."
25msgstr "Selecteer 'Opslaan als' om dit bestand te bewaren op je lokale schijf."
26
27#. module: account_pain
28#: field:account.pain.create,pain_data:0
29msgid "Payment File"
30msgstr "Betalingsbestand"
31
32#. module: account_pain
33#: field:account.pain.create,pain_fname:0
34msgid "Filename"
35msgstr "Bestandsnaam"
36
37#. module: account_pain
38#: field:account.pain.create,note:0
39msgid "Remarks"
40msgstr "Opmerkingen"
41
42#. module: account_pain
43#: code:addons/account_pain/wizard/pain_wizard.py:0
44#, python-format
45msgid "Warning:\n"
46msgstr "Waarschuwing:\n"
47
48#. module: account_pain
49#: code:addons/account_pain/wizard/pain_wizard.py:0
50#, python-format
51msgid "\nThe Payment Date on Payment Line %s has been changed."
52msgstr "\nDe betaaldatum van betaalregel %s is aangepast."
53
54#. module: account_pain
55#: field:payment.line,name:0
56msgid "Payment Line Ref."
57msgstr "Ref. Betaalregel"
58
59#. module: account_pain
60#: field:payment.line,struct_comm_type:0
61msgid "Structured Communication Type"
62msgstr "Type gestructureerde mededeling"
63
64#. module: account_pain
65#: selection:payment.line,struct_comm_type:0
66msgid "BBA Structured Communication"
67msgstr "Belgische gestructureerde mededeling (BBA)"
68
69#. module: account_pain
70#: selection:payment.line,state:0
71msgid "Free Communication"
72msgstr "Vrije mededeling"
73
74#. module: account_pain
75#: selection:payment.line,state:0
76msgid "Structured Communication"
77msgstr "Gestructureerde mededeling"
78
079
=== added directory 'account_pain/static'
=== added directory 'account_pain/static/src'
=== added directory 'account_pain/static/src/img'
=== added file 'account_pain/static/src/img/icon.png'
1Binary files account_pain/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_pain/static/src/img/icon.png 2013-10-31 17:26:11 +0000 differ80Binary files account_pain/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_pain/static/src/img/icon.png 2013-10-31 17:26:11 +0000 differ
=== added directory 'account_pain/wizard'
=== added file 'account_pain/wizard/__init__.py'
--- account_pain/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ account_pain/wizard/__init__.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,24 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import payment_order_create
24from . import pain_wizard
0\ No newline at end of file25\ No newline at end of file
126
=== added file 'account_pain/wizard/pain_wizard.py'
--- account_pain/wizard/pain_wizard.py 1970-01-01 00:00:00 +0000
+++ account_pain/wizard/pain_wizard.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,303 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tools.translate import _
24from openerp.osv import fields, orm
25import re
26import time
27import base64
28from StringIO import StringIO
29from lxml import etree
30import tools
31import logging
32_logger = logging.getLogger(__name__)
33
34class account_payment_make_payment(orm.TransientModel):
35 _inherit = 'account.payment.make.payment'
36
37 def launch_wizard(self, cr, uid, ids, context=None):
38 """
39 Search for a wizard to launch according to the type.
40 Confirm the order without wizard if type is manual.
41 """
42 if context is None:
43 context = {}
44 obj_payment_order = self.pool.get('payment.order')
45 obj_model = self.pool.get('ir.model.data')
46 obj_act = self.pool.get('ir.actions.act_window')
47 order = obj_payment_order.browse(cr, uid, context['active_id'], context)
48 payment_type = order.mode and order.mode.type or 'manual'
49 gw = obj_payment_order.get_wizard(payment_type)
50 if (not gw) or (payment_type == 'manual'):
51 obj_payment_order.set_done(cr, uid, [context['active_id']], context)
52 return {'type': 'ir.actions.act_window_close'}
53
54 # add support community modules using the payment gateway wizard plugin
55 module, wizard = gw
56 result = obj_model._get_id(cr, uid, module, wizard)
57 wiz_id = obj_model.read(cr, uid, [result], ['res_id'])[0]['res_id']
58 if payment_type != 'iso20022':
59 return_act = obj_act.read(cr, uid, [wiz_id])[0]
60 return_act.update({'context': context})
61 return return_act
62
63 # generate ISO 20022 XML
64 data = self.generate_pain(cr, uid, context)
65 apc_id = self.pool.get('account.pain.create').create(cr, uid, data)
66 obj_model = self.pool.get('ir.model.data')
67 model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'), ('name','=','account_pain_save_view')])
68 resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
69 return {
70 'name': _('The ISO 20022 payment file has been created'),
71 'view_type': 'form',
72 'view_mode': 'form',
73 'res_model': 'account.pain.create',
74 'res_id': apc_id,
75 'views': [(resource_id, 'form')],
76 'type': 'ir.actions.act_window',
77 'target': 'new',
78 'context': context,
79 }
80
81 def format_comm(self, comm):
82 bbacomm = re.sub('\D', '', comm)
83 if len(bbacomm) == 12:
84 base = int(bbacomm[:10])
85 mod = base % 97 or 97
86 if mod == int(bbacomm[-2:]):
87 return bbacomm
88 return False
89
90 def generate_pain(self, cr, uid, context):
91 if not context:
92 context = {}
93 active_id = context.get('active_id', [])
94
95 payment_obj = self.pool.get('payment.order')
96 payment_line_obj = self.pool.get('payment.line')
97 attachment_obj = self.pool.get('ir.attachment')
98 payment_line_obj = self.pool.get('payment.line')
99 note = ''
100
101 payment = payment_obj.browse(cr, uid, active_id, context=context)
102 payment_mode = payment.mode
103 pain_fname = re.sub('\W', '_', payment.reference).lower() + '.xml'
104 company = self.pool.get('res.users').browse(cr, uid, uid).company_id
105 if not (payment_mode.bank_id.bank_bic or payment_mode.bank_id.bank.bic):
106 raise orm.except_orm(_('Configuration Error!'),
107 _("Please fill in the BIC code of the Bank Debtor Account for this Payment Order!"))
108 if not payment.line_ids:
109 raise orm.except_orm(_('Data Error!'),
110 _("Your Payment Order does not contain payment instructions!"))
111 if payment_mode.journal.currency and (payment_mode.journal.currency != company.currency_id):
112 raise orm.except_orm(_('Payment Order Error!'),
113 _('Only payments from a bank account in company currency are supported in the current release ' \
114 'of the ISO 20022 payment module!'))
115
116 # create XML
117 ns_map = {
118 None: 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03',
119 'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
120 }
121 pain = etree.Element('Document', nsmap = ns_map)
122 CstmrCdtTrfInitn = etree.SubElement(pain, 'CstmrCdtTrfInitn')
123 # GroupHeader
124 GrpHdr = etree.SubElement(CstmrCdtTrfInitn, 'GrpHdr')
125 MsgId = etree.SubElement(GrpHdr, 'MsgId')
126 MsgId.text = payment.reference
127 CreDtTm = etree.SubElement(GrpHdr, 'CreDtTm')
128 CreDtTm.text = time.strftime('%Y-%m-%dT%H:%M:%S')
129 NbOfTxs = etree.SubElement(GrpHdr, 'NbOfTxs')
130 NbOfTxs.text = str(len(payment.line_ids))
131 CtrlSum = etree.SubElement(GrpHdr, 'CtrlSum')
132 CtrlSum.text = '%.2f' % payment.total
133 InitgPty = etree.SubElement(GrpHdr, 'InitgPty')
134 Nm = etree.SubElement(InitgPty, 'Nm')
135 Nm.text = company.name
136 if payment_mode.initgpty_id:
137 Id = etree.SubElement(InitgPty, 'Id')
138 OrgId = etree.SubElement(Id, 'OrgId')
139 Othr = etree.SubElement(OrgId, 'Othr')
140 Id = etree.SubElement(Othr, 'Id')
141 Id.text = payment_mode.initgpty_id
142 if payment_mode.initgpty_issr:
143 Issr = etree.SubElement(Othr, 'Issr')
144 Issr.text = payment_mode.initgpty_issr
145 # PaymentInformation
146 payment_method = 'TRF'
147 for line in payment.line_ids:
148 if line.currency != company.currency_id:
149 raise orm.except_orm(_('Payment Instruction Error!'),
150 _('Unsupported Payment Instruction in Payment Line %s.\n' \
151 'Only payments in company currency are supported in the current release ' \
152 'of the ISO 20022 payment module!') % line.name)
153 if not line.amount:
154 raise orm.except_orm(_('Payment Instruction Error!'),
155 _('Payment Instruction Error in Payment Line %s.\n' \
156 'Please fill in the transaction amount!') %line.name)
157 if not (line.bank_id and line.bank_id.iban):
158 raise orm.except_orm(_('Payment Instruction Error!'),
159 _('Unsupported Payment Instruction in Payment Line %s.\n' \
160 'Please fill in the IBAN number of the Bank Creditor Account for this Payment Line!') % line.name)
161
162 if payment.date_prefered == 'now':
163 execution_date = time.strftime('%Y-%m-%d')
164 elif payment.date_prefered == 'fixed':
165 execution_date = payment.date_scheduled
166 elif payment.date_prefered == 'due':
167 if not line.date:
168 if line.ml_maturity_date:
169 excution_date = ml_maturity_date
170 else:
171 execution_date = time.strftime('%Y-%m-%d')
172 else:
173 execution_date = line.date
174 else:
175 raise orm.except_orm(_('Unsupported Payment Order Option!'),
176 _("Please ensure that the 'Preferred date' is equal to 'Due date', 'Directly' or 'Fixed date'!"))
177 if execution_date < time.strftime('%Y-%m-%d'):
178 execution_date = time.strftime('%Y-%m-%d')
179 if line.date != execution_date:
180 note += _('\nThe Payment Date on Payment Line %s has been changed.') % line.name
181 payment_line_obj.write(cr, uid, line.id, {'date': execution_date})
182
183 PmtInf = etree.SubElement(CstmrCdtTrfInitn, 'PmtInf')
184 PmtInfId = etree.SubElement(PmtInf, 'PmtInfId')
185 PmtInfId.text = line.name
186 PmtMtd = etree.SubElement(PmtInf, 'PmtMtd')
187 PmtMtd.text = payment_method
188 BtchBookg = etree.SubElement(PmtInf, 'BtchBookg')
189 BtchBookg.text = 'false'
190 if payment_method == 'TRF':
191 PmtTpInf = etree.SubElement(PmtInf, 'PmtTpInf')
192 InstrPrty = etree.SubElement(PmtTpInf, 'InstrPrty')
193 InstrPrty.text = 'NORM'
194 SvcLvl = etree.SubElement(PmtTpInf, 'SvcLvl')
195 Cd = etree.SubElement(SvcLvl, 'Cd')
196 Cd.text = 'SEPA'
197 ReqdExctnDt = etree.SubElement(PmtInf, 'ReqdExctnDt')
198 ReqdExctnDt.text = execution_date
199 Dbtr = etree.SubElement(PmtInf, 'Dbtr')
200 Nm = etree.SubElement(Dbtr, 'Nm')
201 Nm.text = company.name
202 DbtrAcct = etree.SubElement(PmtInf, 'DbtrAcct')
203 Id = etree.SubElement(DbtrAcct, 'Id')
204 IBAN = etree.SubElement(Id, 'IBAN')
205 IBAN.text = payment_mode.bank_id.iban.upper().replace(' ','')
206 DbtrAgt = etree.SubElement(PmtInf, 'DbtrAgt')
207 FinInstnId = etree.SubElement(DbtrAgt, 'FinInstnId')
208 BIC = etree.SubElement(FinInstnId, 'BIC')
209 BIC.text = re.sub('\s','',payment_mode.bank_id.bank_bic.upper() or payment_mode.bank_id.bank.bic.upper())
210 ChrgBr = etree.SubElement(PmtInf, 'ChrgBr')
211 ChrgBr.text = 'SLEV'
212 CdtTrfTxInf = etree.SubElement(PmtInf, 'CdtTrfTxInf')
213 PmtId = etree.SubElement(CdtTrfTxInf, 'PmtId')
214 EndToEndId = etree.SubElement(PmtId, 'EndToEndId')
215 EndToEndId.text = line.name
216 Amt = etree.SubElement(CdtTrfTxInf, 'Amt')
217 InstdAmt = etree.SubElement(Amt, 'InstdAmt', Ccy=line.currency.name)
218 InstdAmt.text = '%.2f' % line.amount
219 if line.bank_id.iban[0:2].upper() not in ['BE']: # to be completed with other countries allowing payments without BIC
220 if not (line.bank_id.bank_bic or line.bank_id.bank.bic):
221 raise orm.except_orm(_('Configuration Error!'),
222 _('Unsupported Payment Instruction in Payment Line %s.\n' \
223 'Please fill in the BIC code of the Bank Creditor Account for this Payment Line!') % line.name)
224 if line.bank_id.bank_bic or line.bank_id.bank.bic:
225 CdtrAgt = etree.SubElement(CdtTrfTxInf, 'CdtrAgt')
226 FinInstnId = etree.SubElement(CdtrAgt, 'FinInstnId')
227 BIC = etree.SubElement(FinInstnId, 'BIC')
228 BIC.text = re.sub('\s','',line.bank_id.bank_bic.upper() or line.bank_id.bank.bic.upper())
229 Cdtr = etree.SubElement(CdtTrfTxInf, 'Cdtr')
230 Nm = etree.SubElement(Cdtr, 'Nm')
231 Nm.text = line.partner_id.name
232 CdtrAcct = etree.SubElement(CdtTrfTxInf, 'CdtrAcct')
233 Id = etree.SubElement(CdtrAcct, 'Id')
234 IBAN = etree.SubElement(Id, 'IBAN')
235 IBAN.text = line.bank_id.iban.upper().replace(' ','')
236 if line.communication:
237 comm = line.communication
238 if line.communication2:
239 comm += ' ' + line.communication2
240 RmtInf = etree.SubElement(CdtTrfTxInf, 'RmtInf')
241 if line.state == 'normal':
242 Ustrd = etree.SubElement(RmtInf, 'Ustrd')
243 Ustrd.text = comm
244 elif line.state == 'structured':
245 Strd = etree.SubElement(RmtInf, 'Strd')
246 CdtrRefInf = etree.SubElement(Strd, 'CdtrRefInf')
247 Tp = etree.SubElement(CdtrRefInf, 'Tp')
248 CdOrPrtry = etree.SubElement(Tp, 'CdOrPrtry')
249 Cd = etree.SubElement(CdOrPrtry, 'Cd')
250 Cd.text = 'SCOR'
251 Issr = etree.SubElement(Tp, 'Issr')
252 Issr.text = 'BBA'
253 comm = self.format_comm(line.communication)
254 if not comm:
255 raise orm.except_orm(_('Payment Instruction Error!'),
256 _('Unsupported Structured Communication in Payment Line %s.\n' \
257 'Only the Belgian Structured Communication format (BBA) is supported in the current release ' \
258 'of the ISO 20022 payment module!') % line.name)
259 Ref = etree.SubElement(CdtrRefInf, 'Ref')
260 Ref.text = comm
261 else:
262 raise orm.except_orm(_('Configuration Error!'),
263 _('Unsupported Communication Type in Payment Line %s.\n') % line.name)
264 pain_data = etree.tostring(pain, encoding='UTF-8', xml_declaration=True, pretty_print=True)
265 # validate the generated XML schema
266 xsd = tools.file_open('account_pain/xsd/pain.001.001.03.xsd')
267 xmlschema_doc = etree.parse(xsd)
268 xmlschema = etree.XMLSchema(xmlschema_doc)
269 xml_to_validate = StringIO(pain_data)
270 parse_result = etree.parse(xml_to_validate)
271 if xmlschema.validate(parse_result):
272 pain_data = base64.encodestring(pain_data)
273 attachment_obj.create(cr, uid, {
274 'name': pain_fname,
275 'datas': pain_data,
276 'datas_fname': pain_fname,
277 'res_model': 'payment.order',
278 'res_id': active_id,
279 }, context=context)
280 payment_obj.set_done(cr, uid, [active_id], context)
281 else:
282 _logger.error('The generated XML file does not fit the required schema !')
283 _logger.error(tools.ustr(xmlschema.error_log.last_error))
284 error = xmlschema.error_log[0]
285 raise orm.except_orm(_('The generated XML file does not fit the required schema !'),
286 error.message)
287
288 if note:
289 note = _('Warning:\n') + note
290
291 return {'pain_data': pain_data, 'pain_fname': pain_fname, 'note': note}
292
293class account_pain_create(orm.TransientModel):
294 _name = 'account.pain.create'
295 _description = 'ISO 20022 payment file'
296
297 _columns = {
298 'pain_data': fields.binary('Payment File', required=True, readonly=True),
299 'pain_fname': fields.char('Filename', size=128, required=True),
300 'note': fields.text('Remarks'),
301 }
302
303# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file304\ No newline at end of file
1305
=== added file 'account_pain/wizard/payment_order_create.py'
--- account_pain/wizard/payment_order_create.py 1970-01-01 00:00:00 +0000
+++ account_pain/wizard/payment_order_create.py 2013-10-31 17:26:11 +0000
@@ -0,0 +1,140 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from datetime import datetime, date, timedelta
24from lxml import etree
25from openerp.osv import fields, orm
26from tools.translate import _
27import logging
28_logger = logging.getLogger(__name__)
29
30class payment_order_create(orm.TransientModel):
31 _inherit = 'payment.order.create'
32
33 _defaults = {
34 'duedate': lambda *a: (date.today() + timedelta(30)).isoformat(),
35 }
36
37 def journal_domain(self, cr, uid, context=None):
38 """
39 override this method in order to customise the journals to search on
40 """
41 journal_domain = [('journal_id.type', 'in', ['purchase', 'sale_refund', 'general', 'situation'])]
42 return journal_domain
43
44 def search_entries(self, cr, uid, ids, context=None):
45 """
46 Override the search_entries & fields_view_get methods of the account_payment payment.order.create object
47 """
48 line_obj = self.pool.get('account.move.line')
49 mod_obj = self.pool.get('ir.model.data')
50 if context is None:
51 context = {}
52 data = self.read(cr, uid, ids, [], context=context)[0]
53 search_due_date = data['duedate']
54 # Search for move line to pay:
55 domain = [('reconcile_id', '=', False), ('partner_id', '!=', False), ('account_id.type', 'in', ['payable', 'receivable']), ('amount_to_pay', '>', 0)] # update Noviat
56 domain = domain + ['|', ('date_maturity', '<=', search_due_date), ('date_maturity', '=', False)]
57 journal_domain = self.journal_domain(cr, uid)
58 domain = domain + journal_domain
59 line_ids = line_obj.search(cr, uid, domain, context=context)
60 context.update({'line_ids': line_ids})
61 model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context)
62 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
63 return {'name': _('Populate Payment'),
64 'context': context,
65 'view_type': 'form',
66 'view_mode': 'form',
67 'res_model': 'payment.order.create',
68 'views': [(resource_id,'form')],
69 'type': 'ir.actions.act_window',
70 'target': 'new',
71 }
72
73 """
74 add context to 'entries' field for use in account.move.line
75 """
76 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
77 res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
78 if context and 'line_ids' in context and view_type == 'form':
79 doc = etree.XML(res['arch'])
80 nodes = doc.xpath("//field[@name='entries']")
81 for node in nodes:
82 # add context for use in account.move.line
83 node.set('context', "{'account_payment':'1', 'view_mode':'tree'}")
84 node.set('colspan', '4')
85 node.set('height', '300')
86 node.set('width', '800')
87 res['arch'] = etree.tostring(doc)
88 return res
89
90 def create_payment(self, cr, uid, ids, context=None):
91 """
92 This method replaces the original one for multi-currency purposes
93 """
94 order_obj = self.pool.get('payment.order')
95 line_obj = self.pool.get('account.move.line')
96 payment_obj = self.pool.get('payment.line')
97 if context is None:
98 context = {}
99 data = self.browse(cr, uid, ids, context=context)[0]
100 line_ids = [entry.id for entry in data.entries]
101 if not line_ids:
102 return {'type': 'ir.actions.act_window_close'}
103
104 payment = order_obj.browse(cr, uid, context['active_id'], context=context)
105 t = payment.mode.type == 'iso20022' and payment.mode.id or None
106 line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
107
108 company_currency = payment.mode.company_id.currency_id
109 payment_mode_currency = payment.mode.journal.currency or company_currency
110
111 ## Finally populate the current payment with new lines:
112 for line in line_obj.browse(cr, uid, line_ids, context=context):
113 if payment.date_prefered == "now":
114 #no payment date => immediate payment
115 date_to_pay = False
116 elif payment.date_prefered == 'due':
117 date_to_pay = line.date_maturity
118 elif payment.date_prefered == 'fixed':
119 date_to_pay = payment.date_scheduled
120
121 transaction_currency = line.currency_id or company_currency
122 if transaction_currency != payment_mode_currency and payment.mode.type == 'iso20022':
123 raise orm.except_orm(_('Unsupported Operation !'),
124 _("The payment in another currency as the originating transaction is not supported in the" \
125 "current release of the ISO 20022 Payment Gateway"
126 "\nTransaction Currency: %s, Payment Mode Currency: %s)" \
127 "\n\nPlease contact info@noviat.be if this is a requirement.")
128 %(transaction_currency, payment_mode_currency) )
129
130 payment_obj.create(cr, uid,{
131 'move_line_id': line.id,
132 'amount_currency': line.amount_to_pay,
133 'bank_id': line2bank.get(line.id),
134 'order_id': payment.id,
135 'partner_id': line.partner_id and line.partner_id.id or False,
136 'communication': line.ref or '/',
137 'date': date_to_pay,
138 'currency': line.currency_id.id or company_currency.id,
139 }, context=context)
140 return {'type': 'ir.actions.act_window_close'}
0141
=== added directory 'account_pain/xsd'
=== added file 'account_pain/xsd/pain.001.001.03.xsd'
--- account_pain/xsd/pain.001.001.03.xsd 1970-01-01 00:00:00 +0000
+++ account_pain/xsd/pain.001.001.03.xsd 2013-10-31 17:26:11 +0000
@@ -0,0 +1,921 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!--Generated by SWIFTStandards Workstation (build:R6.1.0.2) on 2009 Jan 08 17:30:53-->
3<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
4 <xs:element name="Document" type="Document"/>
5 <xs:complexType name="AccountIdentification4Choice">
6 <xs:sequence>
7 <xs:choice>
8 <xs:element name="IBAN" type="IBAN2007Identifier"/>
9 <xs:element name="Othr" type="GenericAccountIdentification1"/>
10 </xs:choice>
11 </xs:sequence>
12 </xs:complexType>
13 <xs:complexType name="AccountSchemeName1Choice">
14 <xs:sequence>
15 <xs:choice>
16 <xs:element name="Cd" type="ExternalAccountIdentification1Code"/>
17 <xs:element name="Prtry" type="Max35Text"/>
18 </xs:choice>
19 </xs:sequence>
20 </xs:complexType>
21 <xs:simpleType name="ActiveOrHistoricCurrencyAndAmount_SimpleType">
22 <xs:restriction base="xs:decimal">
23 <xs:minInclusive value="0"/>
24 <xs:fractionDigits value="5"/>
25 <xs:totalDigits value="18"/>
26 </xs:restriction>
27 </xs:simpleType>
28 <xs:complexType name="ActiveOrHistoricCurrencyAndAmount">
29 <xs:simpleContent>
30 <xs:extension base="ActiveOrHistoricCurrencyAndAmount_SimpleType">
31 <xs:attribute name="Ccy" type="ActiveOrHistoricCurrencyCode" use="required"/>
32 </xs:extension>
33 </xs:simpleContent>
34 </xs:complexType>
35 <xs:simpleType name="ActiveOrHistoricCurrencyCode">
36 <xs:restriction base="xs:string">
37 <xs:pattern value="[A-Z]{3,3}"/>
38 </xs:restriction>
39 </xs:simpleType>
40 <xs:simpleType name="AddressType2Code">
41 <xs:restriction base="xs:string">
42 <xs:enumeration value="ADDR"/>
43 <xs:enumeration value="PBOX"/>
44 <xs:enumeration value="HOME"/>
45 <xs:enumeration value="BIZZ"/>
46 <xs:enumeration value="MLTO"/>
47 <xs:enumeration value="DLVY"/>
48 </xs:restriction>
49 </xs:simpleType>
50 <xs:complexType name="AmountType3Choice">
51 <xs:sequence>
52 <xs:choice>
53 <xs:element name="InstdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
54 <xs:element name="EqvtAmt" type="EquivalentAmount2"/>
55 </xs:choice>
56 </xs:sequence>
57 </xs:complexType>
58 <xs:simpleType name="AnyBICIdentifier">
59 <xs:restriction base="xs:string">
60 <xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
61 </xs:restriction>
62 </xs:simpleType>
63 <xs:complexType name="Authorisation1Choice">
64 <xs:sequence>
65 <xs:choice>
66 <xs:element name="Cd" type="Authorisation1Code"/>
67 <xs:element name="Prtry" type="Max128Text"/>
68 </xs:choice>
69 </xs:sequence>
70 </xs:complexType>
71 <xs:simpleType name="Authorisation1Code">
72 <xs:restriction base="xs:string">
73 <xs:enumeration value="AUTH"/>
74 <xs:enumeration value="FDET"/>
75 <xs:enumeration value="FSUM"/>
76 <xs:enumeration value="ILEV"/>
77 </xs:restriction>
78 </xs:simpleType>
79 <xs:simpleType name="BICIdentifier">
80 <xs:restriction base="xs:string">
81 <xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
82 </xs:restriction>
83 </xs:simpleType>
84 <xs:simpleType name="BaseOneRate">
85 <xs:restriction base="xs:decimal">
86 <xs:fractionDigits value="10"/>
87 <xs:totalDigits value="11"/>
88 </xs:restriction>
89 </xs:simpleType>
90 <xs:simpleType name="BatchBookingIndicator">
91 <xs:restriction base="xs:boolean"/>
92 </xs:simpleType>
93 <xs:complexType name="BranchAndFinancialInstitutionIdentification4">
94 <xs:sequence>
95 <xs:element name="FinInstnId" type="FinancialInstitutionIdentification7"/>
96 <xs:element maxOccurs="1" minOccurs="0" name="BrnchId" type="BranchData2"/>
97 </xs:sequence>
98 </xs:complexType>
99 <xs:complexType name="BranchData2">
100 <xs:sequence>
101 <xs:element maxOccurs="1" minOccurs="0" name="Id" type="Max35Text"/>
102 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
103 <xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
104 </xs:sequence>
105 </xs:complexType>
106 <xs:complexType name="CashAccount16">
107 <xs:sequence>
108 <xs:element name="Id" type="AccountIdentification4Choice"/>
109 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CashAccountType2"/>
110 <xs:element maxOccurs="1" minOccurs="0" name="Ccy" type="ActiveOrHistoricCurrencyCode"/>
111 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max70Text"/>
112 </xs:sequence>
113 </xs:complexType>
114 <xs:complexType name="CashAccountType2">
115 <xs:sequence>
116 <xs:choice>
117 <xs:element name="Cd" type="CashAccountType4Code"/>
118 <xs:element name="Prtry" type="Max35Text"/>
119 </xs:choice>
120 </xs:sequence>
121 </xs:complexType>
122 <xs:simpleType name="CashAccountType4Code">
123 <xs:restriction base="xs:string">
124 <xs:enumeration value="CASH"/>
125 <xs:enumeration value="CHAR"/>
126 <xs:enumeration value="COMM"/>
127 <xs:enumeration value="TAXE"/>
128 <xs:enumeration value="CISH"/>
129 <xs:enumeration value="TRAS"/>
130 <xs:enumeration value="SACC"/>
131 <xs:enumeration value="CACC"/>
132 <xs:enumeration value="SVGS"/>
133 <xs:enumeration value="ONDP"/>
134 <xs:enumeration value="MGLD"/>
135 <xs:enumeration value="NREX"/>
136 <xs:enumeration value="MOMA"/>
137 <xs:enumeration value="LOAN"/>
138 <xs:enumeration value="SLRY"/>
139 <xs:enumeration value="ODFT"/>
140 </xs:restriction>
141 </xs:simpleType>
142 <xs:complexType name="CategoryPurpose1Choice">
143 <xs:sequence>
144 <xs:choice>
145 <xs:element name="Cd" type="ExternalCategoryPurpose1Code"/>
146 <xs:element name="Prtry" type="Max35Text"/>
147 </xs:choice>
148 </xs:sequence>
149 </xs:complexType>
150 <xs:simpleType name="ChargeBearerType1Code">
151 <xs:restriction base="xs:string">
152 <xs:enumeration value="DEBT"/>
153 <xs:enumeration value="CRED"/>
154 <xs:enumeration value="SHAR"/>
155 <xs:enumeration value="SLEV"/>
156 </xs:restriction>
157 </xs:simpleType>
158 <xs:complexType name="Cheque6">
159 <xs:sequence>
160 <xs:element maxOccurs="1" minOccurs="0" name="ChqTp" type="ChequeType2Code"/>
161 <xs:element maxOccurs="1" minOccurs="0" name="ChqNb" type="Max35Text"/>
162 <xs:element maxOccurs="1" minOccurs="0" name="ChqFr" type="NameAndAddress10"/>
163 <xs:element maxOccurs="1" minOccurs="0" name="DlvryMtd" type="ChequeDeliveryMethod1Choice"/>
164 <xs:element maxOccurs="1" minOccurs="0" name="DlvrTo" type="NameAndAddress10"/>
165 <xs:element maxOccurs="1" minOccurs="0" name="InstrPrty" type="Priority2Code"/>
166 <xs:element maxOccurs="1" minOccurs="0" name="ChqMtrtyDt" type="ISODate"/>
167 <xs:element maxOccurs="1" minOccurs="0" name="FrmsCd" type="Max35Text"/>
168 <xs:element maxOccurs="2" minOccurs="0" name="MemoFld" type="Max35Text"/>
169 <xs:element maxOccurs="1" minOccurs="0" name="RgnlClrZone" type="Max35Text"/>
170 <xs:element maxOccurs="1" minOccurs="0" name="PrtLctn" type="Max35Text"/>
171 </xs:sequence>
172 </xs:complexType>
173 <xs:simpleType name="ChequeDelivery1Code">
174 <xs:restriction base="xs:string">
175 <xs:enumeration value="MLDB"/>
176 <xs:enumeration value="MLCD"/>
177 <xs:enumeration value="MLFA"/>
178 <xs:enumeration value="CRDB"/>
179 <xs:enumeration value="CRCD"/>
180 <xs:enumeration value="CRFA"/>
181 <xs:enumeration value="PUDB"/>
182 <xs:enumeration value="PUCD"/>
183 <xs:enumeration value="PUFA"/>
184 <xs:enumeration value="RGDB"/>
185 <xs:enumeration value="RGCD"/>
186 <xs:enumeration value="RGFA"/>
187 </xs:restriction>
188 </xs:simpleType>
189 <xs:complexType name="ChequeDeliveryMethod1Choice">
190 <xs:sequence>
191 <xs:choice>
192 <xs:element name="Cd" type="ChequeDelivery1Code"/>
193 <xs:element name="Prtry" type="Max35Text"/>
194 </xs:choice>
195 </xs:sequence>
196 </xs:complexType>
197 <xs:simpleType name="ChequeType2Code">
198 <xs:restriction base="xs:string">
199 <xs:enumeration value="CCHQ"/>
200 <xs:enumeration value="CCCH"/>
201 <xs:enumeration value="BCHQ"/>
202 <xs:enumeration value="DRFT"/>
203 <xs:enumeration value="ELDR"/>
204 </xs:restriction>
205 </xs:simpleType>
206 <xs:complexType name="ClearingSystemIdentification2Choice">
207 <xs:sequence>
208 <xs:choice>
209 <xs:element name="Cd" type="ExternalClearingSystemIdentification1Code"/>
210 <xs:element name="Prtry" type="Max35Text"/>
211 </xs:choice>
212 </xs:sequence>
213 </xs:complexType>
214 <xs:complexType name="ClearingSystemMemberIdentification2">
215 <xs:sequence>
216 <xs:element maxOccurs="1" minOccurs="0" name="ClrSysId" type="ClearingSystemIdentification2Choice"/>
217 <xs:element name="MmbId" type="Max35Text"/>
218 </xs:sequence>
219 </xs:complexType>
220 <xs:complexType name="ContactDetails2">
221 <xs:sequence>
222 <xs:element maxOccurs="1" minOccurs="0" name="NmPrfx" type="NamePrefix1Code"/>
223 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
224 <xs:element maxOccurs="1" minOccurs="0" name="PhneNb" type="PhoneNumber"/>
225 <xs:element maxOccurs="1" minOccurs="0" name="MobNb" type="PhoneNumber"/>
226 <xs:element maxOccurs="1" minOccurs="0" name="FaxNb" type="PhoneNumber"/>
227 <xs:element maxOccurs="1" minOccurs="0" name="EmailAdr" type="Max2048Text"/>
228 <xs:element maxOccurs="1" minOccurs="0" name="Othr" type="Max35Text"/>
229 </xs:sequence>
230 </xs:complexType>
231 <xs:simpleType name="CountryCode">
232 <xs:restriction base="xs:string">
233 <xs:pattern value="[A-Z]{2,2}"/>
234 </xs:restriction>
235 </xs:simpleType>
236 <xs:simpleType name="CreditDebitCode">
237 <xs:restriction base="xs:string">
238 <xs:enumeration value="CRDT"/>
239 <xs:enumeration value="DBIT"/>
240 </xs:restriction>
241 </xs:simpleType>
242 <xs:complexType name="CreditTransferTransactionInformation10">
243 <xs:sequence>
244 <xs:element name="PmtId" type="PaymentIdentification1"/>
245 <xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation19"/>
246 <xs:element name="Amt" type="AmountType3Choice"/>
247 <xs:element maxOccurs="1" minOccurs="0" name="XchgRateInf" type="ExchangeRateInformation1"/>
248 <xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
249 <xs:element maxOccurs="1" minOccurs="0" name="ChqInstr" type="Cheque6"/>
250 <xs:element maxOccurs="1" minOccurs="0" name="UltmtDbtr" type="PartyIdentification32"/>
251 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt1" type="BranchAndFinancialInstitutionIdentification4"/>
252 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt1Acct" type="CashAccount16"/>
253 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt2" type="BranchAndFinancialInstitutionIdentification4"/>
254 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt2Acct" type="CashAccount16"/>
255 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt3" type="BranchAndFinancialInstitutionIdentification4"/>
256 <xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt3Acct" type="CashAccount16"/>
257 <xs:element maxOccurs="1" minOccurs="0" name="CdtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
258 <xs:element maxOccurs="1" minOccurs="0" name="CdtrAgtAcct" type="CashAccount16"/>
259 <xs:element maxOccurs="1" minOccurs="0" name="Cdtr" type="PartyIdentification32"/>
260 <xs:element maxOccurs="1" minOccurs="0" name="CdtrAcct" type="CashAccount16"/>
261 <xs:element maxOccurs="1" minOccurs="0" name="UltmtCdtr" type="PartyIdentification32"/>
262 <xs:element maxOccurs="unbounded" minOccurs="0" name="InstrForCdtrAgt" type="InstructionForCreditorAgent1"/>
263 <xs:element maxOccurs="1" minOccurs="0" name="InstrForDbtrAgt" type="Max140Text"/>
264 <xs:element maxOccurs="1" minOccurs="0" name="Purp" type="Purpose2Choice"/>
265 <xs:element maxOccurs="10" minOccurs="0" name="RgltryRptg" type="RegulatoryReporting3"/>
266 <xs:element maxOccurs="1" minOccurs="0" name="Tax" type="TaxInformation3"/>
267 <xs:element maxOccurs="10" minOccurs="0" name="RltdRmtInf" type="RemittanceLocation2"/>
268 <xs:element maxOccurs="1" minOccurs="0" name="RmtInf" type="RemittanceInformation5"/>
269 </xs:sequence>
270 </xs:complexType>
271 <xs:complexType name="CreditorReferenceInformation2">
272 <xs:sequence>
273 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CreditorReferenceType2"/>
274 <xs:element maxOccurs="1" minOccurs="0" name="Ref" type="Max35Text"/>
275 </xs:sequence>
276 </xs:complexType>
277 <xs:complexType name="CreditorReferenceType1Choice">
278 <xs:sequence>
279 <xs:choice>
280 <xs:element name="Cd" type="DocumentType3Code"/>
281 <xs:element name="Prtry" type="Max35Text"/>
282 </xs:choice>
283 </xs:sequence>
284 </xs:complexType>
285 <xs:complexType name="CreditorReferenceType2">
286 <xs:sequence>
287 <xs:element name="CdOrPrtry" type="CreditorReferenceType1Choice"/>
288 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
289 </xs:sequence>
290 </xs:complexType>
291 <xs:complexType name="CustomerCreditTransferInitiationV03">
292 <xs:sequence>
293 <xs:element name="GrpHdr" type="GroupHeader32"/>
294 <xs:element maxOccurs="unbounded" minOccurs="1" name="PmtInf" type="PaymentInstructionInformation3"/>
295 </xs:sequence>
296 </xs:complexType>
297 <xs:complexType name="DateAndPlaceOfBirth">
298 <xs:sequence>
299 <xs:element name="BirthDt" type="ISODate"/>
300 <xs:element maxOccurs="1" minOccurs="0" name="PrvcOfBirth" type="Max35Text"/>
301 <xs:element name="CityOfBirth" type="Max35Text"/>
302 <xs:element name="CtryOfBirth" type="CountryCode"/>
303 </xs:sequence>
304 </xs:complexType>
305 <xs:complexType name="DatePeriodDetails">
306 <xs:sequence>
307 <xs:element name="FrDt" type="ISODate"/>
308 <xs:element name="ToDt" type="ISODate"/>
309 </xs:sequence>
310 </xs:complexType>
311 <xs:simpleType name="DecimalNumber">
312 <xs:restriction base="xs:decimal">
313 <xs:fractionDigits value="17"/>
314 <xs:totalDigits value="18"/>
315 </xs:restriction>
316 </xs:simpleType>
317 <xs:complexType name="Document">
318 <xs:sequence>
319 <xs:element name="CstmrCdtTrfInitn" type="CustomerCreditTransferInitiationV03"/>
320 </xs:sequence>
321 </xs:complexType>
322 <xs:complexType name="DocumentAdjustment1">
323 <xs:sequence>
324 <xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
325 <xs:element maxOccurs="1" minOccurs="0" name="CdtDbtInd" type="CreditDebitCode"/>
326 <xs:element maxOccurs="1" minOccurs="0" name="Rsn" type="Max4Text"/>
327 <xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
328 </xs:sequence>
329 </xs:complexType>
330 <xs:simpleType name="DocumentType3Code">
331 <xs:restriction base="xs:string">
332 <xs:enumeration value="RADM"/>
333 <xs:enumeration value="RPIN"/>
334 <xs:enumeration value="FXDR"/>
335 <xs:enumeration value="DISP"/>
336 <xs:enumeration value="PUOR"/>
337 <xs:enumeration value="SCOR"/>
338 </xs:restriction>
339 </xs:simpleType>
340 <xs:simpleType name="DocumentType5Code">
341 <xs:restriction base="xs:string">
342 <xs:enumeration value="MSIN"/>
343 <xs:enumeration value="CNFA"/>
344 <xs:enumeration value="DNFA"/>
345 <xs:enumeration value="CINV"/>
346 <xs:enumeration value="CREN"/>
347 <xs:enumeration value="DEBN"/>
348 <xs:enumeration value="HIRI"/>
349 <xs:enumeration value="SBIN"/>
350 <xs:enumeration value="CMCN"/>
351 <xs:enumeration value="SOAC"/>
352 <xs:enumeration value="DISP"/>
353 <xs:enumeration value="BOLD"/>
354 <xs:enumeration value="VCHR"/>
355 <xs:enumeration value="AROI"/>
356 <xs:enumeration value="TSUT"/>
357 </xs:restriction>
358 </xs:simpleType>
359 <xs:complexType name="EquivalentAmount2">
360 <xs:sequence>
361 <xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
362 <xs:element name="CcyOfTrf" type="ActiveOrHistoricCurrencyCode"/>
363 </xs:sequence>
364 </xs:complexType>
365 <xs:complexType name="ExchangeRateInformation1">
366 <xs:sequence>
367 <xs:element maxOccurs="1" minOccurs="0" name="XchgRate" type="BaseOneRate"/>
368 <xs:element maxOccurs="1" minOccurs="0" name="RateTp" type="ExchangeRateType1Code"/>
369 <xs:element maxOccurs="1" minOccurs="0" name="CtrctId" type="Max35Text"/>
370 </xs:sequence>
371 </xs:complexType>
372 <xs:simpleType name="ExchangeRateType1Code">
373 <xs:restriction base="xs:string">
374 <xs:enumeration value="SPOT"/>
375 <xs:enumeration value="SALE"/>
376 <xs:enumeration value="AGRD"/>
377 </xs:restriction>
378 </xs:simpleType>
379 <xs:simpleType name="ExternalAccountIdentification1Code">
380 <xs:restriction base="xs:string">
381 <xs:minLength value="1"/>
382 <xs:maxLength value="4"/>
383 </xs:restriction>
384 </xs:simpleType>
385 <xs:simpleType name="ExternalCategoryPurpose1Code">
386 <xs:restriction base="xs:string">
387 <xs:minLength value="1"/>
388 <xs:maxLength value="4"/>
389 </xs:restriction>
390 </xs:simpleType>
391 <xs:simpleType name="ExternalClearingSystemIdentification1Code">
392 <xs:restriction base="xs:string">
393 <xs:minLength value="1"/>
394 <xs:maxLength value="5"/>
395 </xs:restriction>
396 </xs:simpleType>
397 <xs:simpleType name="ExternalFinancialInstitutionIdentification1Code">
398 <xs:restriction base="xs:string">
399 <xs:minLength value="1"/>
400 <xs:maxLength value="4"/>
401 </xs:restriction>
402 </xs:simpleType>
403 <xs:simpleType name="ExternalLocalInstrument1Code">
404 <xs:restriction base="xs:string">
405 <xs:minLength value="1"/>
406 <xs:maxLength value="35"/>
407 </xs:restriction>
408 </xs:simpleType>
409 <xs:simpleType name="ExternalOrganisationIdentification1Code">
410 <xs:restriction base="xs:string">
411 <xs:minLength value="1"/>
412 <xs:maxLength value="4"/>
413 </xs:restriction>
414 </xs:simpleType>
415 <xs:simpleType name="ExternalPersonIdentification1Code">
416 <xs:restriction base="xs:string">
417 <xs:minLength value="1"/>
418 <xs:maxLength value="4"/>
419 </xs:restriction>
420 </xs:simpleType>
421 <xs:simpleType name="ExternalPurpose1Code">
422 <xs:restriction base="xs:string">
423 <xs:minLength value="1"/>
424 <xs:maxLength value="4"/>
425 </xs:restriction>
426 </xs:simpleType>
427 <xs:simpleType name="ExternalServiceLevel1Code">
428 <xs:restriction base="xs:string">
429 <xs:minLength value="1"/>
430 <xs:maxLength value="4"/>
431 </xs:restriction>
432 </xs:simpleType>
433 <xs:complexType name="FinancialIdentificationSchemeName1Choice">
434 <xs:sequence>
435 <xs:choice>
436 <xs:element name="Cd" type="ExternalFinancialInstitutionIdentification1Code"/>
437 <xs:element name="Prtry" type="Max35Text"/>
438 </xs:choice>
439 </xs:sequence>
440 </xs:complexType>
441 <xs:complexType name="FinancialInstitutionIdentification7">
442 <xs:sequence>
443 <xs:element maxOccurs="1" minOccurs="0" name="BIC" type="BICIdentifier"/>
444 <xs:element maxOccurs="1" minOccurs="0" name="ClrSysMmbId" type="ClearingSystemMemberIdentification2"/>
445 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
446 <xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
447 <xs:element maxOccurs="1" minOccurs="0" name="Othr" type="GenericFinancialIdentification1"/>
448 </xs:sequence>
449 </xs:complexType>
450 <xs:complexType name="GenericAccountIdentification1">
451 <xs:sequence>
452 <xs:element name="Id" type="Max34Text"/>
453 <xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="AccountSchemeName1Choice"/>
454 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
455 </xs:sequence>
456 </xs:complexType>
457 <xs:complexType name="GenericFinancialIdentification1">
458 <xs:sequence>
459 <xs:element name="Id" type="Max35Text"/>
460 <xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="FinancialIdentificationSchemeName1Choice"/>
461 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
462 </xs:sequence>
463 </xs:complexType>
464 <xs:complexType name="GenericOrganisationIdentification1">
465 <xs:sequence>
466 <xs:element name="Id" type="Max35Text"/>
467 <xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="OrganisationIdentificationSchemeName1Choice"/>
468 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
469 </xs:sequence>
470 </xs:complexType>
471 <xs:complexType name="GenericPersonIdentification1">
472 <xs:sequence>
473 <xs:element name="Id" type="Max35Text"/>
474 <xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="PersonIdentificationSchemeName1Choice"/>
475 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
476 </xs:sequence>
477 </xs:complexType>
478 <xs:complexType name="GroupHeader32">
479 <xs:sequence>
480 <xs:element name="MsgId" type="Max35Text"/>
481 <xs:element name="CreDtTm" type="ISODateTime"/>
482 <xs:element maxOccurs="2" minOccurs="0" name="Authstn" type="Authorisation1Choice"/>
483 <xs:element name="NbOfTxs" type="Max15NumericText"/>
484 <xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
485 <xs:element name="InitgPty" type="PartyIdentification32"/>
486 <xs:element maxOccurs="1" minOccurs="0" name="FwdgAgt" type="BranchAndFinancialInstitutionIdentification4"/>
487 </xs:sequence>
488 </xs:complexType>
489 <xs:simpleType name="IBAN2007Identifier">
490 <xs:restriction base="xs:string">
491 <xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>
492 </xs:restriction>
493 </xs:simpleType>
494 <xs:simpleType name="ISODate">
495 <xs:restriction base="xs:date"/>
496 </xs:simpleType>
497 <xs:simpleType name="ISODateTime">
498 <xs:restriction base="xs:dateTime"/>
499 </xs:simpleType>
500 <xs:simpleType name="Instruction3Code">
501 <xs:restriction base="xs:string">
502 <xs:enumeration value="CHQB"/>
503 <xs:enumeration value="HOLD"/>
504 <xs:enumeration value="PHOB"/>
505 <xs:enumeration value="TELB"/>
506 </xs:restriction>
507 </xs:simpleType>
508 <xs:complexType name="InstructionForCreditorAgent1">
509 <xs:sequence>
510 <xs:element maxOccurs="1" minOccurs="0" name="Cd" type="Instruction3Code"/>
511 <xs:element maxOccurs="1" minOccurs="0" name="InstrInf" type="Max140Text"/>
512 </xs:sequence>
513 </xs:complexType>
514 <xs:complexType name="LocalInstrument2Choice">
515 <xs:sequence>
516 <xs:choice>
517 <xs:element name="Cd" type="ExternalLocalInstrument1Code"/>
518 <xs:element name="Prtry" type="Max35Text"/>
519 </xs:choice>
520 </xs:sequence>
521 </xs:complexType>
522 <xs:simpleType name="Max10Text">
523 <xs:restriction base="xs:string">
524 <xs:minLength value="1"/>
525 <xs:maxLength value="10"/>
526 </xs:restriction>
527 </xs:simpleType>
528 <xs:simpleType name="Max128Text">
529 <xs:restriction base="xs:string">
530 <xs:minLength value="1"/>
531 <xs:maxLength value="128"/>
532 </xs:restriction>
533 </xs:simpleType>
534 <xs:simpleType name="Max140Text">
535 <xs:restriction base="xs:string">
536 <xs:minLength value="1"/>
537 <xs:maxLength value="140"/>
538 </xs:restriction>
539 </xs:simpleType>
540 <xs:simpleType name="Max15NumericText">
541 <xs:restriction base="xs:string">
542 <xs:pattern value="[0-9]{1,15}"/>
543 </xs:restriction>
544 </xs:simpleType>
545 <xs:simpleType name="Max16Text">
546 <xs:restriction base="xs:string">
547 <xs:minLength value="1"/>
548 <xs:maxLength value="16"/>
549 </xs:restriction>
550 </xs:simpleType>
551 <xs:simpleType name="Max2048Text">
552 <xs:restriction base="xs:string">
553 <xs:minLength value="1"/>
554 <xs:maxLength value="2048"/>
555 </xs:restriction>
556 </xs:simpleType>
557 <xs:simpleType name="Max34Text">
558 <xs:restriction base="xs:string">
559 <xs:minLength value="1"/>
560 <xs:maxLength value="34"/>
561 </xs:restriction>
562 </xs:simpleType>
563 <xs:simpleType name="Max35Text">
564 <xs:restriction base="xs:string">
565 <xs:minLength value="1"/>
566 <xs:maxLength value="35"/>
567 </xs:restriction>
568 </xs:simpleType>
569 <xs:simpleType name="Max4Text">
570 <xs:restriction base="xs:string">
571 <xs:minLength value="1"/>
572 <xs:maxLength value="4"/>
573 </xs:restriction>
574 </xs:simpleType>
575 <xs:simpleType name="Max70Text">
576 <xs:restriction base="xs:string">
577 <xs:minLength value="1"/>
578 <xs:maxLength value="70"/>
579 </xs:restriction>
580 </xs:simpleType>
581 <xs:complexType name="NameAndAddress10">
582 <xs:sequence>
583 <xs:element name="Nm" type="Max140Text"/>
584 <xs:element name="Adr" type="PostalAddress6"/>
585 </xs:sequence>
586 </xs:complexType>
587 <xs:simpleType name="NamePrefix1Code">
588 <xs:restriction base="xs:string">
589 <xs:enumeration value="DOCT"/>
590 <xs:enumeration value="MIST"/>
591 <xs:enumeration value="MISS"/>
592 <xs:enumeration value="MADM"/>
593 </xs:restriction>
594 </xs:simpleType>
595 <xs:simpleType name="Number">
596 <xs:restriction base="xs:decimal">
597 <xs:fractionDigits value="0"/>
598 <xs:totalDigits value="18"/>
599 </xs:restriction>
600 </xs:simpleType>
601 <xs:complexType name="OrganisationIdentification4">
602 <xs:sequence>
603 <xs:element maxOccurs="1" minOccurs="0" name="BICOrBEI" type="AnyBICIdentifier"/>
604 <xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericOrganisationIdentification1"/>
605 </xs:sequence>
606 </xs:complexType>
607 <xs:complexType name="OrganisationIdentificationSchemeName1Choice">
608 <xs:sequence>
609 <xs:choice>
610 <xs:element name="Cd" type="ExternalOrganisationIdentification1Code"/>
611 <xs:element name="Prtry" type="Max35Text"/>
612 </xs:choice>
613 </xs:sequence>
614 </xs:complexType>
615 <xs:complexType name="Party6Choice">
616 <xs:sequence>
617 <xs:choice>
618 <xs:element name="OrgId" type="OrganisationIdentification4"/>
619 <xs:element name="PrvtId" type="PersonIdentification5"/>
620 </xs:choice>
621 </xs:sequence>
622 </xs:complexType>
623 <xs:complexType name="PartyIdentification32">
624 <xs:sequence>
625 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
626 <xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
627 <xs:element maxOccurs="1" minOccurs="0" name="Id" type="Party6Choice"/>
628 <xs:element maxOccurs="1" minOccurs="0" name="CtryOfRes" type="CountryCode"/>
629 <xs:element maxOccurs="1" minOccurs="0" name="CtctDtls" type="ContactDetails2"/>
630 </xs:sequence>
631 </xs:complexType>
632 <xs:complexType name="PaymentIdentification1">
633 <xs:sequence>
634 <xs:element maxOccurs="1" minOccurs="0" name="InstrId" type="Max35Text"/>
635 <xs:element name="EndToEndId" type="Max35Text"/>
636 </xs:sequence>
637 </xs:complexType>
638 <xs:complexType name="PaymentInstructionInformation3">
639 <xs:sequence>
640 <xs:element name="PmtInfId" type="Max35Text"/>
641 <xs:element name="PmtMtd" type="PaymentMethod3Code"/>
642 <xs:element maxOccurs="1" minOccurs="0" name="BtchBookg" type="BatchBookingIndicator"/>
643 <xs:element maxOccurs="1" minOccurs="0" name="NbOfTxs" type="Max15NumericText"/>
644 <xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
645 <xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation19"/>
646 <xs:element name="ReqdExctnDt" type="ISODate"/>
647 <xs:element maxOccurs="1" minOccurs="0" name="PoolgAdjstmntDt" type="ISODate"/>
648 <xs:element name="Dbtr" type="PartyIdentification32"/>
649 <xs:element name="DbtrAcct" type="CashAccount16"/>
650 <xs:element name="DbtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
651 <xs:element maxOccurs="1" minOccurs="0" name="DbtrAgtAcct" type="CashAccount16"/>
652 <xs:element maxOccurs="1" minOccurs="0" name="UltmtDbtr" type="PartyIdentification32"/>
653 <xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
654 <xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcct" type="CashAccount16"/>
655 <xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcctAgt" type="BranchAndFinancialInstitutionIdentification4"/>
656 <xs:element maxOccurs="unbounded" minOccurs="1" name="CdtTrfTxInf" type="CreditTransferTransactionInformation10"/>
657 </xs:sequence>
658 </xs:complexType>
659 <xs:simpleType name="PaymentMethod3Code">
660 <xs:restriction base="xs:string">
661 <xs:enumeration value="CHK"/>
662 <xs:enumeration value="TRF"/>
663 <xs:enumeration value="TRA"/>
664 </xs:restriction>
665 </xs:simpleType>
666 <xs:complexType name="PaymentTypeInformation19">
667 <xs:sequence>
668 <xs:element maxOccurs="1" minOccurs="0" name="InstrPrty" type="Priority2Code"/>
669 <xs:element maxOccurs="1" minOccurs="0" name="SvcLvl" type="ServiceLevel8Choice"/>
670 <xs:element maxOccurs="1" minOccurs="0" name="LclInstrm" type="LocalInstrument2Choice"/>
671 <xs:element maxOccurs="1" minOccurs="0" name="CtgyPurp" type="CategoryPurpose1Choice"/>
672 </xs:sequence>
673 </xs:complexType>
674 <xs:simpleType name="PercentageRate">
675 <xs:restriction base="xs:decimal">
676 <xs:fractionDigits value="10"/>
677 <xs:totalDigits value="11"/>
678 </xs:restriction>
679 </xs:simpleType>
680 <xs:complexType name="PersonIdentification5">
681 <xs:sequence>
682 <xs:element maxOccurs="1" minOccurs="0" name="DtAndPlcOfBirth" type="DateAndPlaceOfBirth"/>
683 <xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericPersonIdentification1"/>
684 </xs:sequence>
685 </xs:complexType>
686 <xs:complexType name="PersonIdentificationSchemeName1Choice">
687 <xs:sequence>
688 <xs:choice>
689 <xs:element name="Cd" type="ExternalPersonIdentification1Code"/>
690 <xs:element name="Prtry" type="Max35Text"/>
691 </xs:choice>
692 </xs:sequence>
693 </xs:complexType>
694 <xs:simpleType name="PhoneNumber">
695 <xs:restriction base="xs:string">
696 <xs:pattern value="\+[0-9]{1,3}-[0-9()+\-]{1,30}"/>
697 </xs:restriction>
698 </xs:simpleType>
699 <xs:complexType name="PostalAddress6">
700 <xs:sequence>
701 <xs:element maxOccurs="1" minOccurs="0" name="AdrTp" type="AddressType2Code"/>
702 <xs:element maxOccurs="1" minOccurs="0" name="Dept" type="Max70Text"/>
703 <xs:element maxOccurs="1" minOccurs="0" name="SubDept" type="Max70Text"/>
704 <xs:element maxOccurs="1" minOccurs="0" name="StrtNm" type="Max70Text"/>
705 <xs:element maxOccurs="1" minOccurs="0" name="BldgNb" type="Max16Text"/>
706 <xs:element maxOccurs="1" minOccurs="0" name="PstCd" type="Max16Text"/>
707 <xs:element maxOccurs="1" minOccurs="0" name="TwnNm" type="Max35Text"/>
708 <xs:element maxOccurs="1" minOccurs="0" name="CtrySubDvsn" type="Max35Text"/>
709 <xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
710 <xs:element maxOccurs="7" minOccurs="0" name="AdrLine" type="Max70Text"/>
711 </xs:sequence>
712 </xs:complexType>
713 <xs:simpleType name="Priority2Code">
714 <xs:restriction base="xs:string">
715 <xs:enumeration value="HIGH"/>
716 <xs:enumeration value="NORM"/>
717 </xs:restriction>
718 </xs:simpleType>
719 <xs:complexType name="Purpose2Choice">
720 <xs:sequence>
721 <xs:choice>
722 <xs:element name="Cd" type="ExternalPurpose1Code"/>
723 <xs:element name="Prtry" type="Max35Text"/>
724 </xs:choice>
725 </xs:sequence>
726 </xs:complexType>
727 <xs:complexType name="ReferredDocumentInformation3">
728 <xs:sequence>
729 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="ReferredDocumentType2"/>
730 <xs:element maxOccurs="1" minOccurs="0" name="Nb" type="Max35Text"/>
731 <xs:element maxOccurs="1" minOccurs="0" name="RltdDt" type="ISODate"/>
732 </xs:sequence>
733 </xs:complexType>
734 <xs:complexType name="ReferredDocumentType1Choice">
735 <xs:sequence>
736 <xs:choice>
737 <xs:element name="Cd" type="DocumentType5Code"/>
738 <xs:element name="Prtry" type="Max35Text"/>
739 </xs:choice>
740 </xs:sequence>
741 </xs:complexType>
742 <xs:complexType name="ReferredDocumentType2">
743 <xs:sequence>
744 <xs:element name="CdOrPrtry" type="ReferredDocumentType1Choice"/>
745 <xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
746 </xs:sequence>
747 </xs:complexType>
748 <xs:complexType name="RegulatoryAuthority2">
749 <xs:sequence>
750 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
751 <xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
752 </xs:sequence>
753 </xs:complexType>
754 <xs:complexType name="RegulatoryReporting3">
755 <xs:sequence>
756 <xs:element maxOccurs="1" minOccurs="0" name="DbtCdtRptgInd" type="RegulatoryReportingType1Code"/>
757 <xs:element maxOccurs="1" minOccurs="0" name="Authrty" type="RegulatoryAuthority2"/>
758 <xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="StructuredRegulatoryReporting3"/>
759 </xs:sequence>
760 </xs:complexType>
761 <xs:simpleType name="RegulatoryReportingType1Code">
762 <xs:restriction base="xs:string">
763 <xs:enumeration value="CRED"/>
764 <xs:enumeration value="DEBT"/>
765 <xs:enumeration value="BOTH"/>
766 </xs:restriction>
767 </xs:simpleType>
768 <xs:complexType name="RemittanceAmount1">
769 <xs:sequence>
770 <xs:element maxOccurs="1" minOccurs="0" name="DuePyblAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
771 <xs:element maxOccurs="1" minOccurs="0" name="DscntApldAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
772 <xs:element maxOccurs="1" minOccurs="0" name="CdtNoteAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
773 <xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
774 <xs:element maxOccurs="unbounded" minOccurs="0" name="AdjstmntAmtAndRsn" type="DocumentAdjustment1"/>
775 <xs:element maxOccurs="1" minOccurs="0" name="RmtdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
776 </xs:sequence>
777 </xs:complexType>
778 <xs:complexType name="RemittanceInformation5">
779 <xs:sequence>
780 <xs:element maxOccurs="unbounded" minOccurs="0" name="Ustrd" type="Max140Text"/>
781 <xs:element maxOccurs="unbounded" minOccurs="0" name="Strd" type="StructuredRemittanceInformation7"/>
782 </xs:sequence>
783 </xs:complexType>
784 <xs:complexType name="RemittanceLocation2">
785 <xs:sequence>
786 <xs:element maxOccurs="1" minOccurs="0" name="RmtId" type="Max35Text"/>
787 <xs:element maxOccurs="1" minOccurs="0" name="RmtLctnMtd" type="RemittanceLocationMethod2Code"/>
788 <xs:element maxOccurs="1" minOccurs="0" name="RmtLctnElctrncAdr" type="Max2048Text"/>
789 <xs:element maxOccurs="1" minOccurs="0" name="RmtLctnPstlAdr" type="NameAndAddress10"/>
790 </xs:sequence>
791 </xs:complexType>
792 <xs:simpleType name="RemittanceLocationMethod2Code">
793 <xs:restriction base="xs:string">
794 <xs:enumeration value="FAXI"/>
795 <xs:enumeration value="EDIC"/>
796 <xs:enumeration value="URID"/>
797 <xs:enumeration value="EMAL"/>
798 <xs:enumeration value="POST"/>
799 <xs:enumeration value="SMSM"/>
800 </xs:restriction>
801 </xs:simpleType>
802 <xs:complexType name="ServiceLevel8Choice">
803 <xs:sequence>
804 <xs:choice>
805 <xs:element name="Cd" type="ExternalServiceLevel1Code"/>
806 <xs:element name="Prtry" type="Max35Text"/>
807 </xs:choice>
808 </xs:sequence>
809 </xs:complexType>
810 <xs:complexType name="StructuredRegulatoryReporting3">
811 <xs:sequence>
812 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
813 <xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
814 <xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
815 <xs:element maxOccurs="1" minOccurs="0" name="Cd" type="Max10Text"/>
816 <xs:element maxOccurs="1" minOccurs="0" name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
817 <xs:element maxOccurs="unbounded" minOccurs="0" name="Inf" type="Max35Text"/>
818 </xs:sequence>
819 </xs:complexType>
820 <xs:complexType name="StructuredRemittanceInformation7">
821 <xs:sequence>
822 <xs:element maxOccurs="unbounded" minOccurs="0" name="RfrdDocInf" type="ReferredDocumentInformation3"/>
823 <xs:element maxOccurs="1" minOccurs="0" name="RfrdDocAmt" type="RemittanceAmount1"/>
824 <xs:element maxOccurs="1" minOccurs="0" name="CdtrRefInf" type="CreditorReferenceInformation2"/>
825 <xs:element maxOccurs="1" minOccurs="0" name="Invcr" type="PartyIdentification32"/>
826 <xs:element maxOccurs="1" minOccurs="0" name="Invcee" type="PartyIdentification32"/>
827 <xs:element maxOccurs="3" minOccurs="0" name="AddtlRmtInf" type="Max140Text"/>
828 </xs:sequence>
829 </xs:complexType>
830 <xs:complexType name="TaxAmount1">
831 <xs:sequence>
832 <xs:element maxOccurs="1" minOccurs="0" name="Rate" type="PercentageRate"/>
833 <xs:element maxOccurs="1" minOccurs="0" name="TaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
834 <xs:element maxOccurs="1" minOccurs="0" name="TtlAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
835 <xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="TaxRecordDetails1"/>
836 </xs:sequence>
837 </xs:complexType>
838 <xs:complexType name="TaxAuthorisation1">
839 <xs:sequence>
840 <xs:element maxOccurs="1" minOccurs="0" name="Titl" type="Max35Text"/>
841 <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
842 </xs:sequence>
843 </xs:complexType>
844 <xs:complexType name="TaxInformation3">
845 <xs:sequence>
846 <xs:element maxOccurs="1" minOccurs="0" name="Cdtr" type="TaxParty1"/>
847 <xs:element maxOccurs="1" minOccurs="0" name="Dbtr" type="TaxParty2"/>
848 <xs:element maxOccurs="1" minOccurs="0" name="AdmstnZn" type="Max35Text"/>
849 <xs:element maxOccurs="1" minOccurs="0" name="RefNb" type="Max140Text"/>
850 <xs:element maxOccurs="1" minOccurs="0" name="Mtd" type="Max35Text"/>
851 <xs:element maxOccurs="1" minOccurs="0" name="TtlTaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
852 <xs:element maxOccurs="1" minOccurs="0" name="TtlTaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
853 <xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
854 <xs:element maxOccurs="1" minOccurs="0" name="SeqNb" type="Number"/>
855 <xs:element maxOccurs="unbounded" minOccurs="0" name="Rcrd" type="TaxRecord1"/>
856 </xs:sequence>
857 </xs:complexType>
858 <xs:complexType name="TaxParty1">
859 <xs:sequence>
860 <xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
861 <xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
862 <xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
863 </xs:sequence>
864 </xs:complexType>
865 <xs:complexType name="TaxParty2">
866 <xs:sequence>
867 <xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
868 <xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
869 <xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
870 <xs:element maxOccurs="1" minOccurs="0" name="Authstn" type="TaxAuthorisation1"/>
871 </xs:sequence>
872 </xs:complexType>
873 <xs:complexType name="TaxPeriod1">
874 <xs:sequence>
875 <xs:element maxOccurs="1" minOccurs="0" name="Yr" type="ISODate"/>
876 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="TaxRecordPeriod1Code"/>
877 <xs:element maxOccurs="1" minOccurs="0" name="FrToDt" type="DatePeriodDetails"/>
878 </xs:sequence>
879 </xs:complexType>
880 <xs:complexType name="TaxRecord1">
881 <xs:sequence>
882 <xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
883 <xs:element maxOccurs="1" minOccurs="0" name="Ctgy" type="Max35Text"/>
884 <xs:element maxOccurs="1" minOccurs="0" name="CtgyDtls" type="Max35Text"/>
885 <xs:element maxOccurs="1" minOccurs="0" name="DbtrSts" type="Max35Text"/>
886 <xs:element maxOccurs="1" minOccurs="0" name="CertId" type="Max35Text"/>
887 <xs:element maxOccurs="1" minOccurs="0" name="FrmsCd" type="Max35Text"/>
888 <xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
889 <xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="TaxAmount1"/>
890 <xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
891 </xs:sequence>
892 </xs:complexType>
893 <xs:complexType name="TaxRecordDetails1">
894 <xs:sequence>
895 <xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
896 <xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
897 </xs:sequence>
898 </xs:complexType>
899 <xs:simpleType name="TaxRecordPeriod1Code">
900 <xs:restriction base="xs:string">
901 <xs:enumeration value="MM01"/>
902 <xs:enumeration value="MM02"/>
903 <xs:enumeration value="MM03"/>
904 <xs:enumeration value="MM04"/>
905 <xs:enumeration value="MM05"/>
906 <xs:enumeration value="MM06"/>
907 <xs:enumeration value="MM07"/>
908 <xs:enumeration value="MM08"/>
909 <xs:enumeration value="MM09"/>
910 <xs:enumeration value="MM10"/>
911 <xs:enumeration value="MM11"/>
912 <xs:enumeration value="MM12"/>
913 <xs:enumeration value="QTR1"/>
914 <xs:enumeration value="QTR2"/>
915 <xs:enumeration value="QTR3"/>
916 <xs:enumeration value="QTR4"/>
917 <xs:enumeration value="HLF1"/>
918 <xs:enumeration value="HLF2"/>
919 </xs:restriction>
920 </xs:simpleType>
921</xs:schema>

Subscribers

People subscribed via source and target branches