Friday, August 17, 2012

openerp - paradise of extensibility

Here is an extract of one of the openerp kernel file:

class _column(object):

    def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete=None, translate=False, select=False, manual=False, **args):
        for a in args:
            if args[a]:
                setattr(self, a, args[a])

This last for loop is programmer paradise. It simply means you can create any field and add directly data to the field definition like a qualifier or anything you need in the constructor.

Simply cool, elegant and efficient !

No comments: