Git Product home page Git Product logo

ooop's Introduction

Warning: this is a very initial release.

Contacting us:

Discussion group: openerp-ooop Post Issues on github: GITHUB Issues

How to install?

python


$ python setup.py install

jython


$ jython setup.py install

Examples (python console):

Connecting to server


  >>> from ooop import OOOP
  >>> o = OOOP(dbname='demo')

Retrieving all from model


  >>> from ooop import OOOP
  >>> o = OOOP(dbname='demo')
  >>> o.ResPartner.all()

Retrieving 1 record from model


  >>> from ooop import OOOP
  >>> o = OOOP(dbname='demo')
  >>> n = o.ResPartner.get(1)

Accesing attributes


  >>> 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 

Deleting 1 record


  >>> from ooop import OOOP
  >>> o = OOOP(dbname='demo')
  >>> n = o.ResPartner.get(1)
  >>> n.delete()

Deleting multiple records

100 firsts


  >>> from ooop import OOOP
  >>> o = OOOP(dbname='demo')
  >>> n = o.ResPartner.all()
  >>> n[1:100].delete()

all


  >>> n.delete()

Filtering

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])

Creating new


  >>> n = o.ResPartner.new()
  >>> n.name = 'Partner created with OOOP'
  >>> n.save()

  >>> n = o.ResPartner.new(name='Guido', active=True)
  >>> n.save()

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()

Export Graph

Get a model graphviz file in dot, png, jpg or svg:


o.export(filename="file", filetype="dot", showfields=True, model="res.partner", deep=None)

or simply:


o.export("file", "png", False)

also you can do


o.ResPartner.export(filename="file", filetype="png", deep=0)

Also you can generate a jpg file (res.partner.jpg in the example) with just especific table definition


o.ResPartner.export()

but if you want to get deep in the tables just need:


o.ResPartner.export(deep=1)

The deep param its relative to the model param, deep means how far you want to get with the relations.

ooop's People

Contributors

argami avatar ecarreras avatar lasarux avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.