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)