Hi,
I have searched through several sites, but I don't find how this "programming technique" is called.
To give an example: Inside the purchase module there is a function for counting all shipments for a purchase:
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
return {
purchase.id: {
'shipment_count': len(purchase.picking_ids),
'invoice_count': len(purchase.invoice_ids),
}
for purchase in self.browse(cr, uid, ids, context=context)
}
I don't get why it is possible to put a for loop inside in a dictionary, and then, putting it even _AFTER_ the dictionary key purchase.id. Is there a name for this kind of programing technique so I can google it up? Or can anybode explain me, why it works to put it after purchase.id? Are dictionaries parsed by from the buttom to the top? Thanks for help!