Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

I need help converting my code 17 to 18

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
help
1 Rispondi
2858 Visualizzazioni
Avatar
bekoinettien@gmail.com

Good evening Odoo community, I have my code from version 17 that I want to migrate to version 18, but I'm encountering an error that you'll see in point 4.

I remind you that it works fine in version 17, except that instead of using tree in version 17, I changed it to list.



1-MODEL FARMER

class Farmers(models.Model):

    _name = 'res.partner'

    _inherit = 'res.partner'

    _description = 'Planteurs'


    plantation_ids = fields.One2many('plantation.plantation', 'partner_id', 'Plantations')

    farmer = fields.Boolean('Planteur')

    myp_id = fields.Many2one('plantation.myp', string="Mode Reglement", )

    struct_id = fields.Many2one('planting.payroll.structure', string="Structure Salariale",)

    type_id = fields.Many2one('type.farmer', string="Type Planteur",)

    group_id = fields.Many2one('group.group', required=True, string="Groupe Tarification Planteur",)

    birthday = fields.Date(string='Date Immatriculation', required=False)

    number_aprocmac = fields.Char(string='Numero identification aprocmac', required=False)

    code_farmer = fields.Char(string='Code Planteur', required=True, index=True)

    prime_id = fields.Many2one('prime.prime', string="Groupe",required=False)


   


2-MODEL PLANTAPLANTATION 

# Plantations


class Plantation(models.Model):

    _name = 'plantation.plantation'

    _description = 'Plantations'

    _inherit = ['mail.thread', 'mail.activity.mixin']


    name = fields.Char('Identification plantation',required=True)

    number_geo = fields.Char('Numero Géolocalise')

    partner_id = fields.Many2one("res.partner", string="Planteur", required=False,ondelete="cascade", domain=[('farmer', '=', True)])

    frequency_id = fields.Many2one('frequency.payroll', string="Frequence de paie", required=True)

    area = fields.Char(string='Superficie',required=False)

    locality_id = fields.Many2one("locality.locality","Région",required=False)

    sector_id = fields.Many2one("sector.sector","Département",required=False)

    village_id = fields.Many2one("farmer.village","Village",required=False)

    date = fields.Char("Date Immatriculation",required=False)

    code_farmer = fields.Char(string='Code Planteur', required=False)



3-VIEWS FORM FARMER



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

            <field name="name">plantation.res.partner.inherit</field>

            <field name="model">res.partner</field>

            <field name="inherit_id" ref="base.view_partner_form"/>

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

                 <sheet>

                    <group>

                        <field name="farmer" invisible="1" string="Est un Planteur ?"/>

                       <field name="struct_id" required ="farmer == True"/>

            <field name="group_id" required="1"/>

            <field name="type_id" required = "farmer == True" options="{'no_create': True}"/>

                    </group>

                    <group>

                        <field name="myp_id" required = "farmer == True "/>

            <field name="number_aprocmac"/>

                         <field name="code_farmer"/>

<!--                        <field name="prime_id"/>-->

                    </group>

                </sheet>

<notebook position="inside">

                    <page string="Plantations">

                        <field name="plantation_ids">

​ ​ ​<list string="Plantations" editable="bottom">

​                                <field name="name" />

​                                <field name="village_id"  />

​                                <field name="frequency_id" />

​                                <field name="date" />

​                                <field name="area"/>

                            </list>

                        </field>

                    </page>

                </notebook>



            </field>

        </record>





4-ERROR


odoo.tools.convert.ParseError: while parsing file:/d:/odoo18/server/odoo/addons_bekoin/fond_de_tasse/views/partner.xml:14

Erreur lors de la validation de la vue :


                                <field name="currency_id" invisible="1"/>

                                <field name="total_invoiced" widget="monetary" options="{'currency_field': 'currency_id'}"/>

                            </span>

                            <span class="o_stat_text">Invoiced</span>

                        </div>


Le champ "village_id" n'existe pas dans le modèle "res.partner"


View error context:

{'file': 'd:\\odoo18\\server\\odoo\\addons_bekoin\\fond_de_tasse\\views\\partner.xml',

'line': 20,

'name': 'plantation.res.partner.inherit',

'view': ir.ui.view(2158,),

'view.model': 'res.partner',

'view.parent': ir.ui.view(126,),

'xmlid': 'plantation_res_partner_inherit'}



The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    RPC_ERROR

        at makeErrorFromResponse (http://localhost:8069/web/assets/6b047a9/web.assets_web.min.js:3148:163)

        at XMLHttpRequest.<anonymous> (http://localhost:8069/web/assets/6b047a9/web.assets_web.min.js:3153:13)

0
Avatar
Abbandona
Avatar
Sagar
Risposta migliore

You're seeing this error:


Le champ "village_id" n'existe pas dans le modèle "res.partner"


This means that Odoo is trying to validate the field village_id on the res.partner model, even though you meant it to refer to the plantation_ids One2many list, whose target model does include village_id.


Why It Worked in Odoo 17 but Fails in Odoo 18

In Odoo 18, there are stricter XML view validations. Specifically:


When you define <field name="plantation_ids"> and nest a <list>, Odoo expects the nested fields like village_id to exist only in the target model (plantation.plantation).


If Odoo mistakenly thinks the list content belongs to the parent model (res.partner), it will raise an error.


How to Fix It

Ensure your <field name="plantation_ids"> is a proper One2many with a nested list (not tree), and avoid indentation/formatting that may confuse the XML parser.


Update this part of your view like so:


xml

Copy

Edit

<field name="plantation_ids" mode="tree" context="{'default_partner_id': active_id}">

    <tree editable="bottom">

        <field name="name"/>

        <field name="village_id"/>

        <field name="frequency_id"/>

        <field name="date"/>

        <field name="area"/>

    </tree>

</field>

Or, if you want to use <list>, ensure Odoo 18 understands it as a valid container:


xml

Copy

Edit

<field name="plantation_ids">

    <tree string="Plantations" editable="bottom">

        <field name="name"/>

        <field name="village_id"/>

        <field name="frequency_id"/>

        <field name="date"/>

        <field name="area"/>

    </tree>

</field>


Do not use <list> directly — in standard Odoo XML views, use <tree> for list-style sub-record display.


If You Need Help Migrating More Code


I'd be happy to assist further or even help optimize your module for Odoo 18.


You can contact me directly at  – sagar@yalabs in at Yandtradhigham, we specialize in custom Odoo solutions and enterprise migrations.


Let me know if you also want a checklist for Odoo 18 migration, guidance on One2many field usage, or help setting up a developer debug environment for smoother error tracking.

0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
request for information
help
Avatar
Avatar
1
set 25
686
Hello everyone, I need your help; I want to make a custom header to print my pdf reports.
help
Avatar
Avatar
Avatar
Avatar
Avatar
4
giu 25
3031
Give a discount to a product for every customer and show it in the website pricetag?
help
Avatar
0
feb 25
1379
Hello everyone, I have just installed odoo17 community but I want to switch to the enterprise version for which I already have the license key.
help
Avatar
Avatar
1
nov 24
2598
Hello dear odoo community, I would like to ask if there is a possibility of storage capacity in my locations in the inventory module to know if a location is full we cannot add products. Thank you, Best regards
help
Avatar
Avatar
1
nov 24
1452
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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