Ir al contenido
Menú
Se marcó esta pregunta
6 Respuestas
4453 Vistas

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
Descartar
Autor

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?

Mejor respuesta

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
Descartar

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.

Mejor respuesta

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
Descartar
Mejor respuesta

Hello

Yes you can remove using fields_view_get method

Avatar
Descartar
Autor

an example would be nice

Publicaciones relacionadas Respuestas Vistas Actividad
0
nov 19
3617
3
feb 19
7031
1
ago 18
3996
0
feb 18
4462
2
nov 17
9151