Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
xmlodooone2many_list
4 Antwoorden
16392 Weergaven
Avatar
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
Avatar
Annuleer
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.

Avatar
Muhammed Nishad
Beste antwoord

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
Avatar
Annuleer
Avatar
Pratik Bhandirge
Beste antwoord

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
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Problemas al imprimir factura en el odoo
xml odoo
Avatar
0
jan. 25
2086
How to post xml code
xml odoo
Avatar
1
mrt. 25
652
How can I include my generic qweb view on my Odoo 16 Form View using JS or Controller
xml odoo
Avatar
Avatar
1
sep. 23
3711
Favorite filter Odoo 10 Opgelost
xml odoo
Avatar
Avatar
2
aug. 22
8511
[Odoo 8]How to use ref on domain xml Opgelost
xml odoo
Avatar
Avatar
Avatar
Avatar
Avatar
8
jun. 20
23223
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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