Odoo 11.0 尝试替换预测按钮的视图,javascript 错误
Odoo 11.0 Try to replace the view of forecasted button, javascrip error
我用 xpath 替换了预测按钮的操作,
我将新操作的按钮名称设置为 action_stock_level_forecast_report_product_tree
在我的操作中,我设置了新视图的引用 product_product_forecast_tree_view
<!--product product -->
<record id="product_product_forecast_tree_view" model="ir.ui.view">
<field name="name">product.template.forecast.tree.view</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<tree string="test">
<!--<field name="product_id"/>-->
</tree>
</field>
</record>
<record id="action_stock_level_forecast_report_product_tree" model="ir.actions.act_window">
<field name="name">Stock Level Forecast Report product Tree</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="product_product_forecast_tree_view"/>
</record>
<record id="product_product_forecasted_button" model="ir.ui.view">
<field name="name">product.product.forecasted.button</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//button[@name='%(stock.action_stock_level_forecast_report_product)d']" position="attributes">
<attribute name="name">%(action_stock_level_forecast_report_product_tree)d</attribute>
</xpath>
</data>
</field>
</record>
然后我尝试 运行 这个,但是我遇到了一个奇怪的 JavaScript 错误:
Erreur: TypeError: list is undefined
http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1193
Retraçage :
_applyX2ManyOperations@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1193:194
get@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1124:565
get/list.data<@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1128:169
_.collect@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:13:270
get@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1128:126
renderSidebar@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1688:85
renderSidebar@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:3013:502
OdooClass.extend/Class.include/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:3819:368
render_view_control_elements@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:489:76
_display_view@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:483:261
switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:482:44
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56
switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:481:395
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
add@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:797:467
switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:481:338
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
updateFunc/<@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:804:482
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
add@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:797:467
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:772
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56
rpc/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:3869:346
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874
fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281
fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198
done@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:1192:86
callback@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:1212:15
有人可以帮我吗?
对不起,我是法国人,我是 odoo/python/xml
的初学者
您的树视图必须包含一些内容才能呈现。在您的视图中至少添加一个字段,它应该会正常加载。
<record id="product_product_forecast_tree_view" model="ir.ui.view">
<field name="name">product.template.forecast.tree.view</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<tree string="test">
<!-- Needs real content in the tree element -->
<field name="product_id"/>
</tree>
</field>
</record>
我用 xpath 替换了预测按钮的操作, 我将新操作的按钮名称设置为 action_stock_level_forecast_report_product_tree
在我的操作中,我设置了新视图的引用 product_product_forecast_tree_view
<!--product product -->
<record id="product_product_forecast_tree_view" model="ir.ui.view">
<field name="name">product.template.forecast.tree.view</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<tree string="test">
<!--<field name="product_id"/>-->
</tree>
</field>
</record>
<record id="action_stock_level_forecast_report_product_tree" model="ir.actions.act_window">
<field name="name">Stock Level Forecast Report product Tree</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="product_product_forecast_tree_view"/>
</record>
<record id="product_product_forecasted_button" model="ir.ui.view">
<field name="name">product.product.forecasted.button</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//button[@name='%(stock.action_stock_level_forecast_report_product)d']" position="attributes">
<attribute name="name">%(action_stock_level_forecast_report_product_tree)d</attribute>
</xpath>
</data>
</field>
</record>
然后我尝试 运行 这个,但是我遇到了一个奇怪的 JavaScript 错误:
Erreur: TypeError: list is undefined
http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1193 Retraçage : _applyX2ManyOperations@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1193:194 get@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1124:565 get/list.data<@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1128:169 _.collect@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:13:270 get@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1128:126 renderSidebar@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:1688:85 renderSidebar@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:3013:502 OdooClass.extend/Class.include/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:3819:368 render_view_control_elements@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:489:76 _display_view@http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:483:261 switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:482:44 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56 switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:481:395 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 add@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:797:467 switch_mode/http://localhost:8069/web/content/8507-ea13d16/web.assets_backend.js:481:338 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 updateFunc/<@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:804:482 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 add@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:797:467 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:772 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56 rpc/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:3869:346 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:678 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 Deferred/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:803:56 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 then/http://localhost:8069/web/content/8496-d085622/web.assets_common.js:802:874 fire@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:796:281 fireWith@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:801:198 done@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:1192:86 callback@http://localhost:8069/web/content/8496-d085622/web.assets_common.js:1212:15
有人可以帮我吗? 对不起,我是法国人,我是 odoo/python/xml
的初学者您的树视图必须包含一些内容才能呈现。在您的视图中至少添加一个字段,它应该会正常加载。
<record id="product_product_forecast_tree_view" model="ir.ui.view">
<field name="name">product.template.forecast.tree.view</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<tree string="test">
<!-- Needs real content in the tree element -->
<field name="product_id"/>
</tree>
</field>
</record>