Merge lp:~jamesj/banking-addons/hsbc-client-id into lp:banking-addons/6.0

Proposed by James Jesudason
Status: Merged
Merged at revision: 74
Proposed branch: lp:~jamesj/banking-addons/hsbc-client-id
Merge into: lp:banking-addons/6.0
Diff against target: 191 lines (+133/-1)
6 files modified
account_banking_uk_hsbc/__init__.py (+1/-0)
account_banking_uk_hsbc/__openerp__.py (+2/-0)
account_banking_uk_hsbc/hsbc_clientid.py (+48/-0)
account_banking_uk_hsbc/hsbc_clientid_view.xml (+76/-0)
account_banking_uk_hsbc/security/ir.model.access.csv (+3/-0)
account_banking_uk_hsbc/wizard/export_hsbc.py (+3/-1)
To merge this branch: bzr merge lp:~jamesj/banking-addons/hsbc-client-id
Reviewer Review Type Date Requested Status
Dimitri John Ledkov (ex-credativ) (community) Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+93254@code.launchpad.net

Commit message

[ADD] Added ability to store the HSBC Client ID for HSBCNet, and use that on the payment files.

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi,

you'll understand that I am pretty agnostic with regards to changes in the HSBC module, so I will from now on refrain from commenting on branches that do not affect other parts of the banking addons.

Cheers,
Stefan.

review: Approve
Revision history for this message
James Jesudason (jamesj) wrote :

Hi,

I understand. I've requested a review from Dmitrijs as we discussed the issue and the solution is his idea.

