mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MERGE] Added ability to store the HSBC Client ID for HSBCNet
This commit is contained in:
committed by
Dmitrijs Ledkovs (credativ)
commit
179a122ae4
@@ -22,4 +22,5 @@
|
||||
import account_banking_uk_hsbc
|
||||
import wizard
|
||||
import hsbc_mt940
|
||||
import hsbc_clientid
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'account_banking_uk_hsbc.xml',
|
||||
'hsbc_clientid_view.xml',
|
||||
'data/banking_export_hsbc.xml',
|
||||
'wizard/export_hsbc_view.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'description': '''
|
||||
|
||||
48
account_banking_uk_hsbc/hsbc_clientid.py
Normal file
48
account_banking_uk_hsbc/hsbc_clientid.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
from osv import osv, fields
|
||||
|
||||
class hsbc_clientid(osv.osv):
|
||||
"""
|
||||
Record to hold the HSBCNet Client ID for the company.
|
||||
"""
|
||||
_name = 'banking.hsbc.clientid'
|
||||
_description = 'HSBC Client ID'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
'clientid': fields.char('Client ID', size=20, required=True),
|
||||
'company_id': fields.many2one('res.company','Company', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
|
||||
hsbc_clientid()
|
||||
|
||||
|
||||
class payment_order(osv.osv):
|
||||
_name = 'payment.order'
|
||||
_inherit = 'payment.order'
|
||||
|
||||
_columns = {
|
||||
'hsbc_clientid_id': fields.many2one('banking.hsbc.clientid', 'HSBC Client ID', required=True),
|
||||
}
|
||||
|
||||
|
||||
def _default_hsbc_clientid(self, cr, uid, context=None):
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
|
||||
clientid_ids = self.pool.get('banking.hsbc.clientid').search(cr, uid, [('company_id','=',company_id)])
|
||||
if len(clientid_ids)==0:
|
||||
return False
|
||||
else:
|
||||
return clientid_ids[0]
|
||||
|
||||
|
||||
_defaults = {
|
||||
'hsbc_clientid_id':_default_hsbc_clientid,
|
||||
}
|
||||
|
||||
payment_order()
|
||||
|
||||
76
account_banking_uk_hsbc/hsbc_clientid_view.xml
Normal file
76
account_banking_uk_hsbc/hsbc_clientid_view.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Add the HSBC Client ID to the Payment Order -->
|
||||
<record id="view_payment_order_form" model="ir.ui.view">
|
||||
<field name="name">payment.order.form</field>
|
||||
<field name="model">payment.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_scheduled" position="after">
|
||||
<field name="hsbc_clientid_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Form view for HSBC Client ID -->
|
||||
<record id="banking_hsbc_clientid_form" model="ir.ui.view">
|
||||
<field name="name">banking.hsbc.clientid.form</field>
|
||||
<field name="model">banking.hsbc.clientid</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="HSBC Client ID">
|
||||
<group colspan="4">
|
||||
<field name="name" />
|
||||
<field name="company_id" />
|
||||
<field name="clientid" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Tree view for HSBC Client ID -->
|
||||
<record id="banking_hsbc_clientid_tree" model="ir.ui.view">
|
||||
<field name="name">banking.hsbc.clientid.tree</field>
|
||||
<field name="model">banking.hsbc.clientid</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="HSBC Client IDs">
|
||||
<field name="name" />
|
||||
<field name="company_id" />
|
||||
<field name="clientid" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Search view for HSBC Client ID -->
|
||||
<record id="banking_hsbc_clientid_filter" model="ir.ui.view">
|
||||
<field name="name">banking.hsbc.clientid.filter</field>
|
||||
<field name="model">banking.hsbc.clientid</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="HSBC Client IDs">
|
||||
<field name="name"/>
|
||||
<field name="company_id" />
|
||||
<field name="clientid" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action for HSBC Client ID -->
|
||||
<record id="banking_hsbc_clientid_action" model="ir.actions.act_window">
|
||||
<field name="name">HSBC Client ID</field>
|
||||
<field name="res_model">banking.hsbc.clientid</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="banking_hsbc_clientid_filter"/>
|
||||
</record>
|
||||
|
||||
<!-- Menu for HSBC Client ID -->
|
||||
<menuitem action="banking_hsbc_clientid_action" id="banking_hsbc_clientid_menu" parent="account.menu_configuration_misc"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
3
account_banking_uk_hsbc/security/ir.model.access.csv
Normal file
3
account_banking_uk_hsbc/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_banking_hsbc_clientid","banking.hsbc.clientid","model_banking_hsbc_clientid","account_payment.group_account_payment",1,1,1,1
|
||||
|
||||
|
@@ -298,8 +298,10 @@ class banking_export_hsbc_wizard(osv.osv_memory):
|
||||
try:
|
||||
self.logger.notifyChannel('paymul', netsvc.LOG_INFO, 'Create transactions...')
|
||||
transactions = []
|
||||
hsbc_clientid = ''
|
||||
for po in payment_orders:
|
||||
transactions += [self._create_transaction(l) for l in po.line_ids]
|
||||
hsbc_clientid = po.hsbc_clientid_id.clientid
|
||||
|
||||
batch = paymul.Batch(
|
||||
exec_date=strpdate(wizard_data.execution_date_create),
|
||||
@@ -328,7 +330,7 @@ class banking_export_hsbc_wizard(osv.osv_memory):
|
||||
|
||||
message = paymul.Message(reference=ref)
|
||||
message.batches.append(batch)
|
||||
interchange = paymul.Interchange(client_id='CLIENTID',
|
||||
interchange = paymul.Interchange(client_id=hsbc_clientid,
|
||||
reference=ref,
|
||||
message=message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user