• 14-Jul-16

    Guideline for Odoo integration in django python

    Below mentioned guideline for Django app to copy models, load and save records from a running Odoo instance.

    Djangodoo allows you to copy models from Odoo to Django, load records from Odoo as well as modifying them. It also provides an authentication mechanism using the Odoo authentication. This app makes a wide use of the Erppeek library

    Here is small project description for Odoo integration in django python:


    Quick start


    1.Add “Djangodoo” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = ( ... 'Djangodoo', )

    2.Include the Odoo host configuration in your project settings like this:

    ODOO_HOST = { 'USER': 'username', 'PASSWORD': 'password', 'HOST': 'http://localhost', 'PORT': 8069, 'DB': 'dbname' }

    3.[optional] Include the Odoo authentication backend in your project settings like this:

    AUTHENTICATION_BACKENDS = ('djangodoo.auth.OdooAuthBackend')

    4.Define a model like this:

    from djangodoo.models import OdooModel class Partner(OdooModel):
        _odoo_model = "res.partner"
        _odoo_fields = ['name'] # optional; if omitted, all fields are copied
        _odoo_ignore_fields = None # optional; fields in this list are not copied



    Odoo Model

    OdooModel inherits from django.db.models.Model. You can thus do with an OdooModel anything you would do with a regular django.db.models.Model. However, OdooModel provides a number of additional features:

    Follow below steps as per mentioned :

     

    1.As stated in the “Quickstart” section, it allows you to provide the name of model defined in Odoo as the value of the _odoo_model attribute. The fields of this latter model will be copied – and “translated” – into Django fields at runtime (and during the migration process, of course) (note that a many2one field from Odoo will be translated into a ForeignKey Django field only if the target model of this field is also copied into Django);

    2.The _odoo_fields and _odoo_ignore_fields allow you to restrict the list of fields that are copied from the original Odoo model;

    3.Several methods that ease the interactions with the Odoo server which is the Odoo model under concern are provided:

    • odoo_load(odoo_ids [, client]): class method that loads records from Odoo, given their identifiers.
      • odoo_ids is a list of Odoo records identifiers (integers);
      • client is an instance of erppeek.Client that is used to load the data; if none is provided, the client is the one configured in the settings.
    • odoo_search(domain, offset=0, limit=None, order=None, context=None [, client]): class method that searches and loads records from Odoo, given a domain and a series of parameters for the search method in Odoo.
    • odoo_write(objs, args [, client]): class method that writes the values provided in args into the Odoo records originating the Django instances provided in objs.
    • odoo_push(self, fieldnames=None [, client]): method that saves a Django instance into Odoo. If the instance has an odoo_id then we call write, otherwise we call create; we only save the values of the fields indicated in fieldnames, or all of them if it is None.


    Are looking for help in Odoo integration in django? - Contact us now

    Axis Technolabs proving odoo implementation, odoo integration in django, odoo customization, odoo deployment services, We providing our odoo development service in Belgium, Netherlands, UK, Germany, Spain, USA, Australia, Middle East - Malaysia, Singapore, Thailand, Hong Kong, Egypt and many more countries.

    Connect us on skype: raj.axistechnolabs or post your requirement to our email at business@axistechnolabs.com

    Tags : hire odoo developer for odoo integration in django , odoo development company, odoo migration, odoo upgradation, hire odoo developer on hourly basis, odoo event management system, event management tool in odoo, odoo implementation, odoo application integration, odoo customization, odoo theme development and other odoo services