Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Currently I use this syntax:
purchase_line_obj = self.pool.get('purchase.order.line') purchase_line_ids = purchase_line_obj.search(cr, uid, [('id','>',0)]) for purchase_line in purchase_line_obj.browse(cr, uid, purchase_line_ids,context=context):
I have tried to pass None or 0 to the ids in the 'browse' call to no avail. Is there any way to obtain all the records from 'browse' without having to pass the list of all id's?
This is not a good idea to place
id > 0 , actually there will be no 0 for IDs in database, database provide only numeric value for record ids
just do this way:
purchase_line_obj = self.pool.get('purchase.order.line') purchase_line_ids = purchase_line_obj.search(cr, uid, ) for purchase_line_id in purchase_line_ids : line=purchase_line_obj.browse(cr, uid,purchase_line_id ,context=context) print line.name
Hi, If you want to get all the purchase order lines related to a purchase order and you have the purchase order id then
po_pool = self.pool.get('purchcase.order') for po_obj in po_pool.browse(cr, uid, ids,context): print 'purchase order>>>>',po_obj.name for po_line in po_obj.order_line:#order_line is the field name of purchase order line model in purchase order model print 'purchase order line :::',po_line.name
For example display name for all lines :
purchase_line_obj = self.pool.get('purchase.order.line') purchase_line_ids = purchase_line_obj.search(cr, uid, [('id','>',0)]) for purchase_line in purchase_line_ids : line=purchase_line_obj.browse(cr, uid, purchase_line,context=context) print line.name
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/26/13, 9:53 AM|
|Seen: 6059 times|
|Last updated: 10/7/16, 4:01 AM|