← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 669920] Re: [6.0RC1][WISH] Allow to select a view depend of record selected

 

LOL, you sure you know how your program work ???

Let me teach you

I create a view,tree and search view, for each category of partner i
need to customize

create a ir.actions.act_window for tree and one for form view, two
action use the search view define for this category

create 2 ir.actions.act_window.view for form, one  to say which action
use if we push form button and to say which action use if we push tree


So ANYWHERE i go, i always have the good view

short :  
Create  
            Form,tree,search

Create  ir.actions.act_window
            one for open the tree one for open then form, 
attach domain of each action

Create  ir.actions.act_window.view
            2 for form :  one to specify the form to use, open to specify the tree to use
            2 for tree :  one to specify the form to use, open to specify the tree to use

Now when i open a form or a tree OpenErp always use the good form

-- 
[6.0RC1][WISH] Allow to select a view depend of record selected
https://bugs.launchpad.net/bugs/669920
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Web Client: Triaged

Bug description:
Hi 

    I need to show different view based on the category of partner, i can do it with my menu link, but if i go in sale order and click on the partner link, view selected by priority.

    The active_id not pass in context to function fields_view_get, so ... if i want select view i need the active_id record.


my pacth to do it 

client-web/addons/openerp/widgets/screen.py

    def add_view_id(self, view_id, view_type):
        self.view_id = view_id

        if view_type in self.views_preloaded:
            view = self.views_preloaded[view_type]
        else:
            ctx = rpc.session.context.copy()
            ctx.update(self.context)
+          ctx['active_id'] = self.id and self.id or False
+          ctx['active_ids'] = self.ids and self.ids or False
            if ctx.get('view_id'):
                view_id = ctx['view_id']
            view = cache.fields_view_get(self.model, view_id, view_type, ctx, self.hastoolbar, self.hassubmenu)

        self.add_view(view, view_type)


So now in my addons module in server, i can override the function fields_view_get in res.partner to select view based on the category of the partner.

I hope you can add this in next version.





Follow ups

References