Skip to Content
Menu
This question has been flagged
2 Replies
1927 Views

Hi everyone,


Here is my error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 744, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 572, in _tag_record
    model = self.env[rec_model]
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 760, in __getitem__
    return self.registry[model_name]._browse((), self)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 181, in __getitem__
    return self.models[model_name]
KeyError: 'abc.course'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 650, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\pycompat.py", line 87, in reraise
    raise value
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 692, in dispatch
    result = self._call_function(**self.params)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\service\model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 936, in __call__
    return self.method(*args, **kw)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\web\controllers\main.py", line 935, in call_button
    action = self._call_kw(model, method, args, {})
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\web\controllers\main.py", line 923, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-46>", line 2, in button_immediate_upgrade
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\module\module.py", line 71, in check_and_log
    return method(self, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\module\module.py", line 602, in button_immediate_upgrade
    return self._button_immediate_function(type(self).button_upgrade)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\addons\base\module\module.py", line 541, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 339, in load_modules
    force, status, report, loaded_modules, update_module)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 242, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 159, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='demo')
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\loading.py", line 94, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 791, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 852, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 751, in parse
    exc_info[2]
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 744, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\convert.py", line 572, in _tag_record
    model = self.env[rec_model]
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 760, in __getitem__
    return self.registry[model_name]._browse((), self)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\modules\registry.py", line 181, in __getitem__
    return self.models[model_name]
odoo.tools.convert.ParseError: "abc.course" while parsing file:/c:/program files (x86)/odoo 11.0/server/odoo/addons/openacademy/demo.xml:3, near
<record id="course0" model="abc.course">
            <field name="name">Course 0</field>
            <field name="description">Course 0's description

Can have multiple lines
            </field>
        </record>

Here is my code in openacademy:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
        <data>
                <record model="ir.actions.act_window" id="openacademy_course_action">
                    <field name="name">Course</field>
                    <field name="res_model">openacademy.course</field>
                    <field name="view_type">form</field>
                    <field name="view_mode">tree,form</field>
                    <field name="help" type="html">
                        <p class="oe_view_nocontent_create">
                            Create course details
                       
</p>
                    </field>
                </record>

                <menuitem action="openacademy_course_action" id="course_menu" name="Course" parent="base.menu_base_config"/>

                <record model="ir.ui.view" id="course_form_view">
                    <field name="name">some course</field>
                    <field name="model">openacademy.course</field>
                    <field name="arch" type="xml">
                        <form string="cource Form">
                            <sheet>
                                <group>
                                    <field name="name"/>
                                    <field name="description"/>
                                </group>
                            </sheet>
                        </form>
                    </field>
                </record>
        </data>
</odoo>

And here is my code, models:

  And here is my code, Models:

from odoo import models, fields, api


class Course(models.Model):
    _name = 'openacademy.course'

   
name = fields.Char(string="Title", required=True)
    description = fields.Text()

Someone knows what could be the error?

Avatar
Discard
Author Best Answer

 

Avatar
Discard
Best Answer

This happens because there is no model abc.cource in the model. I think you planned to display the field in the view.

Here is an example of doing so... In the xml file

<data>

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

            <field name="name">Cource</field>

            <field name="res_model">abc.cource</field>

            <field name="view_type">form</field>

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

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

                <p class="oe_view_nocontent_create">

                    Create cource details

                </p>

            </field>

        </record>


        <menuitem action="abc_cource_action" id="cource_menu" name="Cource" parent="base.menu_base_config"/>


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

            <field name="name">some cource</field>

            <field name="model">abc.cource</field>

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

                <form string="cource Form">

                    <sheet>

                        <group>

                            <field name="name"/>

                            <field name="description"/>

                            </group>

                           </sheet>

                </form>

            </field>

        </record>

Install your module and you will be able to see the form view. In the form view you can enter your data and save to create a new record.

Avatar
Discard