Warning: this is a very initial release.
Discussion group: openerp-ooop Post Issues on github: GITHUB Issues
python
$ python setup.py install
jython
$ jython setup.py install
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> o.ResPartner.all()
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> n = o.ResPartner.get(1)
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> n = o.ResPartner.get(1)
>>> print n.name
or in related objects:
>>> print len(n.address)
>>> print n.address[0].name
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> n = o.ResPartner.get(1)
>>> n.delete()
100 firsts
>>> from ooop import OOOP
>>> o = OOOP(dbname='demo')
>>> n = o.ResPartner.all()
>>> n[1:100].delete()
all
>>> n.delete()
You can extend arguments using ne, lt, lte, gt, gte, like and ilike:
>>> o.ResPartner.filter(name='Guido')
>>> o.ResPartner.filter(name__ne='Guido')
>>> o.ResPartner.filter(name__lt='Guido')
>>> o.ResPartner.filter(name__lte='Guido')
>>> o.ResPartner.filter(name__gt='Guido')
>>> o.ResPartner.filter(name__gte='Guido')
>>> o.ResPartner.filter(name__like='Guido')
>>> o.ResPartner.filter(name__ilike='guido')
>>> o.ResPartner.filter(id__in=[1,2,5,8])
>>> o.ResPartner.filter(id__not_in=[1,2,5,8])
>>> n = o.ResPartner.new()
>>> n.name = 'Partner created with OOOP'
>>> n.save()
>>> n = o.ResPartner.new(name='Guido', active=True)
>>> n.save()
with context
To pass context in the call:
>>> n = o.ResPartner.new()
>>> n.name = 'Partner created with OOOP'
>>> n.save(context={'context-key':context-value})
with related objects
To save all related objects of an object:
>>> n = o.ResPartner.new()
>>> n.name = 'Partner created with OOOP'
>>> addr = o.ResPartnerAddress.new()
>>> addr.street = "Testing related objects"
>>> n.address.append(addr)
>>> n.save_all()
>>> m = [o.ResPartnerAddress.new(name='New Address', street='New Street', active=True)]
>>> n = o.ResPartner.new(name='Guido', address=m, active=True)
>>> n.save_all()