Skip to Content
Menu
This question has been flagged

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:

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

I used your code but the same error occur

Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 21
12293
2
Mar 24
1333
3
Nov 24
2749
2
Jul 23
2059
2
May 23
197