Hi, i am writing the create method of a sale order in a custom module. I want to get the order lines of this sale order in my method. How can i do that. I have heard about the "vals" parameters, but i dont know how to use it. Thanks !
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
            
                2
                
                    Replies
                
            
        
        
            
                14642
                
                    Tampilan
                
            
        
    def create (cr, uid, vals, context=None)
#vals or values returns dictionary containing all the fields, so you can use it like this to assign new values
vals['field_name_1'] = new_value_1
vals['field_name_2'] = new_value_2
#or assign to a variable
var_1 = vals['field_name_1']
var_2 = vals['field_name_2']
return super(class_name, self).create(cr, uid, vals, context=context)
Hi,
def create(cr, uid, vals, context=None):
    if context is None:
        context = {}
    if vals.get('order_line'):
        #YOUR LOGIC#
return super(CLASS, self).create(cr, uid, vals, context=context)
Email : info@acespritech.com
Skype : acespritech
Blog  : acespritechblog.wordpress.com
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
| 
            
                vals for relationship fields (one2many)
            
            
                    Diselesaikan
            
         |  | 1 Des 22  | 6742 | |
|  | 0 Sep 17  | 4488 | ||
| 
            
                How to access the vals dict.
            
            
                    Diselesaikan
            
         |  | 4 Sep 15  | 7657 | |
|  | 2 Jan 23  | 15736 | ||
|  | 1 Agu 16  | 11480 | 
