[FIX]: Chance manual_invoice method into sale_stock module.
bzr revid: atp@tinyerp.com-20120727090607-w3y8jiy459z0iuok
This commit is contained in:
@@ -378,36 +378,6 @@ class sale_order(osv.osv):
|
||||
}
|
||||
return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order', 'datas': datas, 'nodestroy': True}
|
||||
|
||||
def manual_invoice(self, cr, uid, ids, context=None):
|
||||
""" create invoices for the given sale orders (ids), and open the form
|
||||
view of one of the newly created invoices
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
# create invoices through the sale orders' workflow
|
||||
inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
|
||||
for id in ids:
|
||||
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
|
||||
inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
|
||||
# determine newly created invoices
|
||||
new_inv_ids = list(inv_ids1 - inv_ids0)
|
||||
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
|
||||
res_id = res and res[1] or False,
|
||||
|
||||
return {
|
||||
'name': _('Customer Invoices'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'view_id': [res_id],
|
||||
'res_model': 'account.invoice',
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': new_inv_ids and new_inv_ids[0] or False,
|
||||
}
|
||||
|
||||
def action_view_invoice(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
|
||||
@@ -208,7 +208,40 @@ class sale_order(osv.osv):
|
||||
self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
|
||||
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
|
||||
self.confirm_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
return True
|
||||
|
||||
def manual_invoice(self, cr, uid, ids, context=None):
|
||||
""" create invoices for the given sale orders (ids), and open the form
|
||||
view of one of the newly created invoices
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
# create invoices through the sale orders' workflow
|
||||
inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
|
||||
for id in ids:
|
||||
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
|
||||
inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
|
||||
# determine newly created invoices
|
||||
new_inv_ids = list(inv_ids1 - inv_ids0)
|
||||
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
|
||||
res_id = res and res[1] or False,
|
||||
|
||||
return {
|
||||
'name': _('Customer Invoices'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'view_id': [res_id],
|
||||
'res_model': 'account.invoice',
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': new_inv_ids and new_inv_ids[0] or False,
|
||||
}
|
||||
|
||||
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
|
||||
res = False
|
||||
|
||||
@@ -53,10 +53,6 @@
|
||||
<field name="act_to" ref="act_wait_ship"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_router_wait_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="sale.act_router"/>
|
||||
<field name="act_to" ref="sale.act_wait_invoice"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_router_wait_invoice_shipping" model="workflow.transition">
|
||||
<field name="act_from" ref="sale.act_wait_invoice"/>
|
||||
|
||||
Reference in New Issue
Block a user