New OpenERP Server

Registered by Mantavya Gajjar (Open ERP)

SAServer will be Enhanced Version OpenERP-Server which will support all Major Databases. Major aim is to make openerp database independent . and customer can make their existing application as it and able to implement openerp easily on the same dababase.

Things to be Take Care
* OpenERP Krenal - osv, orm and fields
* OpenERP Modules
* OpenERP DB Supports -

There are many type of Implementation is in my mind, of course SQLAlchemy is the great ORM so its better to use the same framework inside the openerp, but also take care about the openerp existing framework and modules, which should not be changed at all. and all modules and new development will work as it is.

Prototype 1:
class orm(object):

    #__metaclass__ = orm_meta

    def __init__(self):
        self.metadata = MetaData()
        self.tbl = None
        self.cols = []
        self.conn = engine.connect()

        for key, col in self._columns.items():
            if isinstance(col, char):
                self.cols += [Column(key, String(col.size))]
            elif isinstance(col, boolean):
                #TODO : Create a Boolean Fields
            elif isinstance(col, text):
                #TODO : Create a Text fields

        self.cols += [Column('id', Integer, primary_key=True)]
        self.tbl = Table(self._name, self.metadata, *self.cols)

    def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
        query =
        query = query.where(
        result = self.conn.execute(query)
        return result.fetchall()

    def create(self, cr, user, vals, context=None):
        return self.conn.execute(self.tbl.insert(), vals)

class DemoModel(orm):
    _name = 'account_voucher'
    _columns = {
        'name' : char('Name', size=64),

Prototype 2:
class Partner(ORMTemplate):
    _name = 'res.partner'
    _description = 'Partner Data'

    id = fields.integer('Id', primary_key=True)
    name = fields.char('Name', size=256, nullable=False)
    ref = fields.char('Code', size=256, nullable=False)
    website = fields.char('Website', size=256)
    emails = fields.one2many('res.partner.emails', 'partner_id', 'Emails')
    category_ids = fields.many2many('res.partner.category', 'res_partner_category_rel', 'partner_id', 'category_id', 'Categories')

but in above prototype the openerp model is totally changed but it looks as pure SQLAlchemy Implementation, so this will not be a good prototype

Prototype 3:
if we can do something like described billow based on the OpenERP model during the execution of the server
class Partner(osv.osv):
    _name = 'res.partner'
    _table = 'res_partner'
    def _get_credit(self, cr. uid, context={}):
        return [{}]
    _columns = {
        'name':fields.char('Name', size=256, required=True),
        'contacts_id':fields.one2many('', 'partner_id', 'Contacts'),
        'debit':fields.function(_get_credit, type='float')

#TODO : Convert _columns to _sa automatically
_sa = Table(
    Column('id', Integer, primary_key=True),
    Column('name', String(256), nullable=False, default="NULL"),
    Column('debit', Function(_get_credit, type=Integer)),
_mapping = mapper(Partner, _sa)

in this case we can easily attract the openerp developer, and also sqlalchemy lovers. thosw weho can either define opener _columns or sqlalchemy table directly in to the openerp model.

Well, Al this model are the based on the research, but there are still many things that is to be take care like
* Relational Fields
* Function Fields
* Sequences
* Indexes
* Selection Fields
* Store Functionality
* Inheritance Functionalists
* and many more

Well More Ideas Invited

Blueprint information

Fabien (Open ERP)
Mantavya Gajjar (Open ERP)
Needs approval
Mantavya Gajjar (Open ERP)
Series goal:
Milestone target:
Started by
Mantavya Gajjar (Open ERP)
Completed by
Mantavya Gajjar (Open ERP)



you may fine the good Progress of the SAServer here

there are few changes while starting the server
./ --engine='mysql://localhost' --addons-path=/home/mga/workspace/sa/addons-sa/

--engine is the new parameter which will be directly related to the engine url of the sqlalchemy


Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.