[FIX] account_statement_completion_label: account should be a required field and we only add the result if the partner_id is not empty.

This commit is contained in:
Sébastien Beau
2013-05-20 15:18:47 +02:00
committed by Sebastien Beau
parent c44cc51f08
commit 7de1c3fa0c

View File

@@ -105,7 +105,8 @@ class AccountStatementCompletionRule(orm.Model):
raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by '
'more than one statement label.') %
(st_line['name'], st_line['ref']))
res['partner_id'] = label_info[0]['partner_id']
if label_info[0]['partner_id']:
res['partner_id'] = label_info[0]['partner_id']
res['account_id'] = label_info[0]['account_id']
return res
@@ -122,6 +123,7 @@ class AccountStatementLabel(orm.Model):
'partner_id': fields.many2one('res.partner', 'Partner'),
'label': fields.char('Bank Statement Label', size=100),
'account_id': fields.many2one('account.account', 'Account',
required = True,
help='Account corresponding to the label '
'for a given partner'),
'company_id': fields.many2one('res.company', 'Company'),