如何在odoo 15中继承和扩展xml qweb视图?

How to inherit and extend xml qweb view in odoo 15?

我正在尝试在 Odoo 15 中扩展 Qweb XML 视图。

这是我试过的。

static.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <templates xml:space="preserve">
        <t t-name="digital_sign_extend.sign_name_and_signature_extend" t-extend="web.sign_name_and_signature">
          <t t-jquery=".card-header" t-operation="replace">

          </t>
        </t>
      <t> // here i added this purposefully, to get an error, but nothing happened.
      </templates>

清单.py # -- 编码:utf-8 -- { 'name': "digital_sign_extend",

        'summary': """
            Short (1 phrase/line) summary of the module's purpose, used as
            subtitle on modules listing or apps.openerp.com""",

        'description': """
            Long description of module's purpose
        """,

        'author': "My Company",
        'website': "http://www.yourcompany.com",

        # Categories can be used to filter modules in modules listing
        # Check https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/ir_module_category_data.xml
        # for the full list
        'category': 'Uncategorized',
        'version': '0.1',

        # any module necessary for this one to work correctly
        'depends': ['base','web'],

        # always loaded
        'data': [
            # 'security/ir.model.access.csv',
            'views/views.xml',
            'views/templates.xml',
        ],
        'web.assets_qweb':[
            'digital_sign_extend/static/src/xml/digital_sign.xml',
        ],
        # only loaded in demonstration mode
        'demo': [
            'demo/demo.xml',
        ],
    }

我该如何解决这个问题?

您需要将 web.asset_qweb 列表添加到“assets”字典中。下面是一个例子:

'assets': {
    'web.assets_qweb':[
        'digital_sign_extend/static/src/xml/digital_sign.xml',
    ],
}