简体   繁体   中英

Odoo XMLRPC Python Add Dictionary Value To Other

so i'm currently learn how Odoo XMLRPC works and i would like to insert optional product inside sales order .

I found a way and it worked, but i'm a bit confused on how to assign 'name' with 'product_id' from dictionary. In Odoo, this 'product_id' will appear as a real product with it's name (eg: broom) and i would like to put that "broom" into the 'name' .

new_quotation = models.execute_kw(db, uid, password, 'sale.order', 'create', [{
   'sale_order_option_ids':[
        (0, 0, {
            'product_id': 2285, #insert product ID
            'product_uom_qty': 100, #insert product qty
            'price_unit': 100000, #Sale Price
            'name': 'product_id', #Name of product as description
            'uom_id' : 31, #Unit of Measure
        })
    ]
}])

And also, what is this line used for? What is it called? Is it possible to change it to something that might be more "readable" for us?

(0, 0, 

Or maybe if you have any suggestion i would like to know and learn.

Thanks!

If you don't pass name in the query then the name from the product will automatically be fetched on the creation of SOL and uom_id and price is also not necessary to pass, 0,0 is for the creation of new line Source the other way you can do this is by creating just sale order and in return you may get id of sale order created use that id and then only create SOL with order_id:id_returned_from_creating_so

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM