Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3357 Visualizzazioni

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: 

sale.order.inherit

sale.order

This error occurs:

Element '' cannot be located in parent view

View error context:
{'file': 'd:\\odoo16\\server\\odoo\\custom\\asmaa\\views\\sale_order.xml',
 'line': 2,
 'name': 'sale.order.inherit',
 'view': ir.ui.view(1622,),
 'view.model': 'sale.order',
 'view.parent': ir.ui.view(795,),
 'xmlid': 'view_sale_form_inherit'}


Avatar
Abbandona
Risposta migliore

Hi,
Try this:
Define field in python level 


To make this field in sale order view, you need to create a new view that inherits from the original sale order form view and adds the new field. Here's an example of how to do that in XML:


Hope this will help you
Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 24
2001
3
nov 24
4203
2
lug 23
3582
3
giu 23
2422
3
apr 24
4283