[IMP] Account: refund invoice wizard: if there is no refund journal defined (if that field is empty), it should use the journal defined on the current invoice for the refund invoice

bzr revid: mra@mra-laptop-20100825062427-1jpd3ocg7mklytyj
This commit is contained in:
Mustufa Rangwala
2010-08-25 11:54:27 +05:30
parent 4c7543b20a
commit a6bac8c19f
@@ -80,6 +80,7 @@ class account_invoice_refund(osv.osv_memory):
period = False
description = False
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
journal_id = form.get('journal_id', False)
for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
if inv.state in ['draft', 'proforma2', 'cancel']:
raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
@@ -88,7 +89,8 @@ class account_invoice_refund(osv.osv_memory):
else:
period = inv.period_id and inv.period_id.id or False
journal_id = form.get('journal_id', False)
if not journal_id:
journal_id = inv.journal_id.id
if form['date'] :
date = form['date']