Revision history for this message
Dimitri John Ledkov (ex-credativ) (dle-credativ) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_uk_hsbc/__init__.py'
2--- account_banking_uk_hsbc/__init__.py 2011-10-31 10:59:25 +0000
3+++ account_banking_uk_hsbc/__init__.py 2012-02-15 17:33:24 +0000
4@@ -22,4 +22,5 @@
5 import account_banking_uk_hsbc
6 import wizard
7 import hsbc_mt940
8+import hsbc_clientid
9 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
10
11=== modified file 'account_banking_uk_hsbc/__openerp__.py'
12--- account_banking_uk_hsbc/__openerp__.py 2011-11-18 17:41:16 +0000
13+++ account_banking_uk_hsbc/__openerp__.py 2012-02-15 17:33:24 +0000
14@@ -29,8 +29,10 @@
15 'init_xml': [],
16 'update_xml': [
17 'account_banking_uk_hsbc.xml',
18+ 'hsbc_clientid_view.xml',
19 'data/banking_export_hsbc.xml',
20 'wizard/export_hsbc_view.xml',
21+ 'security/ir.model.access.csv',
22 ],
23 'demo_xml': [],
24 'description': '''
25
26=== added file 'account_banking_uk_hsbc/hsbc_clientid.py'
27--- account_banking_uk_hsbc/hsbc_clientid.py 1970-01-01 00:00:00 +0000
28+++ account_banking_uk_hsbc/hsbc_clientid.py 2012-02-15 17:33:24 +0000
29@@ -0,0 +1,48 @@
30+# -*- encoding: utf-8 -*-
31+from osv import osv, fields
32+
33+class hsbc_clientid(osv.osv):
34+ """
35+ Record to hold the HSBCNet Client ID for the company.
36+ """
37+ _name = 'banking.hsbc.clientid'
38+ _description = 'HSBC Client ID'
39+
40+ _columns = {
41+ 'name': fields.char('Name', size=64, required=True),
42+ 'clientid': fields.char('Client ID', size=20, required=True),
43+ 'company_id': fields.many2one('res.company','Company', required=True),
44+ }
45+
46+ _defaults = {
47+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
48+ }
49+
50+hsbc_clientid()
51+
52+
53+class payment_order(osv.osv):
54+ _name = 'payment.order'
55+ _inherit = 'payment.order'
56+
57+ _columns = {
58+ 'hsbc_clientid_id': fields.many2one('banking.hsbc.clientid', 'HSBC Client ID', required=True),
59+ }
60+
61+
62+ def _default_hsbc_clientid(self, cr, uid, context=None):
63+ company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
64+
65+ clientid_ids = self.pool.get('banking.hsbc.clientid').search(cr, uid, [('company_id','=',company_id)])
66+ if len(clientid_ids)==0:
67+ return False
68+ else:
69+ return clientid_ids[0]
70+
71+
72+ _defaults = {
73+ 'hsbc_clientid_id':_default_hsbc_clientid,
74+ }
75+
76+payment_order()
77+
78
79=== added file 'account_banking_uk_hsbc/hsbc_clientid_view.xml'
80--- account_banking_uk_hsbc/hsbc_clientid_view.xml 1970-01-01 00:00:00 +0000
81+++ account_banking_uk_hsbc/hsbc_clientid_view.xml 2012-02-15 17:33:24 +0000
82@@ -0,0 +1,76 @@
83+<?xml version="1.0" encoding="utf-8"?>
84+<openerp>
85+ <data>
86+
87+ <!-- Add the HSBC Client ID to the Payment Order -->
88+ <record id="view_payment_order_form" model="ir.ui.view">
89+ <field name="name">payment.order.form</field>
90+ <field name="model">payment.order</field>
91+ <field name="type">form</field>
92+ <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
93+ <field name="arch" type="xml">
94+ <field name="date_scheduled" position="after">
95+ <field name="hsbc_clientid_id" />
96+ </field>
97+ </field>
98+ </record>
99+
100+
101+ <!-- Form view for HSBC Client ID -->
102+ <record id="banking_hsbc_clientid_form" model="ir.ui.view">
103+ <field name="name">banking.hsbc.clientid.form</field>
104+ <field name="model">banking.hsbc.clientid</field>
105+ <field name="type">form</field>
106+ <field name="arch" type="xml">
107+ <form string="HSBC Client ID">
108+ <group colspan="4">
109+ <field name="name" />
110+ <field name="company_id" />
111+ <field name="clientid" />
112+ </group>
113+ </form>
114+ </field>
115+ </record>
116+
117+ <!-- Tree view for HSBC Client ID -->
118+ <record id="banking_hsbc_clientid_tree" model="ir.ui.view">
119+ <field name="name">banking.hsbc.clientid.tree</field>
120+ <field name="model">banking.hsbc.clientid</field>
121+ <field name="type">tree</field>
122+ <field name="arch" type="xml">
123+ <tree string="HSBC Client IDs">
124+ <field name="name" />
125+ <field name="company_id" />
126+ <field name="clientid" />
127+ </tree>
128+ </field>
129+ </record>
130+
131+ <!-- Search view for HSBC Client ID -->
132+ <record id="banking_hsbc_clientid_filter" model="ir.ui.view">
133+ <field name="name">banking.hsbc.clientid.filter</field>
134+ <field name="model">banking.hsbc.clientid</field>
135+ <field name="type">search</field>
136+ <field name="arch" type="xml">
137+ <search string="HSBC Client IDs">
138+ <field name="name"/>
139+ <field name="company_id" />
140+ <field name="clientid" />
141+ </search>
142+ </field>
143+ </record>
144+
145+ <!-- Action for HSBC Client ID -->
146+ <record id="banking_hsbc_clientid_action" model="ir.actions.act_window">
147+ <field name="name">HSBC Client ID</field>
148+ <field name="res_model">banking.hsbc.clientid</field>
149+ <field name="view_type">form</field>
150+ <field name="view_mode">tree,form</field>
151+ <field name="search_view_id" ref="banking_hsbc_clientid_filter"/>
152+ </record>
153+
154+ <!-- Menu for HSBC Client ID -->
155+ <menuitem action="banking_hsbc_clientid_action" id="banking_hsbc_clientid_menu" parent="account.menu_configuration_misc"/>
156+
157+ </data>
158+</openerp>
159\ No newline at end of file
160
161=== added directory 'account_banking_uk_hsbc/security'
162=== added file 'account_banking_uk_hsbc/security/ir.model.access.csv'
163--- account_banking_uk_hsbc/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
164+++ account_banking_uk_hsbc/security/ir.model.access.csv 2012-02-15 17:33:24 +0000
165@@ -0,0 +1,3 @@
166+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
167+"access_banking_hsbc_clientid","banking.hsbc.clientid","model_banking_hsbc_clientid","account_payment.group_account_payment",1,1,1,1
168+
169
170=== modified file 'account_banking_uk_hsbc/wizard/export_hsbc.py'
171--- account_banking_uk_hsbc/wizard/export_hsbc.py 2012-01-11 18:21:15 +0000
172+++ account_banking_uk_hsbc/wizard/export_hsbc.py 2012-02-15 17:33:24 +0000
173@@ -298,8 +298,10 @@
174 try:
175 self.logger.notifyChannel('paymul', netsvc.LOG_INFO, 'Create transactions...')
176 transactions = []
177+ hsbc_clientid = ''
178 for po in payment_orders:
179 transactions += [self._create_transaction(l) for l in po.line_ids]
180+ hsbc_clientid = po.hsbc_clientid_id.clientid
181
182 batch = paymul.Batch(
183 exec_date=strpdate(wizard_data.execution_date_create),
184@@ -328,7 +330,7 @@
185
186 message = paymul.Message(reference=ref)
187 message.batches.append(batch)
188- interchange = paymul.Interchange(client_id='CLIENTID',
189+ interchange = paymul.Interchange(client_id=hsbc_clientid,
190 reference=ref,
191 message=message)
192

Subscribers

People subscribed via source and target branches