تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2396 أدوات العرض

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
يونيو 21
13394
2
مارس 24
2718
3
نوفمبر 24
4387
2
يوليو 23
3764
2
مايو 23
197