콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2583 화면

Hi, I need to show one or other tree view by menuitem to the same model (product.template), when I use the XML below it shows all columns (model, origin) using menuitem1 or menuitem2 and I want to show a tree with colum 'model' by menuitem1 and by menuitem2 columm 'origin'.


record id="extra_tree1" model="ir.ui.view">
field
name="name">product.extra.tree
field
name="model">product.template
field
name="inherit_id" ref="product.product_template_tree_view"/>
field
name="arch" type="xml">
tree>
field
name="model"/>
/tree>
/field>
/record>

record
id="extra_tree2" model="ir.ui.view">
field
name="name">product.extra.tree
field
name="model">product.template
field
name="inherit_id" ref="product.product_template_tree_view"/>
field
name="arch" type="xml">
tree>
field
name="origin"/>
/tree>
/field>
/record>

record
id="action1" model="ir.actions.act_window">
field
name="name">Test action 1
field
name="type">ir.actions.act_window
field
name="res_model">product.template
field
name="view_type">form
field
name="view_mode">form,tree
field
name="view_ids" eval="[
(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('inventory_extras.extra_tree1')})]"
/>
field
name="context">{}
/record>

record
id="action2" model="ir.actions.act_window">
field
name="name">Test action 2
field
name="type">ir.actions.act_window
field
name="res_model">product.template
field
name="view_type">tree
field
name="view_mode">form,tree
field
name="view_ids" eval="[
(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('inventory_extras.extra_tree2')})]"
/>
field
name="context">{}/field>
/record>

menuitem
id="test_model_menu_action1" action="action1"/>

menuitem
id="test_model_menu_action2" action="action2"/>

아바타
취소
베스트 답변

Please try below code with context. you can have separate view by managing context.


id="extra_tree1" model="ir.ui.view">
name="name">product.extra.tree
name="model">product.template
name="inherit_id" ref="product.product_template_tree_view"/>
name="arch" type="xml">

name="model" invisible="context.get('model')"/>
name="origin" invisible="context.get('origin')"/>


id="action1" model="ir.actions.act_window">
name="name">Test action 1
name="type">ir.actions.act_window
name="res_model">product.template
name="view_mode">tree
name="context">{"model":True}

id="action2" model="ir.actions.act_window">
name="name">Test action 2
name="type">ir.actions.act_window
name="res_model">product.template
name="view_mode">tree
name="context">{"origin":True}


id="test_model_menu_action1" action="action1" parent="stock.menu_stock_root"/>
id="test_model_menu_action2" action="action2" parent="stock.menu_stock_root"/>



아바타
취소
관련 게시물 답글 화면 활동
1
7월 22
2451
3
5월 23
2330
1
4월 23
3893
2
5월 25
31457
1
9월 18
10969