Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3443 Lượt xem

Hi I try to show custom views from sale order mode 

I follow cookbook odoo 12 developer but I have error to render but apparently is a problem whit js core of odoo

errors:

_renderBodyCell@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:444:25
_renderRow/$cells<@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:838:25
_renderRow@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:837:35
_renderRow@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1164:32
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:123:38
_renderRows@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:858:32
_renderRows@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1185:26
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:123:38
_renderBody@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:375:26
_renderBody@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1090:33
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:123:38
_renderView@http://localhost:8069/web/static/src/js/views/list/list_renderer.js:972:32
OdooClass.extend/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:90:38
_renderView@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1220:28
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:123:38
_render@http://localhost:8069/web/static/src/js/views/basic/basic_renderer.js:592:21
_render@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1053:28
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:133:38
start@http://localhost:8069/web/static/src/js/views/abstract_renderer.js:37:34
OdooClass.extend/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:90:38
start@http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:115:21
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/static/src/js/core/class.js:133:38
_widgetRenderAndInsert/<@http://localhost:8069/web/static/src/js/core/widget.js:433:25

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

<act_window id="action_all_coditos"
name="coditos"
res_model="sale.order"
view_mode="tree,form"
/>

<menuitem id="custom_dashboard_menuitem"
name="custom views"
action="action_all_coditos"
parent="sale.sale_menu_root" sequence="209" />


<record id ="view_vendedor_tree" model="ir.ui.view">
<field name="name">custo.tree.view</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<tree string="Custom tree">
<field name="name" />
</tree>

</field>
</record>

<record id ="view_vendedor_form" model="ir.ui.view">
<field name="name">custom.form.view</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<form string="Custom form">
<group>
<field name="name" />
</group>
</form>

</field>
</record>

<record id="custom_tree_view_a" model="ir.actions.act_window.view">
<field name="act_window_id" ref="action_all_coditos"/>
<field name="view_id" ref="view_vendedor_tree" />
<field name="view_mode">tree</field>
<field name="sequence" eval="2"/>
</record>

<record id="custom_form_view_b" model="ir.actions.act_window.view">
<field name="act_window_id" ref="action_all_coditos"/>
<field name="view_id" ref="view_vendedor_form" />
<field name="view_mode">form</field>
<field name="sequence" eval="2"/>
</record>
</odoo>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Luis,


In your code you have pass model 'sale.order' in tree & form view which odoo is already pass in the sale module. 


So, if you want to display the same sale_order view with additional your custom fields. Then you need to use inherits(instead of inherit) the sale.order model in py and create a seperate form & tree view in your custom action and menu.


Here you can take the example of product.product and product.template model in odoo base addons.


Inherits reference - https://www.odoo.com/fr_FR/forum/aide-1/question/whats-the-difference-between-inherit-and-inherits-52205


To inherit and add field to existing view in odoo video url - https://www.youtube.com/watch?v=z1Tx7EGkPy0

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

thanks for you answer is very informative for me

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 6 25
5820
4
thg 3 24
14893
0
thg 11 21
1999
0
thg 5 21
2550