Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2389 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

I used your code but the same error occur

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
čvn 21
13390
2
bře 24
2717
3
lis 24
4385
2
čvc 23
3762
2
kvě 23
197