Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

To dispaly all records in tree view of one2many relation without specifying “foreign key field”

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
xmlodooone2many_list
4 Odpowiedzi
16384 Widoki
Awatar
Silviaa

Im creating a new model not stored in Database .Field "pricelist_item_id" in one2manyrelation without inverse_name.

 class Product_Price_Search(models.Model):
    _name = 'product.price.search'  

  _auto = False
    upgrade_price = fields.Integer('Upgrade Price')  

  pricelist_item_id = fields.One2many(          'product.pricelist.item',          string="Product PriceList Items"    )


    <record model="ir.ui.view" id="view_product_price_search_form">    

        <field name="name">product.price.search.form.view</field>         

       <field name="model">product.price.search</field>       

        <field name="arch" type="xml">      

        <form string="PriceList Items Form">             

       <sheet><group col="2">  

        <field name="upgrade_price" />                

                                 </group>                   

                             <!-- PriceList Items Tree View -->         

                         <group string="Form">             

                        <div>     <p>      List PriceList Items      </p>                 

                       </div>     </group>              

           <field name="pricelist_item_id">  

           <tree string='Tables'>    

          <field name="name" />    

        <field name="product_id" />   

          </tree>              

         </field>    

        </sheet>            

        </form>      

      </field>    

    </record>


In my "pricelist_item_id" fields in tree .
I want to display all the records which is available in that table .
Isit possible in Odoo ?



1
Awatar
Odrzuć
Anil Kesariya

What is the reason for not adding foreign key? If you want use one2many you must need to define reference/ID inside the comodel. without that not possible.

Anil Kesariya

If you don't want any reference field than go for the Text field make it as compute/functional field and fetch the data of all the records and display in your text box in appropriate format. this could be done without any foreign key.

Awatar
Muhammed Nishad
Najlepsza odpowiedź

Dear Silviaa,

          According my knowledge , One2many is a virtual field.Since it is It must have a Many2one model behind.So that it,s data can be linked to the current record on the self.

for eg:

class Target(models.Model):
_name = 'projection.target'
_rec_name = 'sales_man'
_sql_constraints = [('sales_man', 'UNIQUE(sales_man)', 'The employee has already assigned to a target'), ]
sales_man = fields.Many2one('res.users', string="Select Employee", required=True)
working_days = fields.Integer(compute="computewkng")
target = fields.Char(string='Total Projection', readonly=True, compute='totalprojection')
sal = fields.Float(string='Achievement', compute="calculatetotalsales", readonly=True)
average = fields.Float(String='Average', compute='computeavg')
variance = fields.Float(string='Variance', compute='computevariance')
data = fields.One2many('projection.onetomanydata', 'inv', ondelete='cascade')
 #this model has a One2many field that is linked with the Many2one on another module
class OneToManyData(models.Model):
_name = 'projection.onetomanydata'
_rec_name = 'name'
_sql_constraints = [('date', 'UNIQUE(date)', 'Employee Has Already Assigned to a Target on This date'), ]
name = fields.Char(default='Daily Projection', invisible=True)
date = fields.Date(string="Date", required=True)
target = fields.Integer(string="Daily Projection", required=True)
inv = fields.Many2one('projection.target')
#here the inv links this model to the first one
#its just a matter of 2 lines of code.
3
Awatar
Odrzuć
Awatar
Pratik Bhandirge
Najlepsza odpowiedź

one2many field attributes, comodel_name, and inverse_name (i.e. foreign key) are mandatory except in the case of related fields or field extensions.


In your case, you can display all records in wizard on button click...
1
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Problemas al imprimir factura en el odoo
xml odoo
Awatar
0
sty 25
2077
How to post xml code
xml odoo
Awatar
1
mar 25
652
How can I include my generic qweb view on my Odoo 16 Form View using JS or Controller
xml odoo
Awatar
Awatar
1
wrz 23
3704
Favorite filter Odoo 10 Rozwiązane
xml odoo
Awatar
Awatar
2
sie 22
8504
[Odoo 8]How to use ref on domain xml Rozwiązane
xml odoo
Awatar
Awatar
Awatar
Awatar
Awatar
8
cze 20
23206
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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