Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

I need help converting my code 17 to 18

Odoberať

Get notified when there's activity on this post

This question has been flagged
help
1 Odpoveď
2883 Zobrazenia
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
Zrušiť
Avatar
Sagar
Best Answer

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
Zrušiť
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
[UA GuíA pArA ApOyo^@]¿Cómo hablo con alguien de United? #UAA TELEFONO
help
Avatar
0
nov 25
3
request for information
help
Avatar
Avatar
1
sep 25
690
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
jún 25
3041
Give a discount to a product for every customer and show it in the website pricetag?
help
Avatar
0
feb 25
1385
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
2602
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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