import odoorpc # Prepare the connection to the server odoo = odoorpc.ODOO('127.0.0.1', port=8069) # Check available databases print(odoo.db.list()) # # Login odoo.login('odooshequ', 'admin', 'admin') # # # Current user user = odoo.env.user print(user.name) # name of the user connected print(user.id) print(user.company_id.name) # the name of its company # # # # Use all methods of a model if 'sale.order' in odoo.env: Order = odoo.env['sale.order'] order_ids = Order.search([]) for order in Order.browse(order_ids): print(order.name) products = [line.product_id.name for line in order.order_line] print(products) # # # Update data through a record user.name = "Brian Jones"
标签:name,odoorpc,user,odoo,print,order From: https://www.cnblogs.com/pythonClub/p/17367062.html