0

我正在尝试在Actions. 但我得到了错误。

2019-12-24 11:28:28,309 22740 错误 odoo13 werkzeug:请求错误:回溯(最近一次调用最后):文件“/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py” ,第 270 行,在 run_wsgi 中执行(self.server.app)文件“/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py”,第 258 行,在执行 application_iter = app(environ, start_response ) 文件“/home/user/Projects/odoo_13.0.EE/odoo/service/server.py”,第 414 行,在应用程序中返回 self.app(e, s) 文件“/home/user/Projects/odoo_13。 0.EE/odoo/service/wsgi_server.py”,第 142 行,在应用程序返回 application_unproxied(environ, start_response) 文件“/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py”,行117, 在 application_unproxied 结果 = odoo.http.root(environ,start_response) 文件“/home/user/Projects/odoo_13.0.EE/odoo/http.py”,第 1281 行,在 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”,第 766 行,在调用中 返回 self.app(environ, start_response) 文件“/home/user/Projects/odoo_13.0.EE/odoo /http.py”,第 1433 行,调度 odoo.registry(db).check_signaling() 文件“/home/user/Projects/odoo_13.0.EE/odoo/init .py ”,第 104 行,在注册表返回模块中.registry.Registry(database_name) 文件“/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py”,第 61 行, 在新的 odoo.modules.load_modules(registry._db, force_demo, status, update_module)文件“/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py”,第 416 行,在 load_modules 强制、状态、报告、loaded_modules、update_module、models_to_check)文件“/home/user/ Projects/odoo_13.0.EE/odoo/modules/loading.py”,第 312 行,在 load_marked_modules perform_checks=perform_checks,models_to_check=models_to_check 文件“/home/user/Projects/odoo_13.0.EE/odoo/modules/loading. py”,第 222 行,在 load_module_graph load_data(cr, idref, mode, kind='data', package=package, report=report) 文件“/home/user/Projects/odoo_13.0.EE/odoo/modules/loading .py”,第 68 行,在 load_data tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) 文件“/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py”,第 737 行,在 convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) 文件“/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py”,第 787 行,在 convert_xml_import 松弛。 assert_(doc) 文件“src/lxml/etree.pyx”,第 3536 行,在 lxml.etree 中。在 convert_xml_import Relaxng.assert_(doc) 文件“src/lxml/etree.pyx”,第 3536 行,在 lxml.etree 中。在 convert_xml_import Relaxng.assert_(doc) 文件“src/lxml/etree.pyx”,第 3536 行,在 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>
4

2 回答 2

2

最后,我找到了解决方案。我刚刚删除了act_window标签。并binding_model_idir.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>

有用。

于 2020-01-01T05:52:49.500 回答
0

你没有<data>在你的xml代码中提到。我已经更新了它。请尝试以下代码。

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

        <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"
            res_model="import.image"
            src_model="product.template"
            view_mode="form"
            target="new"
            multi="True"
            key2="client_action_multi"
            id="action_import_product_image" />
    </data>
</odoo>
于 2019-12-24T12:44:44.470 回答