foreign keys - view details in tree view from original model (Many2one) - Odoo 9 -


i have simple database has 3 models follows

1- camps (to store camps master data)

2- players (to store players master data)

3- players_camps (to store camps each player has attended)

the code models follows:

class camps(model):      _name = 'camps'      name = char('name')      organizer = char()       date_from = date('from date')      date_to = date('to date')           place = char()       supervisor = char()       notes = text()  class players(model):      _name = 'player'      name = char()      camps = one2many('player_camps', 'player')  class player_camps(model):      _name = 'player_camps'      camps = many2one('camps', on_delete='cascade', on_update='cascade')      organizer = many2one('camps', on_delete='cascade', on_update='cascade')       place = many2one('camps', on_delete='cascade', on_update='cascade')      date_from = many2one('camps', on_delete='cascade', on_update='cascade')      date_to = many2one('camps', on_delete='cascade', on_update='cascade')      result = integer(default=0) 

when display players camps (using one2many widget in view ) can see camp name other data organizer or place (which stored in master model of camps) not shown how can show data in tree view of players camps view ?

edit: here view file players

note: have removed fields players view , model make code shorter

<openerp>     <data>         <!--form view -->         <record id="player_form_view" model="ir.ui.view">             <field name="model">player</field>             <field name="arch" type="xml">                 <form>                     <notebook>                         <page name="basic_data" string="basic data">                             <group>                                 <field name="name"/>                              </group>                         </page> <page name="camps" string="camps">                             <field name="camps">                                 <tree>                                     <field name="camp"/>                                     <field name="instructor"/>                                     <field name="organizer"/>                                     <field name="place"/>                                     <field name="date_from"/>                                     <field name="date_to"/>                                     <field name="result"/>                                     <field name="notes"/>                                 </tree>                             </field>                         </page>    </notebook>                 </form>             </field>         </record> </data> </openerp> 

please remove widget one2many list , in <tree> tag declared field many want show.

try following code:

<openerp>     <data>         <!--form view -->         <record id="player_form_view" model="ir.ui.view">             <field name="name">player.form.view</field>             <field name="model">spogaze.player</field>             <field name="arch" type="xml">                 <form>                     <notebook>                         <page name="basic_data" string="basic data">                             <group>                                 <field name="name"/>                              </group>                         </page>                         <page name="exams" string="exams">                             <field name="exams">                                 <tree string="exam" editable="bottom">                                     <field name="camp"/>                                     <field name="instructor"/>                                     <field name="organizer"/>                                     <field name="place"/>                                     <field name="date_from"/>                                     <field name="date_to"/>                                     <field name="result"/>                                     <field name="notes"/>                                 </tree>                             </field>                         </page>                     </notebook>                 </form>             </field>         </record>     </data> </openerp> 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -