Skip to Content
Menu
This question has been flagged
6 Replies
3383 Views

I need more space for my timesheets in the project.task module in the task form view. So I need this view without the "<sheet></sheet>" tags.

I know I could inherit the view and replace the sheet with the all the code from the inherited view without the sheet tags.

But the problem is I've extended the original project.task form view with 2 or 3 different custom modules.

So is there a way that I could just remove the tags without hiding the content between the tags? And not with debug mode and editting the form view. 

Avatar
Discard
Author

Never done anything like that. Can this be done with a custom module and not rewriting the original code. Won't there be problem with duplicated ids? Is there any working example?

Best Answer

Hello, This will help you.


   @ api.model
   def fields_view_get (self, view_id = None, view_type = 'form', toolbar = False,                                                           submenu=False):
            res = super (SaleOrder, self) .fields_view_get (view_id = view_id, view_type = view_type,             toolbar =   toolbar,submenu=submenu)

            if view_type == 'form' and 'arch' in res:
               xml_arch_data = res ['arch']
               xml_arch_data = xml_arch_data.replace ("", '')
               final_xml_data = xml_arch_data.replace ("< / sheet> ", '')
               res ['arch'] = final_xml_data
       return res



Avatar
Discard

This... removes the commas in the arch node? Twice? WHAT!?

This is perfect code. due to some issue some code is getting removed from answer section. so updating proper answer here.

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,submenu=False):
res = super(SaleOrder, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu)

if view_type == 'form' and 'arch' in res:
xml_arch_data = res['arch']
xml_arch_data = xml_arch_data.replace("<sheet>", '')
final_xml_data = xml_arch_data.replace("</sheet>", '')
res['arch'] = final_xml_data
return res

Thanks.

Best Answer

Without removing the tags, you can expand the sheet width to the maximum with this small module:

https://www.odoo.com/apps/modules/11.0/web_sheet_full_width/

If you're using v12.0, this module has been integrated in this other module:

https://www.odoo.com/apps/modules/12.0/web_responsive/

Avatar
Discard
Best Answer

Hello

Yes you can remove using fields_view_get method

Avatar
Discard
Author

an example would be nice

Related Posts Replies Views Activity
0
Nov 19
2506
3
Feb 19
6173
1
Aug 18
3163
0
Feb 18
3525
2
Nov 17
8186