diff --git a/addons/account/invoice.py b/addons/account/invoice.py index a5df2a6f1a0..261ec4c3c0d 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -326,6 +326,19 @@ class account_invoice(osv.osv): 'user_id': lambda s, cr, u, c: u, } + def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): + if context.get('active_model','') in ['res.partner']: + partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] + if not view_type: + view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] + view_type = 'tree' + if view_type == 'form': + if partner['supplier'] and not partner['customer']: + view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] + else: + view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] + return super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) + def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) diff --git a/addons/base_module_record/base_module_record_wizard.xml b/addons/base_module_record/base_module_record_wizard.xml index b0a7d84a89c..da56814a29f 100644 --- a/addons/base_module_record/base_module_record_wizard.xml +++ b/addons/base_module_record/base_module_record_wizard.xml @@ -5,7 +5,8 @@ + id="menu_wizard_base_mod_rec" + groups="base.group_extended"/> + parent="base.menu_custom" + groups="base.group_extended"/>