[FIX] Account voucher: Voucher lines got wrong value when using invoice with payment terms
bzr revid: mra@mra-laptop-20100929112546-7wubehkdze6u88mi
This commit is contained in:
@@ -393,7 +393,11 @@ class account_voucher(osv.osv):
|
||||
else:
|
||||
total_credit = price or 0.0
|
||||
account_type = 'receivable'
|
||||
ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context)
|
||||
|
||||
if not context.get('move_line_ids', False):
|
||||
ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context)
|
||||
else:
|
||||
ids = context['move_line_ids']
|
||||
ids.reverse()
|
||||
moves = move_line_pool.browse(cr, uid, ids)
|
||||
|
||||
|
||||
@@ -71,9 +71,9 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
||||
elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
|
||||
amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,
|
||||
statement.currency.id, amount, context=ctx)
|
||||
|
||||
|
||||
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt') ,
|
||||
'name': line.name,
|
||||
'name': line.name,
|
||||
'partner_id': line.partner_id.id,
|
||||
'journal_id': statement.journal_id.id,
|
||||
'account_id': line.account_id.id,
|
||||
@@ -83,7 +83,8 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
||||
'amount':abs(amount),
|
||||
'period_id':statement.period_id.id}
|
||||
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'))
|
||||
context.update({'move_line_ids': [line.id]})
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
|
||||
voucher_line_dict = False
|
||||
if result['value']['line_ids']:
|
||||
for line_dict in result['value']['line_ids']:
|
||||
|
||||
Reference in New Issue
Block a user