[IMP] clarify comments + minor cleanup

This commit is contained in:
Stéphane Bidoul
2013-09-11 11:14:07 +02:00
parent a0f4f121cc
commit dcbe07ece1
2 changed files with 9 additions and 10 deletions

View File

@@ -34,10 +34,10 @@
'account_statement_base_import' 'account_statement_base_import'
], ],
'description': """ 'description': """
Add a completion method based on bank account number provided by the bank/office. Add a completion method based on the partner bank account number provided by the bank/office.
Completion will look in the partner with that bank account number to match the partner Completion will look in the partner with that bank account number to match the partner,
, then it will fill in the bank statement line with it to ease the reconciliation. then it will fill in the bank statement line with it to ease the reconciliation.
""", """,
'website': 'http://www.acsone.eu', 'website': 'http://www.acsone.eu',

View File

@@ -47,7 +47,6 @@ class AccountStatementCompletionRule(Model):
""" """
Match the partner based on the partner account number field Match the partner based on the partner account number field
Then, call the generic st_line method to complete other values. Then, call the generic st_line method to complete other values.
In that case, we always fullfill the reference of the line with the SO name.
:param dict st_line: read of the concerned account.bank.statement.line :param dict st_line: read of the concerned account.bank.statement.line
:return: :return:
A dict of value that can be passed directly to the write method of A dict of value that can be passed directly to the write method of
@@ -60,16 +59,16 @@ class AccountStatementCompletionRule(Model):
return {} return {}
st_obj = self.pool.get('account.bank.statement.line') st_obj = self.pool.get('account.bank.statement.line')
res = {} res = {}
res_bank = self.pool.get('res.partner.bank') res_bank_obj = self.pool.get('res.partner.bank')
ids = res_bank.search(cr, ids = res_bank_obj.search(cr,
uid, uid,
[('acc_number', '=', st_line['partner_acc_number'])], [('acc_number', '=', st_line['partner_acc_number'])],
context=context) context=context)
if len(ids) > 1: if len(ids) > 1:
raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more than ' raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more than '
'one partner.') % (st_line['name'], st_line['ref'])) 'one partner.') % (st_line['name'], st_line['ref']))
if len(ids) == 1: if len(ids) == 1:
partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id partner = res_bank_obj.browse(cr, uid, ids[0], context=context).partner_id
res['partner_id'] = partner.id res['partner_id'] = partner.id
st_vals = st_obj.get_values_for_line(cr, st_vals = st_obj.get_values_for_line(cr,
uid, uid,