In invoices, if we do not specify the period (force period) it must take the period relative to the date of the invoice, not the current period.
bzr revid: hmo@tinyerp.com-20080825122504-9g3lxashtn3100zx
This commit is contained in:
@@ -499,14 +499,18 @@ class account_invoice(osv.osv):
|
||||
_('Can not create invoice move on centralized journal'))
|
||||
|
||||
move = {'name': name, 'line_id': line, 'journal_id': journal_id}
|
||||
if inv.period_id:
|
||||
move['period_id'] = inv.period_id.id
|
||||
period_id=inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',inv.date_invoice),('date_stop','>=',inv.date_invoice)])
|
||||
if len(period_ids):
|
||||
period_id=period_ids[0]
|
||||
if period_id:
|
||||
move['period_id'] = period_id
|
||||
for i in line:
|
||||
i[2]['period_id'] = inv.period_id.id
|
||||
|
||||
i[2]['period_id'] = period_id
|
||||
move_id = self.pool.get('account.move').create(cr, uid, move)
|
||||
# make the invoice point to that move
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id})
|
||||
self.pool.get('account.move').post(cr, uid, [move_id])
|
||||
self._log_event(cr, uid, ids)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user