[IMP] sale,purchase, stock,crm : merge sales orders, merge purchase orders, merge inventory, merge opportunity wizard only display in list view. action of these wizards are not available in right side of form view

bzr revid: amp@tinyerp.com-20101015073009-th71oyqbr3pqss69
This commit is contained in:
AMP (OpenERP) 2010-10-15 13:00:09 +05:30
parent b39b68b7a5
commit b69421fc6d
4 changed files with 76 additions and 2 deletions

View File

@ -41,6 +41,25 @@ class crm_lead(crm_case, osv.osv):
_description = "Lead"
_order = "date_action, priority, id desc"
_inherit = ['mailgate.thread','res.partner.address']
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
context={}
res = super(crm_lead, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if view_type == 'form':
if res['toolbar']['action'] and res['toolbar']['action'][0]['res_model']=='crm.merge.opportunity':
res['toolbar']['action']=[]
return res
def _compute_day(self, cr, uid, ids, fields, args, context={}):
"""
@param cr: the current row, from the database cursor,

View File

@ -37,6 +37,25 @@ from osv.orm import browse_record, browse_null
# Model definition
#
class purchase_order(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
context={}
res = super(purchase_order, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if view_type == 'form':
if res['toolbar']['action'] and res['toolbar']['action'][0]['res_model']=='purchase.order.group':
res['toolbar']['action']=[]
return res
def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
for order in self.browse(cr, uid, ids):
@ -44,7 +63,7 @@ class purchase_order(osv.osv):
for oline in order.order_line:
res[order.id] += oline.price_unit * oline.product_qty
return res
def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
res = {}
cur_obj=self.pool.get('res.currency')

View File

@ -54,7 +54,25 @@ def _incoterm_get(self, cr, uid, context=None):
class sale_order(osv.osv):
_name = "sale.order"
_description = "Sale Order"
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
context={}
res = super(sale_order, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if view_type == 'form':
if res['toolbar']['action'] and res['toolbar']['action'][0]['res_model']=='sale.make.invoice':
res['toolbar']['action']=[]
return res
def copy(self, cr, uid, id, default=None, context=None):
if context is None:
context = {}

View File

@ -2371,6 +2371,24 @@ class stock_inventory(osv.osv):
'state': 'draft',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c)
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
context={}
res = super(stock_inventory, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if view_type == 'form':
if res['toolbar']['action'] and res['toolbar']['action'][0]['res_model']=='stock.fill.inventory':
res['toolbar']['action']=[]
return res
def _inventory_line_hook(self, cr, uid, inventory_line, move_vals):
""" Creates a stock move from an inventory line