Community mailing list archives

Odoo Connector, how to fire an on_record_create event.

Ecosoft Co. LTD, Kitti Upariphutthiphong
- 03/06/2016 04:32:47
Hi connector experts,

To understand how Odoo Connector works. I start writing a simple use case to export a record from Odoo.

My code in,

from openerp.addons.connector.event import on_record_create
from .unit.export_synchronizer import export_org

def delay_export_org(session, model_name, record_id, fields=None):
    export_org.delay(session, model_name, record_id)

def create_default_binding(session, model_name, record_id, fields=None):
    obj = session.env[model_name].browse(record_id)
    default_backends = session.env['connector.backend'].search([])

    ic_model_name = 'connector.' + model_name
    for backend in default_backends:
            'exported_record': True

I assume that @on_record_create is the key, when I create a record in model, the above code should run. But it wasn't.

Anywhere else I have to tell connector in order to fire the event?

Thank you,
Mobile: +66-(0)8-1841-7480
Your ERP Partner =>