wrong variable name, copy the invoice's move ref in statement line's ref

This commit is contained in:
Guewen Baconnier
2014-01-16 16:24:10 +01:00
parent 695f979d70
commit 0152e486ed

View File

@@ -106,13 +106,17 @@ class AccountStatementCompletionRule(Model):
[('transaction_id', '=', st_line['transaction_id'])], [('transaction_id', '=', st_line['transaction_id'])],
context=context) context=context)
if len(invoice_id) > 1: if len(invoice_id) > 1:
raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more than ' raise ErrorTooManyPartner(
'one partner.') % (st_line['name'], st_line['ref'])) _('Line named "%s" (Ref:%s) was matched by more than '
if len(so_id) == 1: 'one partner.') % (st_line['name'], st_line['ref']))
invoice = invoice_obj.browse(cr, uid, invoice_id[0], context=context) elif len(invoice_id) == 1:
invoice = invoice_obj.browse(cr, uid, invoice_id[0],
context=context)
res['partner_id'] = invoice.partner_id.id res['partner_id'] = invoice.partner_id.id
# TODO: should have the same ref than the invoice's move # should have the same ref than the invoice's move
# res['ref'] = invoice.ref # what TODO if the invoice is no yet validated
if invoice.move_id:
res['ref'] = invoice.move_id.ref
st_vals = st_obj.get_values_for_line( st_vals = st_obj.get_values_for_line(
cr, uid, cr, uid,
profile_id=st_line['profile_id'], profile_id=st_line['profile_id'],