Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
#python#xml#odoo#OdooV8
1 Răspunde
5893 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Zbik
Cel mai bun răspuns

Try this:

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

0
Imagine profil
Abandonează
Mihael Peric
Autor

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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Long word wrap in rml file, openerp v7.0 Rezolvat
#python #programming #xml #odoo
Imagine profil
Imagine profil
1
dec. 22
5383
Odoo Inherit new page tab Rezolvat
#python #odoo
Imagine profil
Imagine profil
Imagine profil
Imagine profil
5
mar. 20
13616
Failed module extension
#python #xml #odoo #module #fields
Imagine profil
Imagine profil
1
iun. 19
5312
Add tree and some fields Rezolvat
#python #odoo
Imagine profil
Imagine profil
3
ian. 18
3853
Inherit view problem Rezolvat
#odoo #OdooV8
Imagine profil
Imagine profil
Imagine profil
5
feb. 17
6862
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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