Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Odoo v8.0 won't show me select list into form (one2many field)

Naroči se

Get notified when there's activity on this post

This question has been flagged
#python#xml#odoo#OdooV8
1 Odgovori
5909 Prikazi
Avatar
Mihael Peric

I made 2 models and try to make relationships between them but hr table work fine and my student table won't show.

This how form looks:

https://ibb.co/dP4GmJ

This how hr shows:

https://ibb.co/fZ7afd

This how students shows (this is problem), no select student table?

https://ibb.co/cVFYYy

When i change relationship student_ids to many2many everything works well but i wanna one2many.

This is my code:

Also i am set 'depends': ['base', 'hr', 'students',], in study_room __openerp__.py

#student model
from openerp import models, fields, api

class students(models.Model):
_name = 'students.students'


name = fields.Char(string='First Name', required=True)
last_name = fields.Char(string='Last Name', required=True)
email = fields.Char(string='Email', required=True)
phone = fields.Char(string='Phone')

gender = fields.Selection([('m', 'Male'), ('f', 'Female')], string='Gender', default='m')
is_active = fields.Boolean(string='Active', default=True)
birth_date = fields.Date(string='Birth Date', default=fields.Date.today())

room_id = fields.Many2one(comodel_name="study.room", string="Study Room", )

_sql_constraints = [
('unique_email', 'unique(email)', 'User with that email already exist!')
]

#study room model
class study_room(models.Model):
_name = 'study.room'

@api.one
@api.depends('student_ids')
def _get_no_of_students(self):
self.no_of_students = len(self.student_ids)

name = fields.Char(string="Name")
teacher_ids = fields.Many2many(string="Teachers", comodel_name="hr.employee", relation="room_teacher_rel",
column1="room_id", column2="teacher_id")
student_ids = fields.One2many(string="Students", comodel_name="students.students", inverse_name="room_id")
no_of_students = fields.Integer(string="No. of Students", compute="_get_no_of_students")

#student view
<openerp>
<data>
<record id="student_form_view" model="ir.ui.view">
<field name="name">Student Form View</field>
<field name="model">students.students</field>
<field name="arch" type="xml">
<form string="Students">
<sheet>
<group>
<field name="name"/>
<field name="last_name"/>
<field name="email"/>
<field name="phone"/>
<field name="gender"/>
<field name="is_active"/>
<field name="birth_date"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="student_tree_view" model="ir.ui.view">
<field name="name">Student Tree View</field>
<field name="model">students.students</field>
<field name="arch" type="xml">
<tree string="Students">
<field name="name"/>
<field name="last_name"/>
<field name="birth_date"/>
</tree>
</field>
</record>
<record id="students_students_action" model="ir.actions.act_window">
<field name="name">Students</field>
<field name="res_model">students.students</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="School Management" id="school_man_menu" sequence="85"/>
<menuitem name="Students" id="school_students_menu" sequence="10" parent="school_man_menu"/>
<menuitem name="Student Info" id="schools_info" sequence="10" parent="school_students_menu" action="students_students_action"/>
</data>
</openerp>

#study room view

<openerp>
<data>
<menuitem name="Study Room" parent="students.school_man_menu" id="study_room_categ"/>
<record id="study_room_form" model="ir.ui.view">
<field name="name">Study Room Form</field>
<field name="model">study.room</field>
<field name="arch" type="xml">
<form string="Study Room">
<sheet>
<group>
<field name="name"/>
<field name="no_of_students"/>
</group>
<notebook>
<page string="Students">
<field name="student_ids"/>
</page>
<page string="Teachers">
<field name="teacher_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="study_room_tree" model="ir.ui.view">
<field name="name">Study Room Tree View</field>
<field name="model">study.room</field>
<field name="arch" type="xml">
<tree string="Study Room">
<field name="name"/>
<field name="no_of_students"/>
</tree>
</field>
</record>
<record id="study_room_action" model="ir.actions.act_window">
<field name="name">Study Room</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">study.room</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click Here to create study rooms
</p>
</field>
</record>
<menuitem name="Study Room" parent="study_room_categ" id="study_room_act" action="study_room_action"/>
</data>
</openerp>

0
Avatar
Opusti
Avatar
Zbik
Best Answer

Try this:

<field name="student_ids" widget="many2many"/>

0
Avatar
Opusti
Mihael Peric
Avtor

It works, thanks a lot!

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Long word wrap in rml file, openerp v7.0 Solved
#python #programming #xml #odoo
Avatar
Avatar
1
dec. 22
5396
Odoo Inherit new page tab Solved
#python #odoo
Avatar
Avatar
Avatar
Avatar
5
mar. 20
13633
Failed module extension
#python #xml #odoo #module #fields
Avatar
Avatar
1
jun. 19
5322
Add tree and some fields Solved
#python #odoo
Avatar
Avatar
3
jan. 18
3859
Inherit view problem Solved
#odoo #OdooV8
Avatar
Avatar
Avatar
5
feb. 17
6871
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now