Skip to Content
Menu
This question has been flagged
3 Replies
2032 Views

Hello

I use odoo 12, I just created my first module it contains some models. when i click on install it gives me this error message

Please help me

Erreur:

Odoo Server Error


Traceback (most recent call last):

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 1126, in _validate_fields

    check(self)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 351, in _check_xml

    self.postprocess_and_fields(view.model, view_doc, view.id)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 1098, in postprocess_and_fields

    self.raise_view_error(_('Model not found: %(model)s') % dict(model=model), view_id)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 568, in raise_view_error

    raise ValueError(message)

ValueError: Modèle non trouvé : university.student


Contexte de l'erreur :

Vue `Student Form`

[view_id: 781, xml_id: n/a, model: university.student, parent_id: n/a]


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 758, in parse

    self._tags[rec.tag](rec, de, mode=mode)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 663, in _tag_record

    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3888, in _load_records

    records = self._load_records_create([data['values'] for data in to_create])

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3802, in _load_records_create

    return self.create(values)

  File "<decorator-gen-32>", line 2, in create

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 462, in _model_create_multi

    return create(self, arg)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 428, in create

    return super(View, self).create(vals_list)

  File "<decorator-gen-3>", line 2, in create

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 462, in _model_create_multi

    return create(self, arg)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3619, in create

    fields[0].determine_inverse(batch_recs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/fields.py", line 1142, in determine_inverse

    getattr(records, self.inverse)()

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch

    view.write(data)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 445, in write

    res = super(View, self).write(self._compute_defaults(vals))

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3344, in write

    self._write(store_vals)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3480, in _write

    self._validate_fields(vals)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 1130, in _validate_fields

    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))

odoo.exceptions.ValidationError: ("Erreur lors de la validation de la contrainte\n\nModèle non trouvé : university.student\n\nContexte de l'erreur :\nVue `Student Form`\n[view_id: 781, xml_id: n/a, model: university.student, parent_id: n/a]", None)


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 656, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 314, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 698, in dispatch

    result = self._call_function(**self.params)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 346, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/service/model.py", line 97, in wrapper

    return f(dbname, *args, **kwargs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 339, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 941, in __call__

    return self.method(*args, **kw)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/http.py", line 519, in response_wrap

    response = f(*args, **kw)

  File "/home/salah/odoo-projects/odoo-12.0/addons/web/controllers/main.py", line 966, in call_button

    action = self._call_kw(model, method, args, {})

  File "/home/salah/odoo-projects/odoo-12.0/addons/web/controllers/main.py", line 954, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 759, in call_kw

    return _call_kw_multi(method, model, args, kwargs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 746, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "<decorator-gen-61>", line 2, in button_immediate_install

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_module.py", line 74, in check_and_log

    return method(self, *args, **kwargs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_module.py", line 445, in button_immediate_install

    return self._button_immediate_function(type(self).button_install)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function

    modules.registry.Registry.new(self._cr.dbname, update_module=True)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/modules/registry.py", line 86, in new

    odoo.modules.load_modules(registry._db, force_demo, status, update_module)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/modules/loading.py", line 421, in load_modules

    loaded_modules, update_module, models_to_check)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/modules/loading.py", line 313, in load_marked_modules

    perform_checks=perform_checks, models_to_check=models_to_check

  File "/home/salah/odoo-projects/odoo-12.0/odoo/modules/loading.py", line 222, in load_module_graph

    load_data(cr, idref, mode, kind='data', package=package, report=report)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/modules/loading.py", line 68, in load_data

    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 802, in convert_file

    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 865, in convert_xml_import

    obj.parse(doc.getroot(), mode=mode)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 755, in parse

    self.parse(rec, mode)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 764, in parse

    exc_info[2]

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/pycompat.py", line 86, in reraise

    raise value.with_traceback(tb)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 758, in parse

    self._tags[rec.tag](rec, de, mode=mode)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/tools/convert.py", line 663, in _tag_record

    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3888, in _load_records

    records = self._load_records_create([data['values'] for data in to_create])

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3802, in _load_records_create

    return self.create(values)

  File "<decorator-gen-32>", line 2, in create

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 462, in _model_create_multi

    return create(self, arg)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 428, in create

    return super(View, self).create(vals_list)

  File "<decorator-gen-3>", line 2, in create

  File "/home/salah/odoo-projects/odoo-12.0/odoo/api.py", line 462, in _model_create_multi

    return create(self, arg)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3619, in create

    fields[0].determine_inverse(batch_recs)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/fields.py", line 1142, in determine_inverse

    getattr(records, self.inverse)()

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch

    view.write(data)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/addons/base/models/ir_ui_view.py", line 445, in write

    res = super(View, self).write(self._compute_defaults(vals))

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3344, in write

    self._write(store_vals)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 3480, in _write

    self._validate_fields(vals)

  File "/home/salah/odoo-projects/odoo-12.0/odoo/models.py", line 1130, in _validate_fields

    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))

odoo.tools.convert.ParseError: "Erreur lors de la validation de la contrainte


Modèle non trouvé : university.student


Contexte de l'erreur :

Vue `Student Form`

[view_id: 781, xml_id: n/a, model: university.student, parent_id: n/a]

None" while parsing /home/salah/odoo-projects/odoo-12.0/odoo_apps/university/views/student_views.xml:22, near

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

      <field name="name">Student Form</field>

      <field name="model">university.student</field>

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

        <form>

            <group>

              <field name="f_name"/>

              <field name="l_name"/>

              <field name="sexe"/>

              <field name="identity_card"/>

              <field name="birthday"/>

              <field name="registration_date"/>

              <field name="address"/>

              <field name="email"/>

              <field name="phone"/>

          </group>

        </form>


      </field>

    </record>

Avatar
Discard

If you are new to odoo development, have a look at this, might be helpfull: https://www.youtube.com/watch?v=BDepk0LhVuI&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM

Best Answer

Hi,


Seems like "university.student" module is not present at Odoo end that's why you were getting this issue.
There can be either two reasons,

  • Either "university.student" is not defined inside the __init__.py file. So if not defined then please define this model inside the __init__.py file.

  • Else sequence of this module inside the __init__.py is incorrect. I mean if "university.student" model is used in other model(like relational field) then that model should be define after "university.student" model.

    • For example we have two files A.py and B.py.  

    • And model of B.py is used in A.py file then you need define file like below,

      • from . import B 
        from . import A

Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Avatar
Discard
Author Best Answer

Thanks for your help

Avatar
Discard
Related Posts Replies Views Activity
4
May 24
4872
1
Jul 23
1241
3
Jun 23
1787
4
Jun 22
3316
3
Apr 22
4166