mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[ADD] Ability to store the HSBC Client ID for HSBCNet, and use that on the payment files
[FIX] Upgrading to version 6.1
This commit is contained in:
@@ -1135,7 +1135,7 @@ class res_partner_bank(osv.osv):
|
||||
'''
|
||||
Create dual function IBAN account for SEPA countries
|
||||
'''
|
||||
return self._founder.create(self, cursor, uid,
|
||||
return self._founder.create(cursor, uid,
|
||||
self._correct_IBAN(vals), context
|
||||
)
|
||||
|
||||
@@ -1143,7 +1143,7 @@ class res_partner_bank(osv.osv):
|
||||
'''
|
||||
Create dual function IBAN account for SEPA countries
|
||||
'''
|
||||
return self._founder.write(self, cursor, uid, ids,
|
||||
return self._founder.write(cursor, uid, ids,
|
||||
self._correct_IBAN(vals), context
|
||||
)
|
||||
|
||||
@@ -1207,7 +1207,7 @@ class res_partner_bank(osv.osv):
|
||||
newargs = extended_search_expression(args)
|
||||
|
||||
# Original search (_founder)
|
||||
results = self._founder.search(self, cursor, uid, newargs,
|
||||
results = self._founder.search(cursor, uid, newargs,
|
||||
*rest, **kwargs
|
||||
)
|
||||
return results
|
||||
@@ -1216,7 +1216,7 @@ class res_partner_bank(osv.osv):
|
||||
'''
|
||||
Convert IBAN electronic format to IBAN display format
|
||||
'''
|
||||
records = self._founder.read(self, *args, **kwargs)
|
||||
records = self._founder.read(*args, **kwargs)
|
||||
if not isinstance(records, list):
|
||||
records = [records,]
|
||||
for record in records:
|
||||
@@ -1239,6 +1239,7 @@ class res_partner_bank(osv.osv):
|
||||
'''
|
||||
Return the local bank account number aka BBAN from the IBAN.
|
||||
'''
|
||||
res = {}
|
||||
for record in self.browse(cursor, uid, ids, context):
|
||||
if not record.iban:
|
||||
res[record.id] = False
|
||||
@@ -1247,7 +1248,7 @@ class res_partner_bank(osv.osv):
|
||||
try:
|
||||
res[record.id] = iban_acc.localized_BBAN
|
||||
except NotImplementedError:
|
||||
res[record_id] = False
|
||||
res[record.id] = False
|
||||
return res
|
||||
|
||||
def onchange_acc_number(self, cursor, uid, ids, acc_number,
|
||||
@@ -1264,6 +1265,7 @@ class res_partner_bank(osv.osv):
|
||||
values = {}
|
||||
country_obj = self.pool.get('res.country')
|
||||
country_ids = []
|
||||
country = False
|
||||
|
||||
# Pre fill country based on available data. This is just a default
|
||||
# which can be overridden by the user.
|
||||
@@ -1294,12 +1296,8 @@ class res_partner_bank(osv.osv):
|
||||
# the handling user
|
||||
if not country_ids:
|
||||
user = self.pool.get('res.users').browse(cursor, uid, uid)
|
||||
# Try users address first
|
||||
if user.address_id and user.address_id.country_id:
|
||||
country = user.address_id.country_id
|
||||
country_ids = [country.id]
|
||||
# Last try user companies partner
|
||||
elif (user.company_id and
|
||||
# Try user companies partner (user no longer has address in 6.1)
|
||||
if (user.company_id and
|
||||
user.company_id.partner_id and
|
||||
user.company_id.partner_id.country
|
||||
):
|
||||
@@ -1316,7 +1314,7 @@ class res_partner_bank(osv.osv):
|
||||
)
|
||||
result = {'value': values}
|
||||
# Complete data with online database when available
|
||||
if country.code in sepa.IBAN.countries:
|
||||
if partner_id and country.code in sepa.IBAN.countries:
|
||||
try:
|
||||
info = sepa.online.account_info(country.code, acc_number)
|
||||
if info:
|
||||
|
||||
@@ -120,6 +120,16 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_account_banking_imported_line_search" model="ir.ui.view">
|
||||
<field name="name">account.banking.imported.line.search</field>
|
||||
<field name="model">account.bank.imported.line</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Bank Statement files">
|
||||
<field name="company_id" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_account_banking_imported_files">
|
||||
<field name="name">Imported Bank Statements Files</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -345,7 +355,7 @@
|
||||
</record>
|
||||
|
||||
<!-- Set trigger on IBAN and acc_number fields in res_partner_bank form -->
|
||||
<record id="view_partner_bank_account_banking_form_1" model="ir.ui.view">
|
||||
<!--record id="view_partner_bank_account_banking_form_1" model="ir.ui.view">
|
||||
<field name="name">res.partner.bank.form.banking-1</field>
|
||||
<field name="model">res.partner.bank</field>
|
||||
<field name="inherit_id" ref="base_iban.view_partner_bank_iban_form"/>
|
||||
@@ -355,7 +365,7 @@
|
||||
<field name="iban" on_change="onchange_iban(iban)" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</record-->
|
||||
<record id="view_partner_bank_account_banking_form_2" model="ir.ui.view">
|
||||
<field name="name">res.partner.bank.form.banking-2</field>
|
||||
<field name="model">res.partner.bank</field>
|
||||
@@ -364,12 +374,15 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="acc_number" position="replace">
|
||||
<field name="acc_number" on_change="onchange_acc_number(acc_number, partner_id, country_id)"/>
|
||||
<newline />
|
||||
<field name="iban" on_change="onchange_iban(iban)" />
|
||||
<newline />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Set trigger on IBAN and acc_number field in res_partner form -->
|
||||
<record id="view_partner_account_banking_form_1" model="ir.ui.view">
|
||||
<!--record id="view_partner_account_banking_form_1" model="ir.ui.view">
|
||||
<field name="name">res.partner.form.banking-1</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base_iban.view_partner_iban_form"/>
|
||||
@@ -379,7 +392,7 @@
|
||||
<field name="iban" on_change="onchange_iban(iban)" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</record-->
|
||||
<record id="view_partner_account_banking_form_2" model="ir.ui.view">
|
||||
<field name="name">res.partner.form.banking-2</field>
|
||||
<field name="model">res.partner</field>
|
||||
@@ -388,7 +401,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='bank_ids']/form/field[@name='acc_number']" position="replace">
|
||||
<field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" />
|
||||
</xpath>
|
||||
<newline />
|
||||
<field name="iban" on_change="onchange_iban(iban)" />
|
||||
<newline />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_partner_account_banking_form_3" model="ir.ui.view">
|
||||
@@ -399,6 +415,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='bank_ids']/tree/field[@name='acc_number']" position="replace">
|
||||
<field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" select="1" />
|
||||
<field name="iban" on_change="onchange_iban(iban)" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1378,6 +1378,7 @@ class banking_import_transaction(osv.osv):
|
||||
if (not values['partner_bank_id'] and partner_banks and
|
||||
len(partner_banks) == 1):
|
||||
values['partner_bank_id'] = partner_banks[0].id
|
||||
|
||||
if not transaction.statement_line_id:
|
||||
values.update(dict(
|
||||
name = '%s.%s' % (transaction.statement, transaction.transaction),
|
||||
@@ -1391,6 +1392,7 @@ class banking_import_transaction(osv.osv):
|
||||
account_id = account_id,
|
||||
import_transaction_id = transaction.id,
|
||||
))
|
||||
|
||||
statement_line_id = statement_line_obj.create(cr, uid, values, context)
|
||||
results['trans_loaded_cnt'] += 1
|
||||
self_values['statement_line_id'] = statement_line_id
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Re-introduce changes that were removed in 6.1 -->
|
||||
<record id="bank_iban_field" model="res.partner.bank.type.field">
|
||||
<field name="name">iban</field>
|
||||
<field name="bank_type_id" ref="base_iban.bank_iban"/>
|
||||
<field eval="True" name="required"/>
|
||||
<field eval="False" name="readonly"/>
|
||||
</record>
|
||||
|
||||
<!-- Unset readonly state of acc_number for IBAN accounts.
|
||||
Leaving it will make it impossible to deduce BBAN's from any
|
||||
client.
|
||||
|
||||
@@ -118,6 +118,7 @@ class banking_import(osv.osv_memory):
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
statement_file_obj = self.pool.get('account.banking.imported.file')
|
||||
import_transaction_obj = self.pool.get('banking.import.transaction')
|
||||
period_obj = self.pool.get('account.period')
|
||||
|
||||
# get the parser to parse the file
|
||||
parser_code = banking_import.parser
|
||||
@@ -256,6 +257,12 @@ class banking_import(osv.osv_memory):
|
||||
)
|
||||
continue
|
||||
|
||||
# Get the period for the statement (as bank statement object checks this)
|
||||
period_ids = period_obj.search(cursor, uid, [('company_id','=',company.id),
|
||||
('date_start','<=',statement.date),
|
||||
('date_stop','>=',statement.date)])
|
||||
|
||||
# Create the bank statement record
|
||||
statement_id = statement_obj.create(cursor, uid, dict(
|
||||
name = statement.id,
|
||||
journal_id = account_info.journal_id.id,
|
||||
@@ -266,6 +273,8 @@ class banking_import(osv.osv_memory):
|
||||
state = 'draft',
|
||||
user_id = uid,
|
||||
banking_id = import_id,
|
||||
company_id = company.id,
|
||||
period_id = period_ids[0],
|
||||
))
|
||||
imported_statement_ids.append(statement_id)
|
||||
|
||||
@@ -282,6 +291,8 @@ class banking_import(osv.osv_memory):
|
||||
values[attr] = eval('transaction.%s' % attr)
|
||||
values['statement_id'] = statement_id
|
||||
values['bank_country_code'] = bank_country_code
|
||||
values['local_account'] = statement.local_account
|
||||
|
||||
transaction_id = import_transaction_obj.create(cursor, uid, values, context=context)
|
||||
if transaction_id:
|
||||
transaction_ids.append(transaction_id)
|
||||
@@ -292,6 +303,30 @@ class banking_import(osv.osv_memory):
|
||||
|
||||
import_transaction_obj.match(cursor, uid, transaction_ids, results=results, context=context)
|
||||
|
||||
#recompute statement end_balance for validation
|
||||
statement_obj.button_dummy(
|
||||
cursor, uid, imported_statement_ids, context=context)
|
||||
|
||||
|
||||
# Original code. Didn't take workflow logistics into account...
|
||||
#
|
||||
#cursor.execute(
|
||||
# "UPDATE payment_order o "
|
||||
# "SET state = 'done', "
|
||||
# "date_done = '%s' "
|
||||
# "FROM payment_line l "
|
||||
# "WHERE o.state = 'sent' "
|
||||
# "AND o.id = l.order_id "
|
||||
# "AND l.id NOT IN ("
|
||||
# "SELECT DISTINCT id FROM payment_line "
|
||||
# "WHERE date_done IS NULL "
|
||||
# "AND id IN (%s)"
|
||||
# ")" % (
|
||||
# time.strftime('%Y-%m-%d'),
|
||||
# ','.join([str(x) for x in payment_line_ids])
|
||||
# )
|
||||
#)
|
||||
|
||||
report = [
|
||||
'%s: %s' % (_('Total number of statements'),
|
||||
results.stat_skipped_cnt + results.stat_loaded_cnt),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<notebook colspan="4">
|
||||
<page attrs="{'invisible': [('state', '!=', 'review')]}" string="Transactions">
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Transaction" min_rows="20" colors="red:duplicate;blue:reconcile_id">
|
||||
<tree string="Transaction" colors="red:duplicate;blue:reconcile_id">
|
||||
<field name="date"/>
|
||||
<field name="amount"/>
|
||||
<field name="ref"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page attrs="{'invisible': [('state', '=', 'init'')]}" string="Log">
|
||||
<page attrs="{'invisible': [('state', '=', 'init')]}" string="Log">
|
||||
<field name="log" colspan="4" nolabel="1" width="500"/>
|
||||
</page>
|
||||
<page attrs="{'invisible': [('state', '!=', 'ready')]}" string="Statements">
|
||||
|
||||
@@ -38,7 +38,7 @@ class banking_transaction_wizard(osv.osv_memory):
|
||||
"""
|
||||
Return a popup window for this model
|
||||
"""
|
||||
if isinstance(ids, (int, float)):
|
||||
if isinstance(ids, (int,long)):
|
||||
ids = [ids]
|
||||
return {
|
||||
'name': self._description,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<field name='payment_line_id'
|
||||
attrs="{'invisible': [('match_type', '!=', 'storno'),('match_type', '!=', 'payment')]}"
|
||||
/>
|
||||
<group attrs="{'readonly': [('match_multi', '!=' True)]}">
|
||||
<group attrs="{'readonly': [('match_multi', '!=', True)]}">
|
||||
<!-- show if we have an invoice type match (but the user may need to select from multiple options)
|
||||
or whenever there is an invoice_id (e.g. in case of a manual match)
|
||||
-->
|
||||
|
||||
@@ -242,6 +242,7 @@ def get_company_bank_account(pool, cursor, uid, account_number, currency,
|
||||
results.costs_account_id = settings.costs_account_id
|
||||
results.invoice_journal_id = settings.invoice_journal_id
|
||||
results.bank_partner_id = settings.bank_partner_id
|
||||
|
||||
return results
|
||||
|
||||
def get_or_create_bank(pool, cursor, uid, bic, online=False, code=None,
|
||||
@@ -261,7 +262,7 @@ def get_or_create_bank(pool, cursor, uid, bic, online=False, code=None,
|
||||
# search key
|
||||
bank_ids = bank_obj.search(
|
||||
cursor, uid, [
|
||||
('code', '=', bic[:6])
|
||||
('bic', '=', bic[:6])
|
||||
])
|
||||
if not bank_ids:
|
||||
bank_ids = bank_obj.search(
|
||||
|
||||
Reference in New Issue
Block a user