diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 6f2d9d02dbc..b74ae87a685 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -95,8 +95,11 @@ class account_payment_populate_statement(osv.osv_memory): } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) voucher_line_dict = False - if result['value']['line_ids']: - for line_dict in result['value']['line_ids']: + + # NOTE: we only check for lines on 'debit' as Payment Order only allow user + # to choose account.move.line with credit > 0, i.e payment will be on 'debit' + if result['value']['line_dr_ids']: + for line_dict in result['value']['line_dr_ids']: move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context) if line.move_line_id.move_id.id == move_line.move_id.id: voucher_line_dict = line_dict @@ -120,4 +123,4 @@ class account_payment_populate_statement(osv.osv_memory): account_payment_populate_statement() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: