Undo style changes and changes in error messages

This commit is contained in:
Stefan Rijnhart
2011-05-01 14:56:08 +02:00
parent ac307f415a
commit 67f390c73b
3 changed files with 33 additions and 33 deletions

View File

@@ -768,6 +768,8 @@ class payment_order(osv.osv):
# Therefore, if we want to pass the id in the context safely we have to
# pass it under a different name.
#
# TODO: migrate old style wizards to osv_memory
#
'id_proxy': fields.function(
_get_id_proxy, method=True, string='Copy ID', type='integer',
store={
@@ -913,8 +915,7 @@ class payment_order(osv.osv):
self._write_payment_lines(cursor, uid, ids, export_state='rejected')
wf_service = netsvc.LocalService('workflow')
for id in ids:
wf_service.trg_validate(
uid, 'payment.order', id, 'rejected', cursor)
wf_service.trg_validate(uid, 'payment.order', id, 'rejected', cursor)
return True
def set_done(self, cursor, uid, ids, *args):
@@ -1199,8 +1200,8 @@ class res_partner_bank(osv.osv):
else:
# Ok, tried everything, give up and leave it to the user
return warning(_('Insufficient data'),
_('Insufficient country information to '
'select online conversion database')
_('Insufficient data to select online '
'conversion database')
)
result = {'value': values}
# Complete data with online database when available
@@ -1217,17 +1218,17 @@ class res_partner_bank(osv.osv):
info.bic or iban_acc.BIC_searchkey,
code = info.code, name = info.bank
)
values['country_id'] = (
country_id or country_ids and country_ids[0] or
False)
values['country_id'] = country_id or \
country_ids and country_ids[0] or \
False
values['bank'] = bank_id or False
else:
info = None
if info is None:
result.update(warning(
_('Invalid data'),
_('Could not verify the account number\'s validity '
'for %(country)s') % {'country': country.name}
_('The account number appears to be invalid for %(country)s')
% {'country': country.name}
))
except NotImplementedError:
if country.code in sepa.IBAN.countries:
@@ -1238,8 +1239,8 @@ class res_partner_bank(osv.osv):
values['acc_number'] = acc_number
result.update(warning(
_('Invalid format'),
_('The account number has the wrong format for '
'%(country)s') % {'country': country.name}
_('The account number has the wrong format for %(country)s')
% {'country': country.name}
))
else:
values['acc_number'] = acc_number

View File

@@ -126,7 +126,6 @@ def BBAN_is_IBAN(bank_acc):
Intelligent copy, valid for SEPA members who switched to SEPA from old
standards before SEPA actually started.
'''
iban_acc = False
if isinstance(bank_acc, IBAN):
iban_acc = bank_acc
else:

View File

@@ -173,13 +173,12 @@ class banking_import(wizard.interface):
# TODO: Not sure what side effects are created when payments are done
# for credited customer invoices, which will be matched later on too.
digits = dp.get_precision('Account')(cursor)[1]
candidates = [x for x in payment_lines if (
x.communication == trans.reference and
round(x.amount, digits) == -round(
trans.transferred_amount, digits) and
trans.remote_account in (x.bank_id.acc_number,
candidates = [x for x in payment_lines
if x.communication == trans.reference
and round(x.amount, digits) == -round(trans.transferred_amount, digits)
and trans.remote_account in (x.bank_id.acc_number,
x.bank_id.iban)
)]
]
if len(candidates) == 1:
candidate = candidates[0]
# Check cache to prevent multiple matching of a single payment
@@ -513,14 +512,15 @@ class banking_import(wizard.interface):
check_total = amount,
invoice_line = invoice_lines,
))
invoice = invoice_obj.browse(cursor, uid, invoice_id)
# Create workflow
invoice_obj.button_compute(cursor, uid, [invoice_id],
{'type': 'in_invoice'}, set_total=True)
wf_service = netsvc.LocalService('workflow')
# Move to state 'open'
wf_service.trg_validate(uid, 'account.invoice', invoice_id,
wf_service.trg_validate(uid, 'account.invoice', invoice.id,
'invoice_open', cursor)
invoice = invoice_obj.browse(cursor, uid, invoice_id)
# return move_lines to mix with the rest
return [x for x in invoice.move_id.line_id if x.account_id.reconcile]
@@ -568,6 +568,7 @@ class banking_import(wizard.interface):
# Parse the file
statements = parser.parse(data)
if any([x for x in statements if not x.is_valid()]):
raise wizard.except_wizard(
_('ERROR!'),
@@ -730,8 +731,8 @@ class banking_import(wizard.interface):
))
imported_statement_ids.append(statement_id)
# move each transaction to the right period and try to match it
# with an invoice or payment
# move each transaction to the right period and try to match it with an
# invoice or payment
subno = 0
injected = []
i = 0
@@ -743,8 +744,8 @@ class banking_import(wizard.interface):
transaction = injected.pop(0)
else:
transaction = statement.transactions[i]
# Keep a tracer for identification of order in a statement
# in case of missing transaction ids.
# Keep a tracer for identification of order in a statement in case
# of missing transaction ids.
subno += 1
# Link accounting period
@@ -799,16 +800,15 @@ class banking_import(wizard.interface):
if partner_banks:
partner_ids = [x.partner_id.id for x in partner_banks]
elif transaction.remote_owner:
iban = None
country_code = None
if transaction.remote_account:
iban = sepa.IBAN(transaction.remote_account)
if iban and iban.valid:
if iban.valid:
country_code = iban.countrycode
elif transaction.remote_owner_country_code:
country_code = transaction.remote_owner_country_code
elif hasattr(parser, 'country_code') and parser.country_code:
country_code = parser.country_code
else:
country_code = None
partner_id = get_or_create_partner(
self.pool, cursor, uid, transaction.remote_owner,
transaction.remote_owner_address,