تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
6 الردود
4454 أدوات العرض

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. 

الصورة الرمزية
إهمال
الكاتب

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?

أفضل إجابة

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



الصورة الرمزية
إهمال

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.

أفضل إجابة

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/

الصورة الرمزية
إهمال
أفضل إجابة

Hello

Yes you can remove using fields_view_get method

الصورة الرمزية
إهمال
الكاتب

an example would be nice

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
نوفمبر 19
3630
3
فبراير 19
7034
1
أغسطس 18
3997
0
فبراير 18
4464
2
نوفمبر 17
9158