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

its may be a silly question..i need to override the save button in WAREHOUSE->DELIVERY ORDERS->PRODUCT INLINE but unfortunately i couldn't find the create function file .can anyone help me to find the file

الصورة الرمزية
إهمال
أفضل إجابة

When you click on Save button it calls two methods.

  1. create: When you are creating a new record.
  2. 'write': When you are updating a record.

    You can override these two methods by inherit the object.

    class stock_picking_out(osv.Model):
        _inherit = 'stock.picking.out'
    
        def create(cr, uid, vals, context=None):
            #your code
            res_id = super(stock_picking_out, self).create(cr, uid, vals, context=context)
            #your code
            return res_id
    
        def write(cr, uid, ids, vals, context=None):
            #your code
            super(stock_picking_out, self).wite(cr, uid, ids, vals, context=context)
            #your code
            return True
    

This is how you can override the methods.

If you want to see these methods in server here: def create and def write

الصورة الرمزية
إهمال
أفضل إجابة

Sudhir's answer is unfortunately wrong.

The "Save" does NOT call write if there was no change!
What is the correct answer?

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 20
5314
1
أغسطس 15
5423
0
مارس 15
4946
1
مارس 21
7615
0
يناير 21
583