İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
119 Görünümler

Hi all,

I am trying to upgrade a module on odoo18. But I am getting the following error:


RPC_ERROR


Odoo Server Error


Occured on localhost:8996 on model ir.module.module on 2025-10-03 13:44:48 GMT


Traceback (most recent call last):

  File "C:\Program Files\Odoo 18.0.20250814\server\odoo\convert.py", line 555, in _tag_root

    raise ParseError(msg) from None  # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

odoo.tools.convert.ParseError: while parsing file:/c:/program%20files/odoo%2018.0.20250814/custom/hms_africa/views/cases_views.xml:19

Error while validating view near:


                                    <field name="disb_date"/>

                                    <field name="service"/>

                                    <field name="total"/>

                                </list>

                            </field>


Field "mode_of_brief" does not exist in model "case.notes"


View error context:

{'file': 'c:\\program files\\odoo '

         '18.0.20250814\\custom\\hms_africa\\views\\cases_views.xml',

'line': 40,

'name': 'hms.cases.form',

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

'view.model': 'hms.cases',

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

'xmlid': 'view_hms_cases_form'}



The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    RPCError@http://localhost:8996/web/assets/e9f7204/web.assets_web.min.js:3145:338

    makeErrorFromResponse@http://localhost:8996/web/assets/e9f7204/web.assets_web.min.js:3148:163

    rpc._rpc/promise</<@http://localhost:8996/web/assets/e9f7204/web.assets_web.min.js:3153:34

   

Here is are my models


class HmsCase(models.Model):

    _name = 'hms.cases'

    _inherit = ['mail.thread']

    _description = 'HMS Cases Master'

    _rec_name = 'case_name'

    case_name = fields.Char(string="Case Name", tracking=True)

case_note_ids = fields.One2many('case.notes', 'note_id', string="Notes")



class CaseNotes(models.Model):

    _name = 'case.notes'

    _description = 'Case Notes'


    note_id = fields.Many2one('hms.cases', string='Case', required=True)

    note_date = fields.Datetime(string='Date', default=fields.Datetime.now())

    note = fields.Text(string="Note")

    mode_of_brief = fields.Selection([('email', 'EMAIL'),

                                      ('letter', 'OFFICIAL LETTER'),

                                      ('post', 'REGISTERED POST'),

                                      ('other', 'OTHER')],

                                     string="Mode of Brief")





Here is my view:


<?xml version="1.0" encoding="utf-8"?>

<odoo>


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

        <field name="name">hms.cases.list</field>

        <field name="model">hms.cases</field>

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

            <list string="Cases">

                <field name="case_name"/>

            </list>

        </field>

    </record>


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

        <field name="name">hms.cases.form</field>

        <field name="model">hms.cases</field>

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

            <form string="Cases">

                <sheet>

                    <group>

                        <field name="case_name" readonly="status != 'auth_one' and status != 'draft'"/>

                    </group>

                    <field name="case_note_ids" string="Case Notes" mode="list,form">

                        <list default_order="note_date desc" delete="false">

                            <field name="note_date" readonly="1" noupdate="1"/>

                            <field name="note"/>

                        </list>

                        <form string="Case Notes">

                            <group>

                                <field name="note_date" readonly="1" noupdate="1"/>

                                <field name="note"/>

                                <field name="mode_of_brief"/>

                            </group>

                        </form>

                    </field>

                </sheet>

                <chatter/>

            </form>

        </field>

    </record>


    <record id="action_hms_cases" model="ir.actions.act_window">

        <field name="name">Cases</field>

        <field name="res_model">hms.cases</field>

        <field name="view_ids" eval="[Command.clear(),

            (0, 0, {'view_mode': 'list', 'view_id': ref('view_hms_cases_list')}),

            (0, 0, {'view_mode': 'form', 'view_id': ref('view_hms_cases_form')})]"/>

        <field name="view_mode">list,form</field>

        <field name="help" type="html">

            <p class="o_view_nocontent_smiling_face">

                Create a new case

            </p>

        </field>

    </record>


</odoo>


In addition, when i try to do this on Odoo17, it works without any issues. Any assistance will be greatly appreciated. Thanks 

Avatar
Vazgeç
En İyi Yanıt

Hi,


The error you are encountering in Odoo 18 occurs because the field mode_of_brief does not exist in the database for the case.notes model, even though it is defined in your code. This typically happens when a module is upgraded or migrated, and the database schema has not been updated to reflect new fields.


To resolve this, you need to explicitly update the module. You can do this by stopping the Odoo server and running the command:


odoo-bin -d your_database_name -u hms_africa --stop-after-init



This forces Odoo to apply all changes in the module, including creating the missing field in the database.


It is also important to ensure that the module is installed correctly, that there are no typos in the model or field definitions, and that Odoo caches are cleared by restarting the server. After updating, you can verify that the field exists in the database by checking the table columns for case_notes.


In summary, the issue is not with your code but with the database schema. Updating the module properly will ensure that the mode_of_brief field exists, and your form view will function without errors in Odoo 18.


Hope it helps

Avatar
Vazgeç