Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
7013 Weergaven

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? 

Avatar
Annuleer
Beste antwoord

Use

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

Avatar
Annuleer
Auteur

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

Beste antwoord


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>
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
7
feb. 19
13260
4
okt. 17
9980
5
jun. 20
6319
2
dec. 19
2365
0
nov. 18
2973