mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] check partner_id on statement line is defined before browsing further
[FIX] translation typo [FIX] Do not write obsolete field 'code' to res.bank [ADD] Write bic field to res.partner.bank when found [FIX] Super() called with wrong object name [FIX] Disable invalid (and unused) xpath expression [RFR] Adapt NL Clieop module to API changes in 6.1 [FIX] Clieop export counter per day was always 1
This commit is contained in:
@@ -1143,6 +1143,9 @@ class res_partner_bank(osv.osv):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
'''
|
||||
Create dual function IBAN account for SEPA countries
|
||||
|
||||
Update the domestic account number when the IBAN is
|
||||
written, or clear the domestic number on regular account numbers.
|
||||
'''
|
||||
if ids and isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
@@ -1150,7 +1153,7 @@ class res_partner_bank(osv.osv):
|
||||
cr, uid, ids, ['state', 'acc_number']):
|
||||
if 'state' in vals or 'acc_number' in vals:
|
||||
account.update(vals)
|
||||
if 'state' in vals and vals['state'] == 'iban':
|
||||
if account['state'] == 'iban':
|
||||
vals['acc_number'], vals['acc_number_domestic'] = (
|
||||
self._correct_IBAN(account['acc_number']))
|
||||
else:
|
||||
@@ -1362,12 +1365,14 @@ class res_partner_bank(osv.osv):
|
||||
bank_id, country_id = get_or_create_bank(
|
||||
self.pool, cursor, uid,
|
||||
info.bic or iban_acc.BIC_searchkey,
|
||||
code = info.code, name = info.bank
|
||||
name = info.bank
|
||||
)
|
||||
values['country_id'] = country_id or \
|
||||
country_ids and country_ids[0] or \
|
||||
False
|
||||
values['bank'] = bank_id or False
|
||||
if info.bic:
|
||||
values['bank_bic'] = info.bic
|
||||
else:
|
||||
info = None
|
||||
if info is None:
|
||||
|
||||
@@ -1515,7 +1515,7 @@ class banking_import_transaction(osv.osv):
|
||||
stline_pool = self.pool.get('account.bank.statement.line')
|
||||
|
||||
res = {}
|
||||
|
||||
|
||||
for transaction in self.browse(cr, uid, ids, context):
|
||||
|
||||
if transaction.move_line_id:
|
||||
@@ -1844,7 +1844,7 @@ class account_bank_statement_line(osv.osv):
|
||||
# Define the voucher
|
||||
voucher = {
|
||||
'journal_id': st_line.statement_id.journal_id.id,
|
||||
'partner_id': st_line.partner_id.id,
|
||||
'partner_id': st_line.partner_id and st_line.partner_id.id or False,
|
||||
'company_id': st_line.company_id.id,
|
||||
'type':voucher_type,
|
||||
'company_id': st_line.company_id.id,
|
||||
@@ -1935,7 +1935,7 @@ class account_bank_statement_line(osv.osv):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.state == 'confirmed':
|
||||
raise osv.except_osv(_('Confirmed Statement Line'), _("You cannot delete a confirmed Statement Line: '%s'" % line.name))
|
||||
return super(account_bank_statement,self).unlink(cr, uid, ids, context=context)
|
||||
return super(account_bank_statement_line,self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
|
||||
@@ -13,6 +13,13 @@
|
||||
<field eval="False" name="required"/>
|
||||
<field eval="False" name="readonly"/>
|
||||
</record>
|
||||
<!--
|
||||
BIC is not legally required
|
||||
See https://bugs.launchpad.net/bugs/933472
|
||||
-->
|
||||
<record id="base_iban.bank_swift_field" model="res.partner.bank.type.field">
|
||||
<field eval="False" name="required"/>
|
||||
</record>
|
||||
<!-- Add manual bank transfer as default payment option -->
|
||||
<record model="payment.mode.type" id="account_banking.manual_bank_tranfer">
|
||||
<field name="name">Manual Bank Transfer</field>
|
||||
|
||||
@@ -1192,7 +1192,7 @@ msgstr "remote_owner_custno"
|
||||
#: view:account.banking.imported.file:0
|
||||
#: field:account.banking.imported.file,log:0
|
||||
msgid "Import Log"
|
||||
msgstr "Impotlog"
|
||||
msgstr "Importlog"
|
||||
|
||||
#. module: account_banking
|
||||
#: field:banking.import.line,date:0
|
||||
|
||||
@@ -373,6 +373,7 @@ def create_bank_account(pool, cursor, uid, partner_id,
|
||||
|
||||
if bic:
|
||||
values.bank = get_or_create_bank(pool, cursor, uid, bic)[0]
|
||||
values.bank_bic = bic
|
||||
|
||||
# Create bank account and return
|
||||
return pool.get('res.partner.bank').create(cursor, uid, values)
|
||||
|
||||
@@ -59,7 +59,7 @@ class clieop_export(osv.osv):
|
||||
('INCASSO', 'Direct Debit Batch'),
|
||||
], 'File Type', size=7, readonly=True, select=True),
|
||||
'date_generated':
|
||||
fields.datetime('Generation Date', readonly=True, select=True),
|
||||
fields.date('Generation Date', readonly=True, select=True),
|
||||
'file':
|
||||
fields.binary('ClieOp File', readonly=True),
|
||||
'state':
|
||||
@@ -69,24 +69,26 @@ class clieop_export(osv.osv):
|
||||
('done', 'Reconciled'),
|
||||
], 'State', readonly=True),
|
||||
}
|
||||
def _get_daynr(self, cursor, uid, ids, context):
|
||||
def get_daynr(self, cr, uid, context=None):
|
||||
'''
|
||||
Return highest day number
|
||||
'''
|
||||
last = cursor.execute('SELECT max(daynumber) '
|
||||
'FROM banking_export_clieop '
|
||||
'WHERE date_generated = "%s"' %
|
||||
date.today().strftime('%Y-%m-%d')
|
||||
).fetchone()
|
||||
if last:
|
||||
return int(last) +1
|
||||
return 1
|
||||
last = 1
|
||||
last_ids = self.search(cr, uid, [
|
||||
('date_generated', '=',
|
||||
fields.date.context_today(cr,uid,context))
|
||||
], context=context)
|
||||
if last_ids:
|
||||
last = 1 + max([x['daynumber'] for x in self.read(
|
||||
cr, uid, last_ids, ['daynumber'],
|
||||
context=context)])
|
||||
return last
|
||||
|
||||
_defaults = {
|
||||
'date_generated': lambda *a: date.today().strftime('%Y-%m-%d'),
|
||||
'duplicates': lambda *a: 1,
|
||||
'state': lambda *a: 'draft',
|
||||
'daynumber': _get_daynr,
|
||||
'date_generated': fields.date.context_today,
|
||||
'duplicates': 1,
|
||||
'state': 'draft',
|
||||
'daynumber': get_daynr,
|
||||
}
|
||||
clieop_export()
|
||||
|
||||
|
||||
@@ -237,11 +237,15 @@ class banking_export_clieop_wizard(osv.osv_memory):
|
||||
# Just once: create clieop file
|
||||
our_account_owner = payment_order.mode.bank_id.owner_name \
|
||||
or payment_order.mode.bank_id.partner_id.name
|
||||
our_account_nr = payment_order.mode.bank_id.acc_number
|
||||
if not our_account_nr and payment_order.mode.bank_id.iban:
|
||||
our_account_nr = sepa.IBAN(
|
||||
payment_order.mode.bank_id.iban
|
||||
).localized_BBAN
|
||||
|
||||
if payment_order.mode.bank_id.state == 'iban':
|
||||
our_account_nr = payment_order.mode.bank_id.acc_number_domestic
|
||||
if not our_account_nr:
|
||||
our_account_nr = sepa.IBAN(
|
||||
payment_order.mode.bank_id.acc_number
|
||||
).localized_BBAN
|
||||
else:
|
||||
our_account_nr = payment_order.mode.bank_id.acc_number
|
||||
if not our_account_nr:
|
||||
raise osv.except_osv(
|
||||
_('Error'),
|
||||
@@ -255,6 +259,9 @@ class banking_export_clieop_wizard(osv.osv_memory):
|
||||
execution_date = clieop_export['execution_date'],
|
||||
name_sender = our_account_owner,
|
||||
accountno_sender = our_account_nr,
|
||||
seqno = self.pool.get(
|
||||
'banking.export.clieop').get_daynr(
|
||||
cursor, uid, context=context),
|
||||
test = clieop_export['test']
|
||||
)
|
||||
|
||||
@@ -292,7 +299,11 @@ class banking_export_clieop_wizard(osv.osv_memory):
|
||||
)
|
||||
if line.communication2:
|
||||
kwargs['messages'] = [line.communication2]
|
||||
other_account_nr = line.bank_id.acc_number
|
||||
other_account_nr = (
|
||||
line.bank_id.state == 'iban' and
|
||||
line.bank_id.acc_number_domestic or
|
||||
line.bank_id.acc_number
|
||||
)
|
||||
iban = sepa.IBAN(other_account_nr)
|
||||
# Is this an IBAN account?
|
||||
if iban.valid:
|
||||
@@ -351,7 +362,7 @@ class banking_export_clieop_wizard(osv.osv_memory):
|
||||
Cancel the ClieOp: just drop the file
|
||||
'''
|
||||
clieop_export = self.read(cursor, uid, ids, ['file_id'], context)[0]
|
||||
self.pool.get('banking.export.clieop').unlink(cursor, uid, clieop_export['file_id'])
|
||||
self.pool.get('banking.export.clieop').unlink(cursor, uid, clieop_export['file_id'][0])
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def save_clieop(self, cursor, uid, ids, context):
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<field name="res_model">payment.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_payment_order_type': 'debit'}</field>
|
||||
<field name="context">{'search_payment_order_type': 'debit',
|
||||
'default_payment_order_type': 'debit'}</field>
|
||||
<field name="search_view_id" ref="account_payment.view_payment_order_search"/>
|
||||
<field name="domain">[('payment_order_type', '=', 'debit')]</field>
|
||||
<field name="help">A debit order is a debit request from your company to collect customer invoices. Here you can register all debit orders that should be done, keep track of all debit orders and mention the invoice reference and the partner the withdrawal should be done for.</field>
|
||||
@@ -45,10 +46,11 @@
|
||||
icon="gtk-find"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//tree[@string='Payment Line']" position="inside">
|
||||
<!-- the attrs do not work like this, apparently -->
|
||||
<field name="storno" attrs="{'invisible': [(parent.payment_order_type, '!=', 'debit')]}"/>
|
||||
</xpath>
|
||||
<!-- the attrs do not work like this, apparently
|
||||
<xpath expr="//tree[@string='Payment Line']" position="inside">
|
||||
<field name="storno" attrs="{'invisible': [(parent.payment_order_type, '!=', 'debit')]}"/>
|
||||
</xpath>
|
||||
-->
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -7,6 +7,3 @@ class res_partner_bank(osv.osv):
|
||||
'acc_number_domestic': fields.char(
|
||||
'Domestic Account Number', size=64)
|
||||
}
|
||||
|
||||
res_partner_bank()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user