fixed bug :
* open customer Invoice form when make invoice from sale order wizard * give error message when create invoice from packing if packing invoice state is not "To be invoice" bzr revid: hmo@tinyerp.com-20090122112333-drk9w42wyrav1tn9
This commit is contained in:
parent
8e48b624a3
commit
f6053f534d
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -54,17 +54,26 @@ def _makeInvoices(self, cr, uid, data, context):
|
|||
for o in order_obj.browse(cr, uid, data['ids'], context):
|
||||
for i in o.invoice_ids:
|
||||
newinv.append(i.id)
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
|
||||
'name': 'Invoices',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.invoice',
|
||||
'view_id': False,
|
||||
'context': "{'type':'out_refund'}",
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return {}
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod_obj = pool.get('ir.model.data')
|
||||
act_obj = pool.get('ir.actions.act_window')
|
||||
xml_id='action_invoice_tree5'
|
||||
result = mod_obj._get_id(cr, uid, 'account', xml_id)
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
|
||||
result = act_obj.read(cr, uid, id)
|
||||
result['domain'] ="[('id','in', ["+','.join(map(str,newinv))+"])]"
|
||||
return result
|
||||
#return {
|
||||
# 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
|
||||
# 'name': 'Invoices',
|
||||
# 'view_type': 'form',
|
||||
# 'view_mode': 'tree,form',
|
||||
# 'res_model': 'account.invoice',
|
||||
# 'view_id': False,
|
||||
# 'context': "{'type':'out_refund'}",
|
||||
# 'type': 'ir.actions.act_window'
|
||||
#}
|
||||
#return {}
|
||||
|
||||
class make_invoice(wizard.interface):
|
||||
states = {
|
||||
|
|
|
@ -65,7 +65,12 @@ invoice_fields = {
|
|||
def _get_type(obj, cr, uid, data, context):
|
||||
picking_obj=pooler.get_pool(cr.dbname).get('stock.picking')
|
||||
usage = 'customer'
|
||||
pick = picking_obj.browse(cr, uid, data['id'], context)
|
||||
pick = picking_obj.browse(cr, uid, data['id'], context)
|
||||
if pick.invoice_state=='Invoiced':
|
||||
raise wizard.except_wizard('UserError','Invoice is already created')
|
||||
if pick.invoice_state=='none':
|
||||
raise wizard.except_wizard('UserError','Invoice can not create from Packing')
|
||||
|
||||
if pick.move_lines:
|
||||
usage=pick.move_lines[0].location_id.usage
|
||||
|
||||
|
@ -96,10 +101,9 @@ def _create_invoice(obj, cr, uid, data, context):
|
|||
journal_id=data['form']['journal_id'],group=data['form']['group'],
|
||||
type=type, context= context)
|
||||
|
||||
invoice_ids = res.values()
|
||||
|
||||
invoice_ids = res.values()
|
||||
if not invoice_ids:
|
||||
return {}
|
||||
raise wizard.except_wizard('Error','Invoice is not created')
|
||||
|
||||
if type == 'out_invoice':
|
||||
xml_id = 'action_invoice_tree5'
|
||||
|
@ -111,9 +115,9 @@ def _create_invoice(obj, cr, uid, data, context):
|
|||
xml_id = 'action_invoice_tree12'
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', xml_id)
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
|
||||
result = act_obj.read(cr, uid, id)
|
||||
result['res_id'] = invoice_ids
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
result = act_obj.read(cr, uid, id['res_id'])
|
||||
result['res_id'] = invoice_ids
|
||||
return result
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue