Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2397 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

I used your code but the same error occur

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
jun 21
13395
2
mar 24
2718
3
nov 24
4387
2
jul 23
3765
2
may 23
197