Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

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

Odebírat

Get notified when there's activity on this post

This question has been flagged
#python#xml#odoo#OdooV8
1 Odpovědět
5861 Zobrazení
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
Zrušit
Avatar
Zbik
Nejlepší odpověď

Try this:

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

0
Avatar
Zrušit
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!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Long word wrap in rml file, openerp v7.0 Vyřešeno
#python #programming #xml #odoo
Avatar
Avatar
1
pro 22
5344
Odoo Inherit new page tab Vyřešeno
#python #odoo
Avatar
Avatar
Avatar
Avatar
5
bře 20
13561
Failed module extension
#python #xml #odoo #module #fields
Avatar
Avatar
1
čvn 19
5281
Add tree and some fields Vyřešeno
#python #odoo
Avatar
Avatar
3
led 18
3811
Inherit view problem Vyřešeno
#odoo #OdooV8
Avatar
Avatar
Avatar
5
úno 17
6836
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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