diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 23b1af57b28..8445c8f522d 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -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, diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 1522c4543f3..af046f23760 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -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') diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 8a26ef6ebba..88ee8b5af17 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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 = {} diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1c5ee23a0dc..fd4eb1ca036 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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