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

I've added many fields on pos.session with a custom module, and I would like to create a second view.

   <record id="pos_session_tree_adm2" model="ir.ui.view">
<field name="name">pos.divina.custom.tree.view.adm2</field>
<field name="model">pos.session</field>
<field name="arch" type="xml">
<tree string="Sessions" create="0">
<field name="start_at" />
<field name="name" />
<field name="day_sold" />
<field name="day_costs" />
<field name="day_margin" />
<field name="state" />
</tree>
</field>
</record>

<record id = "pos_session_tree_adm2" model = "ir.actions.act_window">
<field name = "name">Sessions</field>
<field name = "type">ir.actions.act_window</field>
<field name = "res_model">pos.session</field>
<field name = "view_type">form</field>
<field name = "view_mode">tree,form</field>
<field name = "view_id" eval= "False"/>
</record>

Problem is the original pos.session tree will be substituted and Odoo will use mine instead (on both places on menu). Then is pretty obvious I'm doing something wrong here.
Since is the first time I need to create a duplicated view I'm a bit confused, what is the best way to archive what I want? 

아바타
취소
베스트 답변

Use

<field name"mode">primary</field>

아바타
취소
작성자

Thanks, but even if the reply is substantially correct and solve completely my issue, you should explain a little mode how primary mode works.

Think if someone less skilled than me will fall in the very sames issue, wouldn't be great to know how your solution works?

True, that's very kind of you.

However, there needs to be some effort from the "someone's" side to to solve their issue. We aren't here to do their homework.

"give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime"

@Taher Giyori that's the dumbest thing I've read in a long time

"you give a poor man a fish and you feed him for a day; you teach him to fish... you give him.. you give him.... uhh no no no"

- South Africa news reporter

베스트 답변


Still valid in Odoo 13

You need to use your first view_id in your inherit_id field and use primary mode to duplicate the view rather than override the previous view. Hope this helps anyone looking for more details on how primary mode works.
<record id="NEW VIEW ID" model="ir.ui.view">
<field name="name">NEW VIEW NAME</field>
<field name="model">pos.session</field> <field name="inherit_id" ref="pos_session_tree_adm2"/>       <field name="mode">primary</field>
       <field name="arch" type="xml">
        ...Your modifications
       </field>
</record>
아바타
취소
관련 게시물 답글 화면 활동
7
2월 19
12978
4
10월 17
9780
5
6월 20
5975
2
12월 19
2112
0
11월 18
2699