Search code examples
odooodoo-13

AssertionError: Element odoo has extra content: record, line 3 - - - Odoo13


I am trying to add a menu under Actions. But i am getting below error.

2019-12-24 11:28:28,309 22740 ERROR odoo13 werkzeug: Error on request: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 258, in execute application_iter = app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/server.py", line 414, in app return self.app(e, s) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line 142, in application return application_unproxied(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line 117, in application_unproxied result = odoo.http.root(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1281, in call return self.dispatch(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1251, in call return self.app(environ, start_wrapped) File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 766, in call return self.app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1433, in dispatch odoo.registry(db).check_signaling() File "/home/user/Projects/odoo_13.0.EE/odoo/init.py", line 104, in registry return modules.registry.Registry(database_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 61, in new return cls.new(db_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 85, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 416, in load_modules force, status, report, loaded_modules, update_module, models_to_check) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 312, in load_marked_modules perform_checks=perform_checks, models_to_check=models_to_check File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 222, in load_module_graph load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 68, in load_data tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line 737, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line 787, in convert_xml_import relaxng.assert_(doc) File "src/lxml/etree.pyx", line 3536, in lxml.etree.Validator.assert
AssertionError: Element odoo has extra content: record, line 3 - - -

*.xml

  <?xml version="1.0" encoding="utf-8"?>
  <odoo>
    <record id="import_image_view_form" model="ir.ui.view">
      <field name="name">import.image.form</field>
      <field name="model">import.image</field>
      <field name="arch" type="xml">
        <form string="Import Images">
          <group >
              <field widget="binary" height="64" name="file" filename="file_fname" required="1"/>
              <field name="file_fname" invisible="1"/>
          </group>

          <footer>
            <button name="get_file" type="object" class="oe_highlight" string="Load File" style="width:75px;"/>
            <button string="Cancel" class="btn-default" special="cancel"/>
          </footer>
        </form>
      </field>
    </record>
    <record id="import_image_action_form" model="ir.actions.act_window">
      <field name="name">Import product images</field>
      <field name="res_model">import.image</field>
      <field name="view_mode">form</field>
      <field name="view_id" ref="import_image_view_form"/>
      <field name="target">new</field>
    </record>

      <act_window
        name="Import Product Image"
        id="action_import_product_image"
        res_model="import.image"
        src_model="product.template"
        target="new" multi="True" key2="client_action_multi"/>

  </odoo>

Solution

  • Finally, i found a solution. I just removedact_window tag. And added a field binding_model_id in ir.actions.act_window.

    <record id="import_image_action_form" model="ir.actions.act_window">
      <field name="name">Import product images</field>
      <field name="res_model">import.image</field>
      <field name="view_mode">form</field>
      <field name="view_id" ref="import_image_view_form"/>
      <field name="target">new</field>
      <field name="binding_model_id" ref="account.model_product_template" />
    </record>
    

    it works.