Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
1569 Представления


I have inherited web.listrenderer and added xpath to add pin icon to all the list views..but pin icon is showing in one2many fields also..how to hide??

Аватар
Отменить
Лучший ответ

Hi Shankar:

Since the One2many field is rendered by a template named 'web.X2ManyField', which includes ListRenderer and KanbanRenderer as its components. Check the file in: addons/web/static/src/views/fields/x2many/x2many_field.xml.


So, there are 2 ways you can seperate the list views between regular list and  o2m list:

1、overwrite the web.ListRenderer in "primary" mode, leaving the original template as it is.

​​In xml file:

        <t t-name="your_module.ListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="primary" owl="1">
        <xpath ...>
            ...
         </xpath>
     </t>

​and then in .js file, you need to replace the ListRenderer's template with the above one:

		​ListRenderer.template = "your_module.ListRenderer";


2、Inherit the web.ListRenderer as you did,  and overwrite the 'web.X2ManyField' including a template reverting the ListRenderer as its component.  

I think this way is more complex and redundant, personally i prefer to the above one.


Аватар
Отменить
Автор

hi..i have tried 1st method..still for o2m list views pin icon is showing..

Hi Shankar:

How you replace the ListRenderer.template value in .js file?
There are 2 ways to inherit js class : extend and patch.
You need to patch the class ListRenderer, which means the js class can work as it did but its attributes and methods might be updated as you patched.

Лучший ответ

Hi,
You can refer into coding added in this app:   https://apps.odoo.com/apps/modules/17.0/list_tree_pin_records

Thanks

Аватар
Отменить
Автор

Above reference is to pin the records..but i have inherited pin in list view headers and i need to hide in one2many fields..

Related Posts Ответы Просмотры Активность
1
июл. 20
4823
0
мар. 15
4765
1
мая 20
8261
2
мая 20
9324
0
июн. 19
7912