[IMP] sale:Add a button 'New Copy of Quotation' that is visible in cancel state only and opens new so.

bzr revid: tpa@tinyerp.com-20121109052748-bgwqr3vwnhjkl93y
This commit is contained in:
Turkesh Patel (Open ERP) 2012-11-09 10:57:48 +05:30
parent a19b7ceb27
commit e3ad0798bd
2 changed files with 16 additions and 0 deletions

View File

@ -264,6 +264,21 @@ class sale_order(osv.osv):
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
def new_quotation(self, cr, uid, ids, default=None, context=None):
id = self.copy(cr, uid, ids[0], context=None)
view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'view_order_form')
view_id = view_ref and view_ref[1] or False,
return {
'type': 'ir.actions.act_window',
'name': _('Sales Order'),
'res_model': 'sale.order',
'res_id': id,
'view_type': 'form',
'view_mode': 'form',
'view_id': view_id,
'target': 'current',
}
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None):
if not pricelist_id:
return {}

View File

@ -176,6 +176,7 @@
attrs="{'invisible': [('invoice_exists', '=', False)]}" groups="base.group_user"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
type="action" states="manual" class="oe_highlight" groups="base.group_user"/>
<button name="new_quotation" states="cancel" string="New Copy of Quotation" type="object"/>
<button name="cancel" states="draft,sent" string="Cancel" groups="base.group_user"/>
<button name="action_cancel" states="manual,progress" string="Cancel" type="object" groups="base.group_user"/>
<button name="invoice_cancel" states="invoice_except" string="Cancel" groups="base.group_user"/>