From f2db2082b26f216ed4c9cfd5c7fba956808a74dc Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 20 Oct 2014 12:38:11 +0200 Subject: [PATCH] [FIX] coding style --- account_bank_statement_tax/__openerp__.py | 2 +- .../model/account_bank_statement.py | 2 +- .../model/account_bank_statement_line.py | 4 +- account_banking/__openerp__.py | 2 +- account_banking/account_banking.py | 4 +- account_banking/banking_import_transaction.py | 116 +++++++++-------- account_banking/sepa/iban.py | 6 +- account_banking/wizard/bank_import.py | 65 +++++----- .../wizard/banking_transaction_wizard.py | 11 +- account_banking/wizard/banktools.py | 6 +- account_banking/wizard/link_partner.py | 15 ++- account_banking_camt/camt.py | 4 +- account_banking_fr_lcr/__openerp__.py | 4 +- account_banking_fr_lcr/account_banking_lcr.py | 10 +- account_banking_fr_lcr/wizard/export_lcr.py | 26 ++-- account_banking_iban_lookup/__openerp__.py | 4 +- .../model/res_partner_bank.py | 6 +- account_banking_nl_abnamro/abnamro.py | 2 +- account_banking_nl_clieop/__openerp__.py | 2 +- .../account_banking_nl_clieop.py | 12 +- account_banking_nl_clieop/wizard/clieop.py | 2 +- .../wizard/export_clieop.py | 52 ++++---- account_banking_nl_girotel/girotel.py | 6 +- account_banking_nl_ing/ing.py | 4 +- account_banking_pain_base/__openerp__.py | 2 +- .../banking_export_pain.py | 2 +- account_banking_pain_base/payment_line.py | 10 +- .../res_partner.py | 2 +- account_banking_payment/__openerp__.py | 2 +- .../model/account_payment.py | 54 ++++---- .../model/banking_import_transaction.py | 27 ++-- account_banking_payment/model/payment_line.py | 12 +- account_banking_payment/model/payment_mode.py | 8 +- .../model/payment_order_create.py | 9 +- .../account_banking_sepa.py | 24 ++-- .../wizard/export_sepa.py | 30 +++-- account_banking_tests/__openerp__.py | 2 +- .../tests/test_payment_roundtrip.py | 119 +++++++++++------- account_banking_uk_hsbc/hsbc_mt940.py | 2 +- account_banking_uk_hsbc/mt940_parser.py | 2 +- account_banking_uk_hsbc/wizard/export_hsbc.py | 18 +-- account_banking_uk_hsbc/wizard/paymul.py | 2 +- .../migrations/7.0.2/post-migration.py | 3 +- .../model/account_move_line.py | 2 +- account_direct_debit/model/payment_line.py | 40 +++--- .../model/payment_order_create.py | 2 +- account_iban_preserve_domestic/__openerp__.py | 4 +- .../res_partner_bank.py | 2 +- .../model/account_invoice.py | 4 +- account_payment_partner/model/partner.py | 2 +- .../model/payment_order_create.py | 2 +- account_payment_purchase/model/purchase.py | 20 +-- account_payment_purchase/model/stock.py | 2 +- account_payment_sale/model/sale.py | 4 +- account_payment_sale_stock/model/stock.py | 2 +- .../model/account_bank_statement_line.py | 2 +- .../model/account_voucher_instant.py | 10 +- base_iban_bic_not_required/__openerp__.py | 4 +- 58 files changed, 445 insertions(+), 354 deletions(-) diff --git a/account_bank_statement_tax/__openerp__.py b/account_bank_statement_tax/__openerp__.py index 695421ed1..cc0f73518 100644 --- a/account_bank_statement_tax/__openerp__.py +++ b/account_bank_statement_tax/__openerp__.py @@ -28,7 +28,7 @@ 'category': 'Banking addons', 'depends': [ 'account', - ], + ], 'data': [ 'view/account_bank_statement.xml', ], diff --git a/account_bank_statement_tax/model/account_bank_statement.py b/account_bank_statement_tax/model/account_bank_statement.py index 59900d07c..8de910448 100644 --- a/account_bank_statement_tax/model/account_bank_statement.py +++ b/account_bank_statement_tax/model/account_bank_statement.py @@ -93,7 +93,7 @@ class AccountBankStatement(orm.Model): 'account_id': ( tax.get('account_collected_id', defaults['account_id'])), - }) + }) return move_lines, update_move_line diff --git a/account_bank_statement_tax/model/account_bank_statement_line.py b/account_bank_statement_tax/model/account_bank_statement_line.py index f70f27b38..2f508ba63 100644 --- a/account_bank_statement_tax/model/account_bank_statement_line.py +++ b/account_bank_statement_tax/model/account_bank_statement_line.py @@ -30,5 +30,5 @@ class AccountBankStatementLine(orm.Model): 'account.tax', 'Tax', domain=[('price_include', '=', True)], help="Apply an (inclusive) tax from the bank statement line", - ), - } + ), + } diff --git a/account_banking/__openerp__.py b/account_banking/__openerp__.py index b03ad1703..653e126ad 100644 --- a/account_banking/__openerp__.py +++ b/account_banking/__openerp__.py @@ -33,7 +33,7 @@ 'category': 'Banking addons', 'depends': [ 'account_voucher', - ], + ], 'data': [ 'security/ir.model.access.csv', 'data/account_banking_data.xml', diff --git a/account_banking/account_banking.py b/account_banking/account_banking.py index 9aec2d8f8..67113d4b6 100644 --- a/account_banking/account_banking.py +++ b/account_banking/account_banking.py @@ -209,7 +209,7 @@ class account_banking_account_settings(orm.Model): cr, uid, company_id=company_id, context=context), 'default_credit_account_id': self._default_credit_account_id( cr, uid, company_id=company_id, context=context), - } + } return {'value': result} _defaults = { @@ -350,7 +350,7 @@ class account_bank_statement(orm.Model): (_check_company_id, 'The journal and period chosen have to belong to the same company.', ['journal_id', 'period_id']), - ] + ] def _get_period(self, cr, uid, date=False, context=None): """ diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index abcfced01..c67446f9a 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -71,14 +71,16 @@ class banking_import_transaction(orm.Model): # search supplier invoice invoice_obj = self.pool.get('account.invoice') - invoice_ids = invoice_obj.search(cr, uid, [ - '&', - ('type', '=', 'in_invoice'), - ('partner_id', 'child_of', account_info.bank_partner_id.id), - ('company_id', '=', account_info.company_id.id), - ('date_invoice', '=', trans.execution_date), - ('reference', '=', reference), - ('amount_total', '=', amount), + invoice_ids = invoice_obj.search( + cr, uid, + [ + '&', + ('type', '=', 'in_invoice'), + ('partner_id', 'child_of', account_info.bank_partner_id.id), + ('company_id', '=', account_info.company_id.id), + ('date_invoice', '=', trans.execution_date), + ('reference', '=', reference), + ('amount_total', '=', amount), ] ) if invoice_ids and len(invoice_ids) == 1: @@ -257,7 +259,7 @@ class banking_import_transaction(orm.Model): (convert.str2date(trans.execution_date, '%Y-%m-%d') + self.payment_window)) and (not _cached(x) or _remaining(x)) - ] + ] else: candidates = [] @@ -281,7 +283,7 @@ class banking_import_transaction(orm.Model): and (not _cached(x) or _remaining(x)) and (not partner_ids or x.invoice.partner_id.id in partner_ids)) - ] + ] # Match on amount expected. Limit this kind of search to known # partners. @@ -295,7 +297,7 @@ class banking_import_transaction(orm.Model): self.payment_window) and (not _cached(x) or _remaining(x)) and x.partner_id.id in partner_ids) - ] + ] move_line = False @@ -493,7 +495,7 @@ class banking_import_transaction(orm.Model): 'amount': line_amount, 'account_id': transaction.move_line_id.account_id.id, 'type': transaction.move_line_id.credit and 'dr' or 'cr', - } + } voucher['line_ids'] = [(0, 0, vch_line)] voucher_id = self.pool.get('account.voucher').create( cr, uid, voucher, context=context) @@ -590,7 +592,7 @@ class banking_import_transaction(orm.Model): transaction.move_line_id.reconcile_id.id or transaction.move_line_id.reconcile_partial_id and transaction.move_line_id.reconcile_partial_id.id - ) + ) move_lines = [] for move in transaction.statement_line_id.move_ids: move_lines += move.line_id @@ -644,7 +646,7 @@ class banking_import_transaction(orm.Model): 'invoice': _cancel_voucher, 'manual': _cancel_voucher, 'move': _cancel_voucher, - } + } def cancel(self, cr, uid, ids, context=None): if ids and isinstance(ids, (int, float)): @@ -667,7 +669,7 @@ class banking_import_transaction(orm.Model): 'invoice': _confirm_move, 'manual': _confirm_move, 'move': _confirm_move, - } + } def confirm(self, cr, uid, ids, context=None): if ids and isinstance(ids, (int, float)): @@ -681,7 +683,7 @@ class banking_import_transaction(orm.Model): _("Cannot reconcile type %s. No method found to " + "reconcile this type") % transaction.match_type - ) + ) if (transaction.residual and transaction.writeoff_account_id): if transaction.match_type not in ('invoice', 'move', 'manual'): raise orm.except_orm( @@ -689,7 +691,7 @@ class banking_import_transaction(orm.Model): _("Bank transaction %s: write off not implemented for " "this match type.") % transaction.statement_line_id.name - ) + ) # Generalize this bit and move to the confirmation # methods that actually do create a voucher? self.confirm_map[transaction.match_type]( @@ -702,7 +704,7 @@ class banking_import_transaction(orm.Model): # such as transferred_amount 'execution_date', 'local_account', 'remote_account', 'remote_owner', 'reference', 'message', - ] + ] def create(self, cr, uid, vals, context=None): """ @@ -1009,7 +1011,7 @@ class banking_import_transaction(orm.Model): transaction.transferred_amount < 0 and account_info.default_credit_account_id.id or account_info.default_debit_account_id.id), - } + } statement_line_id = statement_line_obj.create( cr, uid, values, context ) @@ -1026,12 +1028,12 @@ class banking_import_transaction(orm.Model): results['log'].append( _('transaction %(statement_id)s.%(transaction_id)s for ' 'account %(bank_account)s uses different currency than ' - 'the defined bank journal.' - ) % { - 'bank_account': transactions.local_account, - 'statement_id': transaction.statement, - 'transaction_id': transaction.transaction, - } + 'the defined bank journal.') % + { + 'bank_account': transactions.local_account, + 'statement_id': transaction.statement, + 'transaction_id': transaction.transaction, + } ) error_accounts[transaction.local_account] = True results['error_cnt'] += 1 @@ -1052,7 +1054,8 @@ class banking_import_transaction(orm.Model): remote_currency=transaction.provision_costs_currency, message=transaction.provision_costs_description, parent_id=transaction.id, - ), context) + ), + context) injected.append(self.browse(cr, uid, cost_id, context)) @@ -1069,7 +1072,8 @@ class banking_import_transaction(orm.Model): provision_costs=False, provision_costs_currency=False, provision_costs_description=False, - ), context=context) + ), + context=context) # rebrowse the current record after writing transaction = self.browse( cr, uid, transaction.id, context=context @@ -1086,7 +1090,7 @@ class banking_import_transaction(orm.Model): lines = self._match_costs( cr, uid, transaction, period_id, account_info, results['log'] - ) + ) results['bank_costs_invoice_cnt'] += bool(lines) for line in lines: if not [x for x in move_lines if x.id == line.id]: @@ -1097,7 +1101,7 @@ class banking_import_transaction(orm.Model): partner_banks = banktools.get_bank_accounts( self.pool, cr, uid, transaction.remote_account, results['log'], fail=True - ) + ) if partner_banks: partner_ids = [x.partner_id.id for x in partner_banks] elif transaction.remote_owner: @@ -1137,7 +1141,7 @@ class banking_import_transaction(orm.Model): cr, uid, transaction, payment_lines, partner_ids, partner_banks, results['log'], linked_payments, - ) + ) # Second guess, invoice -> may split transaction, so beware if not move_info: @@ -1231,7 +1235,7 @@ class banking_import_transaction(orm.Model): res[transaction.id] = ( transaction.move_currency_amount - transaction.statement_line_id.amount - ) + ) return res def _get_match_multi(self, cr, uid, ids, name, args, context=None): @@ -1256,22 +1260,22 @@ class banking_import_transaction(orm.Model): Write values in argument 'vals', but clear all match related values first """ - write_vals = ( - dict([ + write_vals = dict( + [ (x, False) for x in [ 'match_type', 'move_line_id', 'invoice_id', ] - ] + [ + ] + + [ (x, [(6, 0, [])]) for x in [ 'move_line_ids', 'invoice_ids', - ] ] - ) + ] ) write_vals.update(vals or {}) return self.write(cr, uid, ids, write_vals, context=context) @@ -1299,12 +1303,12 @@ class banking_import_transaction(orm.Model): statement.journal_id.currency and statement.journal_id.currency.id or statement.company_id.currency_id.id - ) + ) from_curr_id = ( transaction.move_line_id.currency_id and transaction.move_line_id.currency_id.id or statement.company_id.currency_id.id - ) + ) if from_curr_id != to_curr_id: amount_currency = stline_pool._convert_currency( cr, uid, from_curr_id, to_curr_id, move_line_amount, @@ -1346,7 +1350,7 @@ class banking_import_transaction(orm.Model): # used in bank_import.py, converting non-osv transactions 'statement_id': 'statement', 'id': 'transaction' - } + } _columns = { # start mem_bank_transaction atributes @@ -1454,7 +1458,7 @@ class banking_import_transaction(orm.Model): "sum of allocated amounts. You can either choose to keep " "open this difference on the partner's account, " "or reconcile it with the payment(s)"), - ), + ), 'writeoff_amount': fields.float('Difference Amount'), # Legacy field: to be removed after 7.0 'writeoff_move_line_id': fields.many2one( @@ -1474,7 +1478,7 @@ class banking_import_transaction(orm.Model): s.pool.get('res.company')._company_default_get( cr, uid, 'bank.import.transaction', context=c), 'payment_option': 'without_writeoff', - } + } class account_bank_statement_line(orm.Model): @@ -1506,7 +1510,7 @@ class account_bank_statement_line(orm.Model): 'residual': fields.related( 'import_transaction_id', 'residual', type='float', string='Residual', readonly=True, - ), + ), 'duplicate': fields.related( 'import_transaction_id', 'duplicate', type='boolean', string='Possible duplicate import', readonly=True), @@ -1533,11 +1537,11 @@ class account_bank_statement_line(orm.Model): 'link_partner_ok': fields.function( _get_link_partner_ok, type='boolean', string='Can link partner'), - } + } _defaults = { 'state': 'draft', - } + } def match_wizard(self, cr, uid, ids, context=None): res = False @@ -1664,10 +1668,11 @@ class account_bank_statement_line(orm.Model): continue if not st_line.period_id: self.write( - cr, uid, [st_line.id], { + cr, uid, [st_line.id], + { 'period_id': self._get_period( cr, uid, date=st_line.date, context=context) - }) + }) st_line.refresh() # Generate the statement number, if it is not already done st = st_line.statement_id @@ -1791,14 +1796,17 @@ class account_bank_statement_line(orm.Model): for line in self.browse(cr, uid, ids, context=context): if line.state != 'confirmed' and not line.import_transaction_id: res = import_transaction_pool.create( - cr, uid, { + cr, uid, + { 'company_id': line.statement_id.company_id.id, 'statement_line_id': line.id, - }, + }, context=localcontext) self.write( - cr, uid, line.id, { - 'import_transaction_id': res}, + cr, uid, line.id, + { + 'import_transaction_id': res + }, context=context) def split_off(self, cr, uid, ids, amount, context=None): @@ -1838,9 +1846,11 @@ class account_bank_statement_line(orm.Model): child_statement_ids.append(statement_line_id) transaction_pool.write( - cr, uid, transaction_id, { + cr, uid, transaction_id, + { 'statement_line_id': statement_line_id, - }, context=context) + }, + context=context) this.write({'amount': this.amount - amount}) return child_statement_ids @@ -1939,4 +1949,4 @@ class account_bank_statement(orm.Model): 'balance_end': fields.function( _end_balance, method=True, store=True, string='Balance'), - } + } diff --git a/account_banking/sepa/iban.py b/account_banking/sepa/iban.py index 58b1ddeb9..20deb01c7 100644 --- a/account_banking/sepa/iban.py +++ b/account_banking/sepa/iban.py @@ -131,7 +131,7 @@ class BBANFormat(object): result = '' j = len(self._iban) while i < j and self._iban[i] == spec: - result += value[i+4] + result += value[i + 4] i += 1 return self._nolz and result.lstrip('0') or result @@ -337,7 +337,7 @@ class IBAN(str): ''' parts = [] for i in range(0, len(self), 4): - parts.append(self[i:i+4]) + parts.append(self[i:i + 4]) return ' '.join(parts) def __unicode__(self): @@ -477,7 +477,7 @@ class BBAN(object): return elif parm in 'ABCDPSTVWXZ': _len = self._get_length(self._fmt, parm) - addon = bban[j:j+_len] + addon = bban[j:j + _len] if len(addon) != _len: # Note that many accounts in the IBAN standard # are allowed to have leading zeros, so zfill diff --git a/account_banking/wizard/bank_import.py b/account_banking/wizard/bank_import.py index 5b73eaf72..37df76758 100644 --- a/account_banking/wizard/bank_import.py +++ b/account_banking/wizard/bank_import.py @@ -67,11 +67,13 @@ class banking_import_line(orm.TransientModel): 'statement_line_id': fields.many2one( 'account.bank.statement.line', 'Resulting statement line', readonly=True), - 'type': fields.selection([ - ('supplier', 'Supplier'), - ('customer', 'Customer'), - ('general', 'General') - ], 'Type', required=True), + 'type': fields.selection( + [ + ('supplier', 'Supplier'), + ('customer', 'Customer'), + ('general', 'General') + ], + 'Type', required=True), 'partner_id': fields.many2one('res.partner', 'Partner'), 'statement_id': fields.many2one( 'account.bank.statement', @@ -105,7 +107,7 @@ class banking_import_line(orm.TransientModel): 'Transaction type', ), 'duplicate': fields.boolean('Duplicate'), - } + } class banking_import(orm.TransientModel): @@ -209,9 +211,10 @@ class banking_import(orm.TransientModel): if not account_info: results.log.append( _('Statements found for unknown account ' - '%(bank_account)s') % { - 'bank_account': statement.local_account - } + '%(bank_account)s') % + { + 'bank_account': statement.local_account + } ) error_accounts[statement.local_account] = True results.error_cnt += 1 @@ -219,8 +222,8 @@ class banking_import(orm.TransientModel): if 'journal_id' not in account_info.keys(): results.log.append( _('Statements found for account %(bank_account)s, ' - 'but no default journal was defined.' - ) % {'bank_account': statement.local_account} + 'but no default journal was defined.') % + {'bank_account': statement.local_account} ) error_accounts[statement.local_account] = True results.error_cnt += 1 @@ -243,11 +246,12 @@ class banking_import(orm.TransientModel): # TODO: convert currencies? results.log.append( _('Statement %(statement_id)s for account %(bank_account)s' - ' uses different currency than the defined bank journal.' - ) % { - 'bank_account': statement.local_account, - 'statement_id': statement.id - } + ' uses different currency than the defined bank ' + 'journal.') % + { + 'bank_account': statement.local_account, + 'statement_id': statement.id + } ) error_accounts[statement.local_account] = True results.error_cnt += 1 @@ -279,7 +283,7 @@ class banking_import(orm.TransientModel): ('date_start', '<=', statement.date), ('date_stop', '>=', statement.date), ('special', '=', False), - ], context=context) + ], context=context) if not period_ids: results.log.append( @@ -396,8 +400,8 @@ class banking_import(orm.TransientModel): states={ 'ready': [('readonly', True)], 'error': [('readonly', True)], - }, - ), + }, + ), 'file_name': fields.char('File name', size=256), 'file': fields.binary( 'Statements File', @@ -412,21 +416,22 @@ class banking_import(orm.TransientModel): states={ 'ready': [('readonly', True)], 'error': [('readonly', True)], - }, - ), + }, + ), 'parser': fields.selection( parser_types, 'File Format', required=True, states={ 'ready': [('readonly', True)], 'error': [('readonly', True)], - }, - ), + }, + ), 'log': fields.text('Log', readonly=True), 'state': fields.selection( - [('init', 'init'), - ('ready', 'ready'), - ('error', 'error') - ], + [ + ('init', 'init'), + ('ready', 'ready'), + ('error', 'error') + ], 'State', readonly=True), 'import_id': fields.many2one( 'account.banking.imported.file', 'Import File'), @@ -435,8 +440,8 @@ class banking_import(orm.TransientModel): 'statement_id', 'Imported Bank Statements'), 'line_ids': fields.one2many( 'banking.import.line', 'banking_import_id', 'Transactions', - ), - } + ), + } def _default_parser_type(self, cr, uid, context=None): types = models.parser_type.get_parser_types() @@ -448,4 +453,4 @@ class banking_import(orm.TransientModel): s.pool.get('res.company')._company_default_get( cr, uid, 'bank.import.transaction', context=c), 'parser': _default_parser_type, - } + } diff --git a/account_banking/wizard/banking_transaction_wizard.py b/account_banking/wizard/banking_transaction_wizard.py index dbcc7b886..0ea119aa5 100644 --- a/account_banking/wizard/banking_transaction_wizard.py +++ b/account_banking/wizard/banking_transaction_wizard.py @@ -66,7 +66,7 @@ class banking_transaction_wizard(orm.TransientModel): 'target': 'new', 'res_id': ids[0], 'nodestroy': nodestroy, - } + } def trigger_match(self, cr, uid, ids, context=None): """ @@ -224,7 +224,7 @@ class banking_transaction_wizard(orm.TransientModel): (6, 0, [todo_entry[0]] if todo_entry[0] else []) ], 'match_type': 'manual', - } + } transaction_obj.clear_and_write( cr, uid, transaction_id, vals, context=context) @@ -233,12 +233,12 @@ class banking_transaction_wizard(orm.TransientModel): 'account_id': move_line_obj.read( cr, uid, todo_entry[1], ['account_id'], context=context)['account_id'][0], - } + } if todo_entry[0]: st_line_vals['partner_id'] = invoice_obj.browse( cr, uid, todo_entry[0], context=context - ).partner_id.commercial_partner_id.id + ).partner_id.commercial_partner_id.id statement_line_obj.write( cr, uid, statement_line_id, @@ -338,8 +338,7 @@ class banking_transaction_wizard(orm.TransientModel): _columns = { 'name': fields.char('Name', size=64), 'statement_line_id': fields.many2one( - 'account.bank.statement.line', 'Statement line', - ), + 'account.bank.statement.line', 'Statement line'), 'amount': fields.related( 'statement_line_id', 'amount', type='float', string="Amount", readonly=True), diff --git a/account_banking/wizard/banktools.py b/account_banking/wizard/banktools.py index 09f735689..995bcdfa9 100644 --- a/account_banking/wizard/banktools.py +++ b/account_banking/wizard/banktools.py @@ -96,10 +96,12 @@ def get_partner(pool, cr, uid, name, address, postal_code, city, ''' partner_obj = pool.get('res.partner') partner_ids = partner_obj.search( - cr, uid, [ + cr, uid, + [ '|', ('is_company', '=', True), ('parent_id', '=', False), ('name', 'ilike', name), - ], context=context) + ], + context=context) if not partner_ids: # Try brute search on address and then match reverse criteria = [] diff --git a/account_banking/wizard/link_partner.py b/account_banking/wizard/link_partner.py index 391abb30c..455d2216b 100644 --- a/account_banking/wizard/link_partner.py +++ b/account_banking/wizard/link_partner.py @@ -36,9 +36,12 @@ class link_partner(orm.TransientModel): 'customer': fields.boolean('Customer'), 'partner_id': fields.many2one( 'res.partner', 'or link existing partner', - domain=['|', ('is_company', '=', True), - ('parent_id', '=', False)], - ), + domain=[ + '|', + ('is_company', '=', True), + ('parent_id', '=', False) + ], + ), 'statement_line_id': fields.many2one( 'account.bank.statement.line', 'Statement line', required=True), @@ -66,11 +69,11 @@ class link_partner(orm.TransientModel): 'fax': fields.char('Fax', size=64), 'mobile': fields.char('Mobile', size=64), 'is_company': fields.boolean('Is a Company'), - } + } _defaults = { 'is_company': True, - } + } def create(self, cr, uid, vals, context=None): """ @@ -205,4 +208,4 @@ class link_partner(orm.TransientModel): 'target': 'new', 'res_id': ids[0], 'nodestroy': nodestroy, - } + } diff --git a/account_banking_camt/camt.py b/account_banking_camt/camt.py index 627a0419c..fb7c8da63 100644 --- a/account_banking_camt/camt.py +++ b/account_banking_camt/camt.py @@ -148,7 +148,7 @@ CAMT Format parser self.get_unique_account_identifier( cr, statement.local_account), identifier) - ) + ) # Assuming If there is no Ccy tag then it belongs to defaut currency if not self.xpath(node, './ns:Acct/ns:Ccy'): @@ -193,7 +193,7 @@ CAMT Format parser 'value_date': self.xpath(node, './ns:ValDt/ns:Dt')[0].text, 'transfer_type': self.get_transfer_type(node), 'transferred_amount': self.parse_amount(node) - } + } TxDtls = self.xpath(node, './ns:NtryDtls/ns:TxDtls') if len(TxDtls) == 1: vals = self.parse_TxDtls(TxDtls[0], entry_details) diff --git a/account_banking_fr_lcr/__openerp__.py b/account_banking_fr_lcr/__openerp__.py index 11ca16fe3..775a02bb2 100644 --- a/account_banking_fr_lcr/__openerp__.py +++ b/account_banking_fr_lcr/__openerp__.py @@ -31,13 +31,13 @@ 'depends': ['account_direct_debit'], 'external_dependencies': { 'python': ['unidecode'], - }, + }, 'data': [ 'account_banking_lcr_view.xml', 'wizard/export_lcr_view.xml', 'data/payment_type_lcr.xml', 'security/ir.model.access.csv', - ], + ], 'demo': ['lcr_demo.xml'], 'description': ''' French Letter of Change diff --git a/account_banking_fr_lcr/account_banking_lcr.py b/account_banking_fr_lcr/account_banking_lcr.py index 7c4b3add8..7bfa99ed5 100644 --- a/account_banking_fr_lcr/account_banking_lcr.py +++ b/account_banking_fr_lcr/account_banking_lcr.py @@ -59,10 +59,12 @@ class banking_export_lcr(orm.Model): 'filename': fields.function( _generate_filename, type='char', size=256, string='Filename', readonly=True, store=True), - 'state': fields.selection([ - ('draft', 'Draft'), - ('sent', 'Sent'), - ], 'State', readonly=True), + 'state': fields.selection( + [ + ('draft', 'Draft'), + ('sent', 'Sent'), + ], + 'State', readonly=True), } _defaults = { diff --git a/account_banking_fr_lcr/wizard/export_lcr.py b/account_banking_fr_lcr/wizard/export_lcr.py index def19d3cf..39e8cb4fd 100644 --- a/account_banking_fr_lcr/wizard/export_lcr.py +++ b/account_banking_fr_lcr/wizard/export_lcr.py @@ -36,10 +36,12 @@ class banking_export_lcr_wizard(orm.TransientModel): _description = 'Export French LCR File' _columns = { - 'state': fields.selection([ - ('create', 'Create'), - ('finish', 'Finish'), - ], 'State', readonly=True), + 'state': fields.selection( + [ + ('create', 'Create'), + ('finish', 'Finish'), + ], + 'State', readonly=True), 'nb_transactions': fields.related( 'file_id', 'nb_transactions', type='integer', string='Number of Transactions', readonly=True), @@ -56,11 +58,11 @@ class banking_export_lcr_wizard(orm.TransientModel): 'payment_order_ids': fields.many2many( 'payment.order', 'wiz_lcr_payorders_rel', 'wizard_id', 'payment_order_id', 'Payment Orders', readonly=True), - } + } _defaults = { 'state': 'create', - } + } def create(self, cr, uid, vals, context=None): payment_order_ids = context.get('active_ids', []) @@ -96,7 +98,7 @@ class banking_export_lcr_wizard(orm.TransientModel): unallowed_ascii_chars = [ '"', '#', '$', '%', '&', ';', '<', '>', '=', '@', '[', ']', '^', '_', '`', '{', '}', '|', '~', '\\', '!', - ] + ] for unallowed_ascii_char in unallowed_ascii_chars: value = value.replace(unallowed_ascii_char, '-') except: @@ -150,7 +152,7 @@ class banking_export_lcr_wizard(orm.TransientModel): 'code_guichet': iban[9:14], 'numero_compte': iban[14:25], 'cle_rib': iban[25:27], - } + } def _prepare_first_cfonb_line( self, cr, uid, lcr_export, context=None): @@ -200,7 +202,7 @@ class banking_export_lcr_wizard(orm.TransientModel): # "remise à l'escompte" and we do # "Encaissement, crédit forfaitaire après l’échéance" ref_remise, - ]) + ]) assert len(cfonb_line) == 160, 'LCR CFONB line must have 160 chars' cfonb_line += '\r\n' return cfonb_line @@ -253,7 +255,7 @@ class banking_export_lcr_wizard(orm.TransientModel): date_creation, ' ' * (4 + 1 + 3 + 3 + 9), reference_tireur, - ]) + ]) assert len(cfonb_line) == 160, 'LCR CFONB line must have 160 chars' cfonb_line += '\r\n' return cfonb_line @@ -273,7 +275,7 @@ class banking_export_lcr_wizard(orm.TransientModel): ' ' * (6 + 12 + 24 + 24 + 1 + 2 + 5 + 5 + 11), zero_montant_total_centimes, ' ' * (4 + 6 + 10 + 15 + 5 + 6), - ]) + ]) assert len(cfonb_line) == 160, 'LCR CFONB line must have 160 chars' return cfonb_line @@ -332,7 +334,7 @@ class banking_export_lcr_wizard(orm.TransientModel): 'res_model': self._name, 'res_id': ids[0], 'target': 'new', - } + } return action diff --git a/account_banking_iban_lookup/__openerp__.py b/account_banking_iban_lookup/__openerp__.py index 63eaade1c..de3059266 100644 --- a/account_banking_iban_lookup/__openerp__.py +++ b/account_banking_iban_lookup/__openerp__.py @@ -29,11 +29,11 @@ 'depends': [ 'account_banking', 'account_iban_preserve_domestic', - ], + ], 'data': [ 'view/res_bank.xml', 'view/res_partner_bank.xml', - ], + ], 'external_dependencies': { 'python': ['BeautifulSoup'], }, diff --git a/account_banking_iban_lookup/model/res_partner_bank.py b/account_banking_iban_lookup/model/res_partner_bank.py index 1eeea85c6..327fd9941 100644 --- a/account_banking_iban_lookup/model/res_partner_bank.py +++ b/account_banking_iban_lookup/model/res_partner_bank.py @@ -117,12 +117,12 @@ class res_partner_bank(orm.Model): return self.onchange_iban( cr, uid, ids, acc_number, acc_number_domestic, state, partner_id, country_id, context=None - ) + ) else: return self.onchange_domestic( cr, uid, ids, acc_number, partner_id, country_id, context=None - ) + ) def onchange_domestic( self, cr, uid, ids, acc_number, @@ -250,7 +250,7 @@ class res_partner_bank(orm.Model): bank_id, country_id = get_or_create_bank( self.pool, cr, uid, iban_acc.BIC_searchkey, code=iban_acc.BIC_searchkey - ) + ) return { 'value': dict( acc_number_domestic=iban_acc.localized_BBAN, diff --git a/account_banking_nl_abnamro/abnamro.py b/account_banking_nl_abnamro/abnamro.py index 598326f1e..95aff2cf3 100644 --- a/account_banking_nl_abnamro/abnamro.py +++ b/account_banking_nl_abnamro/abnamro.py @@ -267,7 +267,7 @@ class transaction(models.mem_bank_transaction): 'SEPA BATCH': 'PAYB', 'SEPA BATCH SALARIS': 'PAYB', 'SEPA TERUGBOEKING': 'RETR', - }.get(sepa_type.upper(), 'SEPA') + }.get(sepa_type.upper(), 'SEPA') self.remote_account = sepa_dict.get('IBAN', False) self.remote_bank_bic = sepa_dict.get('BIC', False) self.remote_owner = sepa_dict.get('NAME', False) diff --git a/account_banking_nl_clieop/__openerp__.py b/account_banking_nl_clieop/__openerp__.py index f64e99f89..bdf4a4425 100644 --- a/account_banking_nl_clieop/__openerp__.py +++ b/account_banking_nl_clieop/__openerp__.py @@ -27,7 +27,7 @@ 'depends': [ 'account_banking_payment', 'account_iban_preserve_domestic', - ], + ], 'data': [ 'account_banking_nl_clieop.xml', 'wizard/export_clieop_view.xml', diff --git a/account_banking_nl_clieop/account_banking_nl_clieop.py b/account_banking_nl_clieop/account_banking_nl_clieop.py index 147989121..752ad8ac5 100644 --- a/account_banking_nl_clieop/account_banking_nl_clieop.py +++ b/account_banking_nl_clieop/account_banking_nl_clieop.py @@ -54,11 +54,13 @@ class clieop_export(orm.Model): 'identification': fields.char('Identification', size=6, readonly=True, select=True), 'filetype': - fields.selection([ - ('CREDBET', 'Payment Batch'), - ('SALARIS', 'Salary Payment Batch'), - ('INCASSO', 'Direct Debit Batch'), - ], 'File Type', size=7, readonly=True, select=True), + fields.selection( + [ + ('CREDBET', 'Payment Batch'), + ('SALARIS', 'Salary Payment Batch'), + ('INCASSO', 'Direct Debit Batch'), + ], + 'File Type', size=7, readonly=True, select=True), 'date_generated': fields.date('Generation Date', readonly=True, select=True), 'file': diff --git a/account_banking_nl_clieop/wizard/clieop.py b/account_banking_nl_clieop/wizard/clieop.py index cc38ebc22..7c70502c1 100644 --- a/account_banking_nl_clieop/wizard/clieop.py +++ b/account_banking_nl_clieop/wizard/clieop.py @@ -52,7 +52,7 @@ def eleven_test(s): r = 0 l = len(s) for i, c in enumerate(s): - r += (l-i) * int(c) + r += (l - i) * int(c) return (r % 11) == 0 diff --git a/account_banking_nl_clieop/wizard/export_clieop.py b/account_banking_nl_clieop/wizard/export_clieop.py index 95d86f8de..c39a9260d 100644 --- a/account_banking_nl_clieop/wizard/export_clieop.py +++ b/account_banking_nl_clieop/wizard/export_clieop.py @@ -48,7 +48,7 @@ class banking_export_clieop_wizard(orm.TransientModel): [ ('create', 'Create'), ('finish', 'Finish') - ], + ], 'State', readonly=True, ), @@ -57,14 +57,14 @@ class banking_export_clieop_wizard(orm.TransientModel): help=('The bank will use this reference in feedback communication ' 'to refer to this run. Only five characters are available.' ), - ), + ), 'batchtype': fields.selection( [ ('CLIEOPPAY', 'Payments'), ('CLIEOPSAL', 'Salary Payments'), ('CLIEOPINC', 'Direct Debits'), ], 'Type', readonly=True, - ), + ), 'execution_date': fields.date( 'Execution Date', help=('This is the date the file should be processed by the bank. ' @@ -73,86 +73,86 @@ class banking_export_clieop_wizard(orm.TransientModel): 'Please keep in mind that banks only execute on working ' 'days and typically use a delay of two days between ' 'execution date and effective transfer date.'), - ), + ), 'test': fields.boolean( 'Test Run', help=('Select this if you want your bank to run a test process ' 'rather then execute your orders for real.' ), - ), + ), 'fixed_message': fields.char( 'Fixed Message', size=32, help=('A fixed message to apply to all transactions in addition ' 'to the individual messages.'), - ), + ), # file fields 'file_id': fields.many2one( 'banking.export.clieop', 'ClieOp File', readonly=True - ), + ), # fields.related does not seem to support # fields of type selection 'testcode': fields.selection( [('T', _('Yes')), ('P', _('No'))], 'Test Run', readonly=True, - ), + ), 'filetype': fields.selection( [ ('CREDBET', 'Payment Batch'), ('SALARIS', 'Salary Payment Batch'), ('INCASSO', 'Direct Debit Batch'), - ], + ], 'File Type', readonly=True, - ), + ), 'prefered_date': fields.related( 'file_id', 'prefered_date', type='date', string='Prefered Processing Date', readonly=True, - ), + ), 'no_transactions': fields.related( 'file_id', 'no_transactions', type ='integer', string='Number of Transactions', readonly=True, - ), + ), 'check_no_accounts': fields.related( 'file_id', 'check_no_accounts', type='char', size=5, string='Check Number Accounts', readonly=True, - ), + ), 'total_amount': fields.related( 'file_id', 'total_amount', type='float', string='Total Amount', readonly=True, - ), + ), 'identification': fields.related( 'file_id', 'identification', type='char', size=6, string='Identification', readonly=True, - ), + ), 'file': fields.related( 'file_id', 'file', type='binary', readonly=True, string='File', - ), + ), 'filename': fields.related( 'file_id', 'filename', type='char', size=32, readonly=True, string='Filename', - ), + ), 'payment_order_ids': fields.many2many( 'payment.order', 'rel_wiz_payorders', 'wizard_id', 'payment_order_id', 'Payment Orders', readonly=True, - ), - } + ), + } def create(self, cr, uid, vals, context=None): ''' @@ -233,7 +233,7 @@ class banking_export_clieop_wizard(orm.TransientModel): 'reference': runs[type][0].reference[-5:], 'payment_order_ids': [[6, 0, payment_order_ids]], 'state': 'create', - }) + }) def create_clieop(self, cr, uid, ids, context): ''' @@ -255,7 +255,7 @@ class banking_export_clieop_wizard(orm.TransientModel): if not our_account_nr: our_account_nr = sepa.IBAN( payment_order.mode.bank_id.acc_number - ).localized_BBAN + ).localized_BBAN else: our_account_nr = payment_order.mode.bank_id.acc_number if not our_account_nr: @@ -317,7 +317,7 @@ class banking_export_clieop_wizard(orm.TransientModel): 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: @@ -339,7 +339,8 @@ class banking_export_clieop_wizard(orm.TransientModel): # Generate the specifics of this clieopfile order = clieopfile.order file_id = self.pool.get('banking.export.clieop').create( - cr, uid, dict( + cr, uid, + dict( filetype=order.name_transactioncode, identification=order.identification, prefered_date=strfdate(order.preferred_execution_date), @@ -353,7 +354,8 @@ class banking_export_clieop_wizard(orm.TransientModel): payment_order_ids=[ [6, 0, [x.id for x in clieop_export['payment_order_ids']]]], - ), context) + ), + context) self.write(cr, uid, [ids[0]], dict( filetype=order.name_transactioncode, testcode=order.testcode, @@ -392,7 +394,7 @@ class banking_export_clieop_wizard(orm.TransientModel): clieop_obj = self.pool.get('banking.export.clieop') clieop_obj.write( cr, uid, clieop_export['file_id'].id, {'state': 'sent'} - ) + ) wf_service = netsvc.LocalService('workflow') for order in clieop_export['payment_order_ids']: wf_service.trg_validate( diff --git a/account_banking_nl_girotel/girotel.py b/account_banking_nl_girotel/girotel.py index d6a637758..997530ed9 100644 --- a/account_banking_nl_girotel/girotel.py +++ b/account_banking_nl_girotel/girotel.py @@ -213,7 +213,7 @@ class transaction(models.mem_bank_transaction): line ''' msg, message = message.rstrip(), None - parts = [msg[i:i+32].rstrip() for i in range(0, len(msg), 32)] + parts = [msg[i:i + 32].rstrip() for i in range(0, len(msg), 32)] return '\n'.join(parts) def parse_message(self): @@ -231,7 +231,7 @@ class transaction(models.mem_bank_transaction): # Title of action is in remote_owner, message contains additional # info self.reference = self.remote_owner.rstrip() - parts = [self.message[i:i+32].rstrip() + parts = [self.message[i:i + 32].rstrip() for i in range(0, len(self.message), 32) ] if len(parts) > 3: @@ -262,7 +262,7 @@ class transaction(models.mem_bank_transaction): # first part of the message. # Sometimes this misfires, as with the tax office collecting road # taxes, but then a once-only manual correction is sufficient. - parts = [self.message[i:i+32].rstrip() + parts = [self.message[i:i + 32].rstrip() for i in range(0, len(self.message), 32) ] self.reference = self.remote_owner diff --git a/account_banking_nl_ing/ing.py b/account_banking_nl_ing/ing.py index 7ebcb62c1..9faf70bc6 100644 --- a/account_banking_nl_ing/ing.py +++ b/account_banking_nl_ing/ing.py @@ -113,7 +113,7 @@ class transaction(models.mem_bank_transaction): 'ST': bt.BANK_TERMINAL, # Storting (eigen rekening of derde) 'VZ': bt.ORDER, # Verzamelbetaling 'NO': bt.STORNO, # Storno - } + } # global expression for matching storno references ref_expr = re.compile('REF[\*:]([0-9A-Z-z_-]+)') @@ -188,7 +188,7 @@ class transaction(models.mem_bank_transaction): self.reference = kn[4:] self.message = 'Acceptgiro %s' % (navr or '') if after: - parts = [after[i:i+33] for i in range(0, len(after), 33)] + parts = [after[i:i + 33] for i in range(0, len(after), 33)] if parts and not self.remote_owner: self.remote_owner = parts.pop(0).strip() if parts: diff --git a/account_banking_pain_base/__openerp__.py b/account_banking_pain_base/__openerp__.py index f2a6ad0d0..82d15ef2d 100644 --- a/account_banking_pain_base/__openerp__.py +++ b/account_banking_pain_base/__openerp__.py @@ -30,7 +30,7 @@ 'depends': ['account_banking_payment_export'], 'external_dependencies': { 'python': ['unidecode', 'lxml'], - }, + }, 'data': [ 'payment_line_view.xml', 'payment_mode_view.xml', diff --git a/account_banking_pain_base/banking_export_pain.py b/account_banking_pain_base/banking_export_pain.py index 279dc5f5a..1e7df9cee 100644 --- a/account_banking_pain_base/banking_export_pain.py +++ b/account_banking_pain_base/banking_export_pain.py @@ -163,7 +163,7 @@ class banking_export_pain(orm.AbstractModel): 'res_model': self._name, 'res_id': ids[0], 'target': 'new', - } + } return action def generate_group_header_block( diff --git a/account_banking_pain_base/payment_line.py b/account_banking_pain_base/payment_line.py index 0dffbcf42..16f1d64c4 100644 --- a/account_banking_pain_base/payment_line.py +++ b/account_banking_pain_base/payment_line.py @@ -30,10 +30,12 @@ class payment_line(orm.Model): return [('ISO', 'ISO')] _columns = { - 'priority': fields.selection([ - ('NORM', 'Normal'), - ('HIGH', 'High'), - ], 'Priority', + 'priority': fields.selection( + [ + ('NORM', 'Normal'), + ('HIGH', 'High'), + ], + 'Priority', help="This field will be used as the 'Instruction Priority' in " "the generated PAIN file."), # Update size from 64 to 140, because PAIN allows 140 caracters diff --git a/account_banking_partner_journal_account/res_partner.py b/account_banking_partner_journal_account/res_partner.py index d83d8af89..ddd9701b5 100644 --- a/account_banking_partner_journal_account/res_partner.py +++ b/account_banking_partner_journal_account/res_partner.py @@ -43,7 +43,7 @@ class ResPartner(orm.Model): 'debits from this partner. Overrides the default debit ' 'account.'), domain=[('type', '!=', 'view')]), - } + } def def_journal_account_bank_decr( self, cr, uid, ids, context=None): diff --git a/account_banking_payment/__openerp__.py b/account_banking_payment/__openerp__.py index 8fd9b7d80..0ae89ca98 100644 --- a/account_banking_payment/__openerp__.py +++ b/account_banking_payment/__openerp__.py @@ -33,7 +33,7 @@ 'depends': [ 'account_banking', 'account_banking_payment_export', - ], + ], 'data': [ 'view/account_payment.xml', 'view/banking_transaction_wizard.xml', diff --git a/account_banking_payment/model/account_payment.py b/account_banking_payment/model/account_payment.py index 1e2e31277..d2917d077 100644 --- a/account_banking_payment/model/account_payment.py +++ b/account_banking_payment/model/account_payment.py @@ -61,14 +61,16 @@ class payment_order(orm.Model): }, help='Select the Payment Mode to be applied.', ), - 'state': fields.selection([ - ('draft', 'Draft'), - ('open', 'Confirmed'), - ('cancel', 'Cancelled'), - ('sent', 'Sent'), - ('rejected', 'Rejected'), - ('done', 'Done'), - ], 'State', select=True + 'state': fields.selection( + [ + ('draft', 'Draft'), + ('open', 'Confirmed'), + ('cancel', 'Cancelled'), + ('sent', 'Sent'), + ('rejected', 'Rejected'), + ('done', 'Done'), + ], + 'State', select=True ), 'line_ids': fields.one2many( 'payment.line', 'order_id', 'Payment lines', @@ -88,11 +90,13 @@ class payment_order(orm.Model): 'done': [('readonly', True)] }, ), - 'date_prefered': fields.selection([ - ('now', 'Directly'), - ('due', 'Due date'), - ('fixed', 'Fixed date') - ], "Preferred date", change_default=True, required=True, + 'date_prefered': fields.selection( + [ + ('now', 'Directly'), + ('due', 'Due date'), + ('fixed', 'Fixed date') + ], + "Preferred date", change_default=True, required=True, states={ 'sent': [('readonly', True)], 'rejected': [('readonly', True)], @@ -101,9 +105,8 @@ class payment_order(orm.Model): help=("Choose an option for the Payment Order:'Fixed' stands for " "a date specified by you.'Directly' stands for the direct " "execution.'Due date' stands for the scheduled date of " - "execution." - ) - ), + "execution.") + ), 'date_sent': fields.date('Send date', readonly=True), } @@ -234,7 +237,7 @@ class payment_order(orm.Model): line.move_line_id and line.move_line_id.move_id.name or line.communication), - } + } return vals def _prepare_move_line_transfer_account( @@ -255,7 +258,7 @@ class payment_order(orm.Model): and line.amount or 0.0), 'date': fields.date.context_today( self, cr, uid, context=context), - } + } return vals def _update_move_line_partner_account( @@ -272,7 +275,7 @@ class payment_order(orm.Model): and line.amount or 0.0), 'debit': (order.payment_order_type == 'payment' and line.amount or 0.0), - }) + }) return vals def action_sent_no_move_line_hook(self, cr, uid, pay_line, context=None): @@ -291,7 +294,7 @@ class payment_order(orm.Model): labels = { 'payment': _('Payment order'), 'debit': _('Direct debit order'), - } + } for order in self.browse(cr, uid, ids, context=context): if not order.mode.transfer_journal_id \ or not order.mode.transfer_account_id: @@ -338,9 +341,12 @@ class payment_order(orm.Model): account_move_obj.post(cr, uid, [move_id], context=context) # State field is written by act_sent_wait - self.write(cr, uid, ids, { - 'date_sent': fields.date.context_today( - self, cr, uid, context=context), - }, context=context) + self.write( + cr, uid, ids, + { + 'date_sent': fields.date.context_today( + self, cr, uid, context=context), + }, + context=context) return True diff --git a/account_banking_payment/model/banking_import_transaction.py b/account_banking_payment/model/banking_import_transaction.py index 17d0d8361..cc1bf6aa3 100644 --- a/account_banking_payment/model/banking_import_transaction.py +++ b/account_banking_payment/model/banking_import_transaction.py @@ -84,11 +84,13 @@ class banking_import_transaction(orm.Model): self, cr, uid, trans, log, context=None): payment_line_obj = self.pool.get('payment.line') line_ids = payment_line_obj.search( - cr, uid, [ + cr, uid, + [ ('order_id.payment_order_type', '=', 'debit'), ('order_id.state', 'in', ['sent', 'done']), ('communication', '=', trans.reference) - ], context=context) + ], + context=context) # stornos MUST have an exact match if len(line_ids) == 1: account_id = payment_line_obj.get_storno_account_id( @@ -139,7 +141,7 @@ class banking_import_transaction(orm.Model): and round(line.amount, digits) == -round( trans.statement_line_id.amount, digits) and bank_match(trans.remote_account, line.bank_id)) - ] + ] if len(candidates) == 1: candidate = candidates[0] # Check cache to prevent multiple matching of a single payment @@ -212,18 +214,21 @@ class banking_import_transaction(orm.Model): transaction = self.browse(cr, uid, transaction_id, context=context) payment_line_obj = self.pool.get('payment.line') payment_line_obj.write( - cr, uid, transaction.payment_line_id.id, { + cr, uid, transaction.payment_line_id.id, + { 'date_done': transaction.statement_line_id.date, - } - ) + } + ) self._confirm_move(cr, uid, transaction_id, context=context) # Check if the payment order is 'done' order_id = transaction.payment_line_id.order_id.id other_lines = payment_line_obj.search( - cr, uid, [ + cr, uid, + [ ('order_id', '=', order_id), ('date_done', '=', False), - ], context=context) + ], + context=context) if not other_lines: wf_service = netsvc.LocalService('workflow') wf_service.trg_validate( @@ -327,7 +332,7 @@ class banking_import_transaction(orm.Model): 'payment_order_id': fields.many2one( 'payment.order', 'Payment order to reconcile'), 'payment_line_id': fields.many2one('payment.line', 'Payment line'), - } + } def _get_match_multi(self, cr, uid, ids, name, args, context=None): if not ids: @@ -346,7 +351,7 @@ class banking_import_transaction(orm.Model): 'payment_line_id': False, 'payment_order_id': False, 'payment_order_ids': [(6, 0, [])], - } + } write_vals.update(vals or {}) return super(banking_import_transaction, self).clear_and_write( cr, uid, ids, vals=vals, context=context) @@ -361,7 +366,7 @@ class banking_import_transaction(orm.Model): move_info.get('payment_order_ids', False) and len(move_info['payment_order_ids']) == 1 and move_info['payment_order_ids'][0] - ) + ) return vals def hook_match_payment(self, cr, uid, transaction, log, context=None): diff --git a/account_banking_payment/model/payment_line.py b/account_banking_payment/model/payment_line.py index 0d41a966e..4235b5a08 100644 --- a/account_banking_payment/model/payment_line.py +++ b/account_banking_payment/model/payment_line.py @@ -46,12 +46,12 @@ class payment_line(orm.Model): 'account.move.line', 'Debit move line', readonly=True, help="Move line through which the debit order pays the invoice", - ), - } + ), + } _defaults = { 'msg': '', - } + } """ Hooks for processing direct debit orders, such as implemented in @@ -123,7 +123,7 @@ class payment_line(orm.Model): _('Error'), _('Move line %s has already been reconciled') % torec_move_line.name - ) + ) if (transit_move_line.reconcile_id or transit_move_line.reconcile_partial_id): raise orm.except_orm( @@ -141,7 +141,7 @@ class payment_line(orm.Model): line_ids = [ x.id for x in torec_move_line.reconcile_partial_id.line_partial_ids - ] + [transit_move_line.id] + ] + [transit_move_line.id] total = move_line_obj.get_balance(cr, uid, line_ids) vals = { @@ -150,7 +150,7 @@ class payment_line(orm.Model): 'line_partial_ids': (is_zero(total) and [(6, 0, [])] or [(6, 0, line_ids)]), - } + } if torec_move_line.reconcile_partial_id: reconcile_obj.write( diff --git a/account_banking_payment/model/payment_mode.py b/account_banking_payment/model/payment_mode.py index d45f56df9..a4a6fd8cd 100644 --- a/account_banking_payment/model/payment_mode.py +++ b/account_banking_payment/model/payment_mode.py @@ -37,16 +37,16 @@ class payment_mode(orm.Model): help=('Pay off lines in sent orders with a move on this ' 'account. You can only select accounts of type regular ' 'that are marked for reconciliation'), - ), + ), 'transfer_journal_id': fields.many2one( 'account.journal', 'Transfer journal', help=('Journal to write payment entries when confirming ' 'a debit order of this mode'), - ), + ), 'payment_term_ids': fields.many2many( 'account.payment.term', 'account_payment_order_terms_rel', 'mode_id', 'term_id', 'Payment terms', help=('Limit selected invoices to invoices with these payment ' 'terms') - ), - } + ), + } diff --git a/account_banking_payment/model/payment_order_create.py b/account_banking_payment/model/payment_order_create.py index dd4f07fec..1c8f79c2a 100644 --- a/account_banking_payment/model/payment_order_create.py +++ b/account_banking_payment/model/payment_order_create.py @@ -37,8 +37,9 @@ class payment_order_create(orm.TransientModel): # apply payment term filter if payment_order.mode.payment_term_ids: domain += [ - ('invoice.payment_term', 'in', - [term.id for term in payment_order.mode.payment_term_ids] - ) - ] + ( + 'invoice.payment_term', 'in', + [term.id for term in payment_order.mode.payment_term_ids] + ) + ] return True diff --git a/account_banking_sepa_credit_transfer/account_banking_sepa.py b/account_banking_sepa_credit_transfer/account_banking_sepa.py index 99d5b022b..18770ecaa 100644 --- a/account_banking_sepa_credit_transfer/account_banking_sepa.py +++ b/account_banking_sepa_credit_transfer/account_banking_sepa.py @@ -60,12 +60,14 @@ class banking_export_sepa(orm.Model): "line for all the wire transfers of the SEPA XML file ; " "if false, the bank statement will display one debit line " "per wire transfer of the SEPA XML file."), - 'charge_bearer': fields.selection([ - ('SLEV', 'Following Service Level'), - ('SHAR', 'Shared'), - ('CRED', 'Borne by Creditor'), - ('DEBT', 'Borne by Debtor'), - ], 'Charge Bearer', readonly=True, + 'charge_bearer': fields.selection( + [ + ('SLEV', 'Following Service Level'), + ('SHAR', 'Shared'), + ('CRED', 'Borne by Creditor'), + ('DEBT', 'Borne by Debtor'), + ], + 'Charge Bearer', readonly=True, help="Following service level : transaction charges are to be " "applied following the rules agreed in the service level and/or " "scheme (SEPA Core messages must use this). Shared : " @@ -79,10 +81,12 @@ class banking_export_sepa(orm.Model): 'filename': fields.function( _generate_filename, type='char', size=256, string='Filename', readonly=True), - 'state': fields.selection([ - ('draft', 'Draft'), - ('sent', 'Sent'), - ], 'State', readonly=True), + 'state': fields.selection( + [ + ('draft', 'Draft'), + ('sent', 'Sent'), + ], + 'State', readonly=True), } _defaults = { diff --git a/account_banking_sepa_credit_transfer/wizard/export_sepa.py b/account_banking_sepa_credit_transfer/wizard/export_sepa.py index eb2461ad8..a39deb085 100644 --- a/account_banking_sepa_credit_transfer/wizard/export_sepa.py +++ b/account_banking_sepa_credit_transfer/wizard/export_sepa.py @@ -33,22 +33,26 @@ class banking_export_sepa_wizard(orm.TransientModel): _description = 'Export SEPA Credit Transfer File' _columns = { - 'state': fields.selection([ - ('create', 'Create'), - ('finish', 'Finish'), - ], 'State', readonly=True), + 'state': fields.selection( + [ + ('create', 'Create'), + ('finish', 'Finish'), + ], + 'State', readonly=True), 'batch_booking': fields.boolean( 'Batch Booking', help="If true, the bank statement will display only one debit " "line for all the wire transfers of the SEPA XML file ; if " "false, the bank statement will display one debit line per wire " "transfer of the SEPA XML file."), - 'charge_bearer': fields.selection([ - ('SLEV', 'Following Service Level'), - ('SHAR', 'Shared'), - ('CRED', 'Borne by Creditor'), - ('DEBT', 'Borne by Debtor'), - ], 'Charge Bearer', required=True, + 'charge_bearer': fields.selection( + [ + ('SLEV', 'Following Service Level'), + ('SHAR', 'Shared'), + ('CRED', 'Borne by Creditor'), + ('DEBT', 'Borne by Debtor'), + ], + 'Charge Bearer', required=True, help="Following service level : transaction charges are to be " "applied following the rules agreed in the service level and/or " "scheme (SEPA Core messages must use this). Shared : transaction " @@ -73,12 +77,12 @@ class banking_export_sepa_wizard(orm.TransientModel): 'payment_order_ids': fields.many2many( 'payment.order', 'wiz_sepa_payorders_rel', 'wizard_id', 'payment_order_id', 'Payment Orders', readonly=True), - } + } _defaults = { 'charge_bearer': 'SLEV', 'state': 'create', - } + } def create(self, cr, uid, vals, context=None): payment_order_ids = context.get('active_ids', []) @@ -148,7 +152,7 @@ class banking_export_sepa_wizard(orm.TransientModel): pain_ns = { 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', None: 'urn:iso:std:iso:20022:tech:xsd:%s' % pain_flavor, - } + } xml_root = etree.Element('Document', nsmap=pain_ns) pain_root = etree.SubElement(xml_root, root_xml_tag) diff --git a/account_banking_tests/__openerp__.py b/account_banking_tests/__openerp__.py index 47194935a..96d5c9dae 100644 --- a/account_banking_tests/__openerp__.py +++ b/account_banking_tests/__openerp__.py @@ -29,7 +29,7 @@ 'account_accountant', 'account_banking_payment', 'account_banking_sepa_credit_transfer', - ], + ], 'description': ''' This addon adds unit tests for the Banking addons. Installing this module will not give you any benefit other than having the tests' diff --git a/account_banking_tests/tests/test_payment_roundtrip.py b/account_banking_tests/tests/test_payment_roundtrip.py index ca42ab6fc..0a5ec3d0b 100644 --- a/account_banking_tests/tests/test_payment_roundtrip.py +++ b/account_banking_tests/tests/test_payment_roundtrip.py @@ -55,34 +55,37 @@ class TestPaymentRoundtrip(SingleTransactionCase): self.currency_id = data_model.get_object_reference( cr, uid, 'base', 'EUR')[1] self.bank_id = reg('res.bank').create( - cr, uid, { + cr, uid, + { 'name': 'ING Bank', 'bic': 'INGBNL2A', 'country': self.country_id, - }) + }) self.company_id = reg('res.company').create( - cr, uid, { + cr, uid, + { 'name': '_banking_addons_test_company', 'currency_id': self.currency_id, 'country_id': self.country_id, - }) + }) self.partner_id = reg('res.company').read( cr, uid, self.company_id, ['partner_id'])['partner_id'][0] self.partner_bank_id = reg('res.partner.bank').create( - cr, uid, { + cr, uid, + { 'state': 'iban', 'acc_number': 'NL08INGB0000000555', 'bank': self.bank_id, 'bank_bic': 'INGBNL2A', 'partner_id': self.partner_id, 'company_id': self.company_id, - }) + }) reg('res.users').write( - cr, uid, [uid], { - 'company_ids': [(4, self.company_id)]}) + cr, uid, [uid], + {'company_ids': [(4, self.company_id)]}) reg('res.users').write( - cr, uid, [uid], { - 'company_id': self.company_id}) + cr, uid, [uid], + {'company_id': self.company_id}) def setup_chart(self, reg, cr, uid): """ @@ -95,7 +98,8 @@ class TestPaymentRoundtrip(SingleTransactionCase): chart_values = { 'company_id': self.company_id, 'currency_id': self.currency_id, - 'chart_template_id': chart_template_id} + 'chart_template_id': chart_template_id + } chart_values.update( chart_setup_model.onchange_chart_template_id( cr, uid, [], 1)['value']) @@ -105,13 +109,14 @@ class TestPaymentRoundtrip(SingleTransactionCase): cr, uid, [chart_setup_id]) year = datetime.now().strftime('%Y') fiscalyear_id = reg('account.fiscalyear').create( - cr, uid, { + cr, uid, + { 'name': year, 'code': year, 'company_id': self.company_id, 'date_start': '%s-01-01' % year, 'date_stop': '%s-12-31' % year, - }) + }) reg('account.fiscalyear').create_period( cr, uid, [fiscalyear_id]) @@ -163,21 +168,27 @@ class TestPaymentRoundtrip(SingleTransactionCase): 'partner_id': supplier1, 'account_id': self.payable_id, 'invoice_line': [ - (0, False, { - 'name': 'Purchase 1', - 'price_unit': 100.0, - 'quantity': 1, - 'account_id': expense_id, - }) + ( + 0, + False, + { + 'name': 'Purchase 1', + 'price_unit': 100.0, + 'quantity': 1, + 'account_id': expense_id, + } + ) ], 'reference_type': 'none', 'supplier_invoice_number': 'INV1', } self.invoice_ids = [ invoice_model.create( - cr, uid, values, context={ + cr, uid, values, + context={ 'type': 'in_invoice', - })] + }) + ] values.update({ 'partner_id': supplier2, 'name': 'Purchase 2', @@ -201,13 +212,16 @@ class TestPaymentRoundtrip(SingleTransactionCase): in transit and configure a payment mode with them. """ account_parent_id = reg('account.account').search( - cr, uid, [ + cr, uid, + [ ('company_id', '=', self.company_id), - ('parent_id', '=', False)])[0] + ('parent_id', '=', False) + ])[0] user_type = reg('ir.model.data').get_object_reference( cr, uid, 'account', 'data_account_type_liability')[1] transfer_account_id = reg('account.account').create( - cr, uid, { + cr, uid, + { 'company_id': self.company_id, 'parent_id': account_parent_id, 'code': 'TRANS', @@ -215,20 +229,23 @@ class TestPaymentRoundtrip(SingleTransactionCase): 'type': 'other', 'user_type': user_type, 'reconcile': True, - }) + }) transfer_journal_id = reg('account.journal').search( cr, uid, [ ('company_id', '=', self.company_id), - ('code', '=', 'MISC')])[0] + ('code', '=', 'MISC') + ])[0] self.bank_journal_id = reg('account.journal').search( cr, uid, [ ('company_id', '=', self.company_id), - ('type', '=', 'bank')])[0] + ('type', '=', 'bank') + ])[0] payment_mode_type_id = reg('ir.model.data').get_object_reference( cr, uid, 'account_banking_sepa_credit_transfer', 'export_sepa_sct_001_001_03')[1] self.payment_mode_id = reg('payment.mode').create( - cr, uid, { + cr, uid, + { 'name': 'SEPA Mode', 'bank_id': self.partner_bank_id, 'journal': self.bank_journal_id, @@ -236,7 +253,7 @@ class TestPaymentRoundtrip(SingleTransactionCase): 'transfer_account_id': transfer_account_id, 'transfer_journal_id': transfer_journal_id, 'type': payment_mode_type_id, - }) + }) def setup_payment(self, reg, cr, uid): """ @@ -244,40 +261,48 @@ class TestPaymentRoundtrip(SingleTransactionCase): Check that the payment order can be confirmed. """ self.payment_order_id = reg('payment.order').create( - cr, uid, { + cr, uid, + { 'reference': 'PAY001', 'mode': self.payment_mode_id, - }) + }) context = {'active_id': self.payment_order_id} entries = reg('account.move.line').search( - cr, uid, [ + cr, uid, + [ ('company_id', '=', self.company_id), ('account_id', '=', self.payable_id), - ]) + ]) self.payment_order_create_id = reg('payment.order.create').create( - cr, uid, { + cr, uid, + { 'entries': [(6, 0, entries)], - }, context=context) + }, + context=context) reg('payment.order.create').create_payment( cr, uid, [self.payment_order_create_id], context=context) # Check if payment lines are created with the correct reference self.assertTrue( reg('payment.line').search( - cr, uid, [ + cr, uid, + [ ('move_line_id.invoice', '=', self.invoice_ids[0]), ('communication', '=', 'INV1'), ('state', '=', 'normal'), - ], context=context), + ], + context=context), 'No payment line created from invoice 1 or with the wrong ' 'communication') self.assertTrue( reg('payment.line').search( - cr, uid, [ + cr, uid, + [ ('move_line_id.invoice', '=', self.invoice_ids[1]), ('communication', '=', 'STR2'), ('state', '=', 'structured'), - ], context=context), + ], + context=context), 'No payment line created from invoice 2 or with the wrong ' 'communication') @@ -294,8 +319,10 @@ class TestPaymentRoundtrip(SingleTransactionCase): """ export_model = reg('banking.export.sepa.wizard') export_id = export_model.create( - cr, uid, { - 'msg_identification': 'EXP001'}, + cr, uid, + { + 'msg_identification': 'EXP001' + }, context={'active_ids': [self.payment_order_id]}) export_model.create_sepa( cr, uid, [export_id]) @@ -314,19 +341,21 @@ class TestPaymentRoundtrip(SingleTransactionCase): line_model = reg('account.bank.statement.line') wizard_model = reg('banking.transaction.wizard') statement_id = statement_model.create( - cr, uid, { + cr, uid, + { 'name': 'Statement', 'journal_id': self.bank_journal_id, 'balance_end_real': -200.0, 'period_id': reg('account.period').find(cr, uid)[0] - }) + }) line_id = line_model.create( - cr, uid, { + cr, uid, + { 'name': 'Statement line', 'statement_id': statement_id, 'amount': -200.0, 'account_id': self.payable_id, - }) + }) wizard_id = wizard_model.create( cr, uid, {'statement_line_id': line_id}) wizard_model.write( diff --git a/account_banking_uk_hsbc/hsbc_mt940.py b/account_banking_uk_hsbc/hsbc_mt940.py index c1d7b7abc..ea2f45238 100644 --- a/account_banking_uk_hsbc/hsbc_mt940.py +++ b/account_banking_uk_hsbc/hsbc_mt940.py @@ -132,7 +132,7 @@ class statement(models.mem_bank_statement): '62F': _closing_balance, '61': _transaction_new, '86': _transaction_info, - } + } rectypes.get(record['recordid'], _not_used)() diff --git a/account_banking_uk_hsbc/mt940_parser.py b/account_banking_uk_hsbc/mt940_parser.py index ea18337ad..e8ec6e3a6 100644 --- a/account_banking_uk_hsbc/mt940_parser.py +++ b/account_banking_uk_hsbc/mt940_parser.py @@ -125,7 +125,7 @@ class HSBCParser(object): matchdict[field] = datetime.strptime(datestring, '%y%m%d') if post_check and matchdict[field] > matchdict["valuedate"]: matchdict[field] = matchdict[field].replace( - year=matchdict[field].year-1 + year=matchdict[field].year - 1 ) except ValueError: matchdict[field] = None diff --git a/account_banking_uk_hsbc/wizard/export_hsbc.py b/account_banking_uk_hsbc/wizard/export_hsbc.py index ecc4e9902..486432032 100644 --- a/account_banking_uk_hsbc/wizard/export_hsbc.py +++ b/account_banking_uk_hsbc/wizard/export_hsbc.py @@ -61,7 +61,7 @@ class banking_export_hsbc_wizard(orm.TransientModel): help=('The bank will use this reference in feedback communication ' 'to refer to this run. 35 characters are available.' ), - ), + ), 'execution_date_create': fields.date( 'Execution Date', help=('This is the date the file should be processed by the bank. ' @@ -71,38 +71,38 @@ class banking_export_hsbc_wizard(orm.TransientModel): 'days and typically use a delay of two days between ' 'execution date and effective transfer date.' ), - ), + ), 'file_id': fields.many2one( 'banking.export.hsbc', 'hsbc File', readonly=True - ), + ), 'file': fields.related( 'file_id', 'file', type='binary', readonly=True, string='File', - ), + ), 'execution_date_finish': fields.related( 'file_id', 'execution_date', type='date', readonly=True, string='Execution Date', - ), + ), 'total_amount': fields.related( 'file_id', 'total_amount', type='float', string='Total Amount', readonly=True, - ), + ), 'no_transactions': fields.integer( 'Number of Transactions', readonly=True, - ), + ), 'payment_order_ids': fields.many2many( 'payment.order', 'rel_wiz_payorders', 'wizard_id', 'payment_order_id', 'Payment Orders', readonly=True, - ), - } + ), + } logger = logging.getLogger('export_hsbc') diff --git a/account_banking_uk_hsbc/wizard/paymul.py b/account_banking_uk_hsbc/wizard/paymul.py index 09a9afe81..adcfa3eb4 100644 --- a/account_banking_uk_hsbc/wizard/paymul.py +++ b/account_banking_uk_hsbc/wizard/paymul.py @@ -508,7 +508,7 @@ class Batch(LogicalSection): # Need a debit-credit format for Priority Payments segments.append([ ['LIN'], - [index+1], + [index + 1], ]) segments.append([ ['DTM'], diff --git a/account_direct_debit/migrations/7.0.2/post-migration.py b/account_direct_debit/migrations/7.0.2/post-migration.py index f5c72c672..5d56f536b 100644 --- a/account_direct_debit/migrations/7.0.2/post-migration.py +++ b/account_direct_debit/migrations/7.0.2/post-migration.py @@ -35,5 +35,4 @@ def migrate(cr, version): """ ALTER TABLE "payment_line" DROP COLUMN "banking_addons_61_debit_move_line_id" - """ - ) + """) diff --git a/account_direct_debit/model/account_move_line.py b/account_direct_debit/model/account_move_line.py index 4d5fb4f15..f635dcad5 100644 --- a/account_direct_debit/model/account_move_line.py +++ b/account_direct_debit/model/account_move_line.py @@ -124,4 +124,4 @@ class account_move_line(orm.Model): amount_to_receive, method=True, type='float', string='Amount to receive', fnct_search=_to_receive_search), - } + } diff --git a/account_direct_debit/model/payment_line.py b/account_direct_debit/model/payment_line.py index 2be0993db..c7dde416f 100644 --- a/account_direct_debit/model/payment_line.py +++ b/account_direct_debit/model/payment_line.py @@ -49,47 +49,59 @@ class payment_line(orm.Model): if len(transit_move_line.reconcile_id.line_partial_ids) == 2: # reuse the simple reconcile for the storno transfer reconcile_obj.write( - cr, uid, reconcile_id, { + cr, uid, reconcile_id, + { 'line_id': [(6, 0, transit_move_line.id)], 'line_partial_ids': [(6, 0, [])], - }, context=context) + }, + context=context) else: # split up the original reconcile in a partial one # and a new one for reconciling the storno transfer reconcile_obj.write( - cr, uid, reconcile_id, { + cr, uid, reconcile_id, + { 'line_partial_ids': [(3, transit_move_line.id)], - }, context=context) + }, + context=context) reconcile_id = reconcile_obj.create( - cr, uid, { + cr, uid, + { 'type': 'auto', 'line_id': [(6, 0, transit_move_line.id)], - }, context=context) + }, + context=context) elif transit_move_line.reconcile_id: reconcile_id = transit_move_line.reconcile_id.id if len(transit_move_line.reconcile_id.line_id) == 2: # reuse the simple reconcile for the storno transfer reconcile_obj.write( - cr, uid, reconcile_id, { + cr, uid, reconcile_id, + { 'line_id': [(6, 0, [transit_move_line.id])] - }, context=context) + }, + context=context) else: # split up the original reconcile in a partial one # and a new one for reconciling the storno transfer partial_ids = [ x.id for x in transit_move_line.reconcile_id.line_id if x.id != transit_move_line.id - ] + ] reconcile_obj.write( - cr, uid, reconcile_id, { + cr, uid, reconcile_id, + { 'line_partial_ids': [(6, 0, partial_ids)], 'line_id': [(6, 0, [])], - }, context=context) + }, + context=context) reconcile_id = reconcile_obj.create( - cr, uid, { + cr, uid, + { 'type': 'auto', 'line_id': [(6, 0, transit_move_line.id)], - }, context=context) + }, + context=context) # mark the payment line for storno processed if reconcile_id: self.write(cr, uid, [payment_line_id], @@ -149,4 +161,4 @@ class payment_line(orm.Model): readonly=True, help=("If this is true, the debit order has been canceled " "by the bank or by the customer")), - } + } diff --git a/account_direct_debit/model/payment_order_create.py b/account_direct_debit/model/payment_order_create.py index 5625faac2..f89609650 100644 --- a/account_direct_debit/model/payment_order_create.py +++ b/account_direct_debit/model/payment_order_create.py @@ -37,5 +37,5 @@ class payment_order_create(orm.TransientModel): ('account_id.type', '=', 'receivable'), ('invoice.state', '!=', 'debit_denied'), ('amount_to_receive', '>', 0), - ] + ] return True diff --git a/account_iban_preserve_domestic/__openerp__.py b/account_iban_preserve_domestic/__openerp__.py index d78f8ec55..8e2d94e8a 100644 --- a/account_iban_preserve_domestic/__openerp__.py +++ b/account_iban_preserve_domestic/__openerp__.py @@ -31,10 +31,10 @@ 'depends': [ 'base_iban', 'account', - ], + ], 'data': [ 'res_partner_bank_view.xml' - ], + ], 'description': ''' This module is compatible with OpenERP 7.0. diff --git a/account_iban_preserve_domestic/res_partner_bank.py b/account_iban_preserve_domestic/res_partner_bank.py index 92aba4a06..36d2b6ece 100644 --- a/account_iban_preserve_domestic/res_partner_bank.py +++ b/account_iban_preserve_domestic/res_partner_bank.py @@ -29,4 +29,4 @@ class res_partner_bank(orm.Model): _columns = { 'acc_number_domestic': fields.char( 'Domestic Account Number', size=64) - } + } diff --git a/account_payment_partner/model/account_invoice.py b/account_payment_partner/model/account_invoice.py index 607cda29a..79ab3d4b4 100644 --- a/account_payment_partner/model/account_invoice.py +++ b/account_payment_partner/model/account_invoice.py @@ -29,7 +29,7 @@ class account_invoice(orm.Model): _columns = { 'payment_mode_id': fields.many2one( 'payment.mode', 'Payment Mode'), - } + } def onchange_partner_id( self, cr, uid, ids, type, partner_id, date_invoice=False, @@ -50,7 +50,7 @@ class account_invoice(orm.Model): 'partner_bank_id': partner.customer_payment_mode and partner.customer_payment_mode.bank_id.id or False, - }) + }) else: res['value']['payment_mode_id'] = False return res diff --git a/account_payment_partner/model/partner.py b/account_payment_partner/model/partner.py index 4bfe4c787..c15dda29e 100644 --- a/account_payment_partner/model/partner.py +++ b/account_payment_partner/model/partner.py @@ -35,7 +35,7 @@ class res_partner(orm.Model): 'payment.mode', type='many2one', relation='payment.mode', string='Customer Payment Mode', view_load=True, help="Select the default payment mode for this customer."), - } + } def _commercial_fields(self, cr, uid, context=None): res = super(res_partner, self)._commercial_fields( diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py index ea8b1ccb3..0646c5c98 100644 --- a/account_payment_partner/model/payment_order_create.py +++ b/account_payment_partner/model/payment_order_create.py @@ -35,5 +35,5 @@ class payment_order_create(orm.TransientModel): ('invoice', '=', False), ('invoice.payment_mode_id', '=', False), ('invoice.payment_mode_id', '=', payment_order.mode.id) - ] + ] return True diff --git a/account_payment_purchase/model/purchase.py b/account_payment_purchase/model/purchase.py index f397a6a61..492bb9cd5 100644 --- a/account_payment_purchase/model/purchase.py +++ b/account_payment_purchase/model/purchase.py @@ -34,7 +34,7 @@ class purchase_order(orm.Model): "from the partner and will be copied to the supplier invoice."), 'payment_mode_id': fields.many2one( 'payment.mode', 'Payment Mode'), - } + } def _get_default_supplier_partner_bank( self, cr, uid, partner, context=None): @@ -56,12 +56,12 @@ class purchase_order(orm.Model): cr, uid, partner), 'payment_mode_id': partner.supplier_payment_mode.id or False, - }) + }) else: res['value'].update({ 'supplier_partner_bank_id': False, 'payment_mode_id': False, - }) + }) return res def action_invoice_create(self, cr, uid, ids, context=None): @@ -73,10 +73,12 @@ class purchase_order(orm.Model): for order in self.browse(cr, uid, ids, context=context): for invoice in order.invoice_ids: if invoice.state == 'draft': - invoice.write({ - 'partner_bank_id': - order.supplier_partner_bank_id.id or False, - 'payment_mode_id': - order.payment_mode_id.id or False, - }, context=context) + invoice.write( + { + 'partner_bank_id': + order.supplier_partner_bank_id.id or False, + 'payment_mode_id': + order.payment_mode_id.id or False, + }, + context=context) return res diff --git a/account_payment_purchase/model/stock.py b/account_payment_purchase/model/stock.py index 9d2bf5580..f9171f762 100644 --- a/account_payment_purchase/model/stock.py +++ b/account_payment_purchase/model/stock.py @@ -38,5 +38,5 @@ class stock_picking(orm.Model): picking.purchase_id.supplier_partner_bank_id.id or False, 'payment_mode_id': picking.purchase_id.payment_mode_id.id or False, - }) + }) return invoice_vals diff --git a/account_payment_sale/model/sale.py b/account_payment_sale/model/sale.py index 10399645e..a963dfa7d 100644 --- a/account_payment_sale/model/sale.py +++ b/account_payment_sale/model/sale.py @@ -29,7 +29,7 @@ class sale_order(orm.Model): _columns = { 'payment_mode_id': fields.many2one( 'payment.mode', 'Payment Mode'), - } + } def onchange_partner_id(self, cr, uid, ids, part, context=None): res = super(sale_order, self).onchange_partner_id( @@ -51,5 +51,5 @@ class sale_order(orm.Model): 'payment_mode_id': order.payment_mode_id.id or False, 'partner_bank_id': order.payment_mode_id and order.payment_mode_id.bank_id.id or False, - }) + }) return invoice_vals diff --git a/account_payment_sale_stock/model/stock.py b/account_payment_sale_stock/model/stock.py index 5ed4fbd4f..c81d21c60 100644 --- a/account_payment_sale_stock/model/stock.py +++ b/account_payment_sale_stock/model/stock.py @@ -39,5 +39,5 @@ class stock_picking(orm.Model): picking.sale_id.payment_mode_id.bank_id.id or False, 'payment_mode_id': picking.sale_id.payment_mode_id.id or False, - }) + }) return invoice_vals diff --git a/bank_statement_instant_voucher/model/account_bank_statement_line.py b/bank_statement_instant_voucher/model/account_bank_statement_line.py index c173d8640..e202aac42 100644 --- a/bank_statement_instant_voucher/model/account_bank_statement_line.py +++ b/bank_statement_instant_voucher/model/account_bank_statement_line.py @@ -47,5 +47,5 @@ class account_bank_statement_line(orm.Model): 'target': 'new', 'res_id': False, 'nodestroy': False, - } + } return res diff --git a/bank_statement_instant_voucher/model/account_voucher_instant.py b/bank_statement_instant_voucher/model/account_voucher_instant.py index 15b6bc55a..a41540d91 100644 --- a/bank_statement_instant_voucher/model/account_voucher_instant.py +++ b/bank_statement_instant_voucher/model/account_voucher_instant.py @@ -107,7 +107,7 @@ class instant_voucher(orm.TransientModel): })], 'amount': line.amount and abs(line.amount) or False, 'journal_id': journal_ids[0], - } + } if vals['date']: period_ids = period_pool.find( cr, uid, vals['date'], context=context @@ -135,7 +135,7 @@ class instant_voucher(orm.TransientModel): 'target': 'new', 'res_id': ids[0], 'nodestroy': False, - } + } def dummy(self, cr, uid, ids, context=None): return { @@ -149,7 +149,7 @@ class instant_voucher(orm.TransientModel): 'target': 'new', 'res_id': ids[0], 'nodestroy': False, - } + } def default_get(self, cr, uid, fields_list, context=None): """ @@ -272,7 +272,7 @@ class instant_voucher(orm.TransientModel): 'match_type': 'move', 'invoice_id': False, 'invoice_ids': [(6, 0, [])], - }, + }, context=context ) @@ -314,6 +314,6 @@ class instant_voucher(orm.TransientModel): [('sale', 'Sale'), ('purchase', 'Purchase')], 'Voucher type'), - } + } _defaults = {'state': 'init'} diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py index d579bd492..1da2ae816 100644 --- a/base_iban_bic_not_required/__openerp__.py +++ b/base_iban_bic_not_required/__openerp__.py @@ -28,7 +28,7 @@ 'category': 'Banking addons', 'depends': [ 'base_iban', - ], + ], 'description': ''' The account_iban module in OpenERP mandates the presence of a BIC code on an IBAN account number through a constraint. However, as of @@ -42,6 +42,6 @@ See also https://bugs.launchpad.net/openobject-addons/+bug/933472 ''', 'data': [ 'data/res_partner_bank_type_field.xml', - ], + ], 'installable': True, }