[MERGE] merge with psi branch for sale workflow and buttons
bzr revid: psi@tinyerp.com-20120307064133-wlj5r9jmyyatxsnt
This commit is contained in:
@@ -513,6 +513,64 @@ class sale_order(osv.osv):
|
||||
'res_id': inv_ids and inv_ids[0] or False,
|
||||
}
|
||||
|
||||
def action_view_invoice(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
inv_ids = []
|
||||
for so in self.browse(cr, uid, ids, context=context):
|
||||
inv_ids+= [invoice.id for invoice in so.invoice_ids]
|
||||
|
||||
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', 'journal_type': 'sale'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': inv_ids and inv_ids[0] or False,
|
||||
}
|
||||
|
||||
def action_view_delivery(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
pick_ids = []
|
||||
for so in self.browse(cr, uid, ids, context=context):
|
||||
pick_ids += [picking.id for picking in so.picking_ids]
|
||||
if len(pick_ids) > 1:
|
||||
res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_tree')
|
||||
res_id = res and res[1] or False,
|
||||
return {
|
||||
'name': _('Delivery Order'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree',
|
||||
'view_id': res_id,
|
||||
'res_model': 'stock.picking',
|
||||
'context': "{'type':'out'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': pick_ids or False,
|
||||
}
|
||||
else:
|
||||
res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form')
|
||||
res_id = res and res[1] or False,
|
||||
return {
|
||||
'name': _('Delivery Order'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'view_id': res_id,
|
||||
'res_model': 'stock.picking',
|
||||
'context': "{'type':'out'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': pick_ids and pick_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
|
||||
invoices = {}
|
||||
|
||||
@@ -210,6 +210,11 @@
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<button name="print_quotation" string="Print Quotation" type="object" icon="gtk-print" states="draft"/>
|
||||
<button name="order_confirm" states="draft,sent" string="Confirm Order" icon="gtk-apply"/>
|
||||
<button name="action_view_invoice" string="Open Invoice" icon="gtk-go-forward" type="object"
|
||||
attrs="{'invisible': ['|','|','|',('state', 'not in', ('progress',)), ('invoiced', '=', True),'&',('order_policy','=','picking'),
|
||||
('state', '!=','done'),'&','&',('order_policy','=','postpaid'),('state', '=','progress'),('shipped','=',False)]}"/>
|
||||
<button name="action_view_delivery" string="Open Delivery Order" icon="gtk-go-forward" type="object"
|
||||
attrs="{'invisible': ['|','|', ('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}"/>
|
||||
<button name="cancel" states="draft,sent" string="Cancel Order" icon="gtk-cancel"/>
|
||||
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/>
|
||||
<button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/>
|
||||
|
||||
Reference in New Issue
Block a user