I replaced the action of the forecasted button with an xpath, I setted as name of the button my new action action_stock_level_forecast_report_product_tree
And in my action I have setted the ref of my new view 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>
Then i tried to run this, but i have got a strange JavaScript error :
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
Can someone help me please ? Sorry for the mistakes I'm french and I'm a begginner with odoo/python/xml
Your tree view must have some content in order to be rendered. Add at least one field in your view and it should load normally.
<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>