mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] Adapt to field 'code' no longer present on res.bank in 6.1
[FIX] Do not automatically create res.bank from online lookups when no BIC,
as res.bank is not required on res.partner.bank anymore in 6.1.
[FIX] Add field 'state' to statement line form as used by webclient to
determine readonly property of some other fields
This commit is contained in:
@@ -1457,7 +1457,6 @@ class res_bank(osv.osv):
|
||||
# Only the first eight positions of BIC are used for bank
|
||||
# transfers, so ditch the rest.
|
||||
bic = info.bic[:8],
|
||||
code = info.code,
|
||||
street = address.street,
|
||||
street2 =
|
||||
address.has_key('street2') and address.street2 or False,
|
||||
|
||||
@@ -297,6 +297,7 @@
|
||||
<field name="reconcile_id"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page/field[@name='line_ids']/form/field[@name='amount']" position="after">
|
||||
<field name="state"/>
|
||||
<field name="invoice_id"/>
|
||||
<field name="reconcile_id"/>
|
||||
</xpath>
|
||||
|
||||
@@ -374,35 +374,6 @@ def create_bank_account(pool, cursor, uid, partner_id,
|
||||
if bic:
|
||||
values.bank = get_or_create_bank(pool, cursor, uid, bic)[0]
|
||||
|
||||
else:
|
||||
if not bankcode:
|
||||
bankcode = "UNKNOW"
|
||||
# Try to link bank
|
||||
bank_obj = pool.get('res.bank')
|
||||
bank_ids = bank_obj.search(cursor, uid, [
|
||||
('code', 'ilike', bankcode)
|
||||
])
|
||||
if bank_ids:
|
||||
# Check BIC on existing banks
|
||||
values.bank = bank_ids[0]
|
||||
bank = bank_obj.browse(cursor, uid, values.bank)
|
||||
if not bank.bic:
|
||||
bank_obj.write(cursor, uid, values.bank, dict(bic=bic))
|
||||
else:
|
||||
# New bank - create
|
||||
res = struct(country_id=country_id)
|
||||
if account_info:
|
||||
res.code = account_info.code
|
||||
# Only the first eight positions of BIC are used for bank
|
||||
# transfers, so ditch the rest.
|
||||
res.bic = account_info.bic[:8]
|
||||
res.name = account_info.bank
|
||||
else:
|
||||
res.code = bankcode
|
||||
res.name = _('Unknown Bank')
|
||||
|
||||
values.bank = bank_obj.create(cursor, uid, res)
|
||||
|
||||
# Create bank account and return
|
||||
return pool.get('res.partner.bank').create(cursor, uid, values)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user