[FIX] Account voucher: Did not create move_ids on bank statement lines when we confirm the bank statements

bzr revid: mra@mra-laptop-20100930070601-6bz0ozmgfbm265xp
This commit is contained in:
Mustufa Rangwala 2010-09-30 12:36:01 +05:30
parent 9fbb0e95e4
commit 342ff9db57
2 changed files with 7 additions and 1 deletions

View File

@ -375,7 +375,7 @@ class account_bank_statement(osv.osv):
if not st_line.amount:
continue
st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
self.create_move_from_st_line(cr, uid, st_line, company_currency_id, st_line_number, context)
self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
self.write(cr, uid, [st.id], {'name': st_number}, context=context)
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st_number)

View File

@ -568,6 +568,7 @@ class account_voucher(osv.osv):
analytic_pool = self.pool.get('account.analytic.line')
currency_pool = self.pool.get('res.currency')
invoice_pool = self.pool.get('account.invoice')
bank_st_line_obj = self.pool.get('account.bank.statement.line')
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
@ -587,6 +588,11 @@ class account_voucher(osv.osv):
'period_id': inv.period_id and inv.period_id.id or False
}
move_id = move_pool.create(cr, uid, move)
line_bank_ids = bank_st_line_obj.search(cr, uid, [('voucher_id', '=', inv.id)], context=context)
if line_bank_ids:
bank_st_line_obj.write(cr, uid, line_bank_ids, {
'move_ids': [(4, move_id, False)]
})
#create the first line manually
company_currency = inv.journal_id.company_id.currency_id.id