openerp-connector-community team mailing list archive
-
openerp-connector-community team
-
Mailing list archive
-
Message #00593
on_record_write being called twice for each record change
Hi all,
(using Odoo 8, and latest connector)
See below code:
model.py:
from openerp.addons.connector.queue.job import job
from openerp.addons.connector.event import on_record_write
import logging
_logger = logging.getLogger(__name__)
@job
def export_user(session, model_name, record_id, fields=None):
""" Export a changed user. """
user = session.browse(model_name, record_id)
_logger.warn('changed user %d', record_id)
@on_record_write(model_names='res.users')
def delay_export_user(session, model_name, record_id, fields=None):
""" Delay the job to export the user """
_logger.warn('delaying changing user')
export_user.delay(session, model_name, record_id)
when I change the admin user, I get the following log entries:
2015-01-13 03:43:25,656 16022 WARNING nov openerp.addons.p711.model:
delaying changing user
2015-01-13 03:43:25,752 16022 WARNING nov openerp.addons.p711.model:
delaying changing user
2015-01-13 03:44:06,192 16022 WARNING nov openerp.addons.p711.model:
changed user 1
2015-01-13 03:44:06,247 16022 WARNING nov openerp.addons.p711.model:
changed user 1
So I get two jobs! What am I doing wrong?
Thanks,
Ron