Community: Framework mailing list archives

expert-framework@mail.odoo.com

RE: fields_view_get issue

by
Christian
- 09/14/2016 03:05:49

Hi Jean-Paul,

   Indeed I tried to get the super first and then replace the arch, but then the view wasn’t working. So I tried creating a new view and call the correct view depending on the context.

See the code below.

 

 

From the menu, first a tree view is called, then the form view. The error appear on the tree view.

 

 

    @api.model

    def fields_view_get(self, view_id=None, view_type=None, context=None, toolbar=False, submenu=False):

         

        context = self._context.get('show')

        

        print('Il context')

        print(context)

        print(view_type)

        print(view_id)

   

        if context == 2 and view_type == 'form':

            print('Order form')

            view_id = 593

            res = super(SaleOrder, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=False)

        elif context == 1 and view_type == 'form':

            print('Offerta Form')

            view_id = 511              

            res = super(SaleOrder, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=False)

        elif context == 1 and view_type == 'tree':   

            print('Offerta Tree')

            res = super(SaleOrder, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=False)       

        elif context == 2 and view_type == 'tree':   

            print('Order Tree')

            res = super(SaleOrder, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=False)

 

 

thanks

Kind Regards / Met vriendelijke groet,

Christian Valsecchi
Mobile +31 627565200

 

From: Jean-Paul Robineau [mailto:jprobineau@yahoo.com]
Sent: Wednesday, September 14, 2016 7:43 AM
To: Community: Framework <expert-framework@mail.odoo.com>
Subject: Re: fields_view_get issue

 

Dear Christian,

 

Its a bit difficult to say what is wrong without seeing your code. But i pressume you didn't called a super first. For Fields view get you better call the super first, and then you adapt the res['arch'] and return the res.

 

If this didn't work can you please send a bit of the code so we can see what happend?

 

Kind regards, Met vriendelijke groeten

 

Jean-Paul Robineau

Lead Developer

Apertoso NV

Deinze, Belgium

 

On Tuesday, September 13, 2016 5:32 PM, Christian Valsecchi <christian.valsecchi@outlook.com> wrote:



Hi there,

    I’m trying the fields_view_get override to use different views depending on different context.

 

I keep having this error: Uncaught TypeError: Cannot read property 'arch' of undefined.

Does someone have some ideas on how to fix it? I’m quite lost.

 

Thanks

 

Kind Regards / Met vriendelijke groet,

Christian Valsecchi
IT Manager & Consultant - Technology

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe