eclipse - what is the purpose of using self.browse in python for openerp development? -
hi have been working on developing openerp module using python . have been going through source code , having problem understand it. dont understand following 2 lines self.browse having id,uid parameters , usage of tools functions
obj in self.browse(cr, uid, ids, context=context): result[obj.id] = tools.image_get_resized_images(obj.image) plz give me little know-how this. hopes suggestion
in simple words browse method enable read operation on database table records. browse method fetch records objects allowing use dot notation browse fields , relations. bring openerp programming near oops.
openerp framework codded in python programming using orm , mvc design patterns. orm wraps use value in object , allows crud operation methods in various methods i.e. url. read methods alternate of browse methods read return python list of dict , browse return list of objects each object record in database.
so analysis of code : statement for obj in self.browse(cr, uid, ids, context=context): can devided in lines. 1. self.browse(cr, uid, ids, context=context) fetching record(ids) self(object). 2. looping through return of above. each time loops iter store record in obj db record , record , object wraps tablet column values attribute in side, can fetch field values using obj.field_name
hope help.
Comments
Post a Comment