跳至内容
菜单
此问题已终结

I,m trying to add field in sale order
this is code of my class:
from odoo import models , fields,api,_
class SaleOrder(models.Model):
_name='sale.order'
_inherit = 'sale.order'
warehouse_id=fields.Many2one("stock.warehouse")

and i inherit the view by this code and i added the field:



"\ rel="ugc">ir\.ui\.view">
\ \ \ \ \ \ \ \ \ \ \ \ sale.order.form.view
sale.order









but the error occurs:

形象
丢弃
最佳答案

Hi 

Please try to update the code like this

<record id="view_sale_form_inherit" model="ir.ui.view">


   <field name="name">sale.order.inherit</field>


   <field name="model">sale.order</field>


   <field name="inherit_id" ref="sale.view_order_form"/>


   <field name="arch" type="xml">


       <xpath expr="//field[@name='sale_order_template_id']"


              position="after">


           <field name="warehouse_id"/>


       </xpath>


   </field>


</record>


Regards

形象
丢弃
编写者

I used your code but the same error occur

最佳答案

Hi,

You don't need to set  _name='sale.order', Just _inherit='sale.order'.
please check this video How to Paste code in Odoo Forum https://www.youtube.com/watch?v=nw3q0Cs1swg

形象
丢弃
相关帖文 回复 查看 活动
2
6月 21
13393
2
3月 24
2718
3
11月 24
4387
2
7月 23
3764
2
5月 23
197