openerp-connector-community team mailing list archive
-
openerp-connector-community team
-
Mailing list archive
-
Message #00592
Re: delayed job cannot find my function
To answer my own question: the cause was that I had different instances of
openerp-server running.
Ron
On Mon, Jan 12, 2015 at 10:12 PM, Ron <ron.arts@xxxxxxxxx> wrote:
> Hi,
>
> I get the following error from the job queue:
>
> 2015-01-13 02:46:43,616 1366 ERROR nov
> openerp.addons.connector.queue.worker: Traceback (most recent call last):
> File "/opt/odoo/connector/connector/queue/worker.py", line 123, in
> run_job
> job.perform(session)
> File "/opt/odoo/connector/connector/queue/job.py", line 492, in perform
> self.result = self.func(session, *self.args, **self.kwargs)
> File "/opt/odoo/connector/connector/queue/job.py", line 540, in func
> return getattr(module, func_name)
> AttributeError: 'module' object has no attribute 'export_user'
>
>
> The code is:
>
> @job
> def export_user(session, model_name, record_id, fields=None):
> """ Export a changed user. """
> invoice = session.browse(model_name, record_id)
> backend_id = invoice.backend_id.id
> env = get_environment(session, model_name, backend_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)
>
> This is the logfile output:
>
> 2015-01-13 02:53:55,831 14301 WARNING nov openerp.addons.p711.model:
> delaying changing user
> 2015-01-13 02:53:55,856 14301 WARNING nov
> openerp.addons.connector.queue.job: module_name = openerp.addons.p711.model
> 2015-01-13 02:53:55,964 14301 WARNING nov openerp.addons.p711.model:
> delaying changing user
> 2015-01-13 02:53:55,971 14301 WARNING nov
> openerp.addons.connector.queue.job: module_name = openerp.addons.p711.model
>
>
> 2015-01-13 02:54:52,347 1366 ERROR nov
> openerp.addons.connector.queue.worker: Traceback (most recent call last):
> File "/opt/odoo/connector/connector/queue/worker.py", line 123, in
> run_job
> job.perform(session)
> File "/opt/odoo/connector/connector/queue/job.py", line 492, in perform
> self.result = self.func(session, *self.args, **self.kwargs)
> File "/opt/odoo/connector/connector/queue/job.py", line 540, in func
> _logger.warn("module_name = %s", module_name)
> AttributeError: 'module' object has no attribute 'export_user'
>
> 2015-01-13 02:54:52,560 1366 ERROR nov
> openerp.addons.connector.queue.worker: Traceback (most recent call last):
> File "/opt/odoo/connector/connector/queue/worker.py", line 123, in
> run_job
> job.perform(session)
> File "/opt/odoo/connector/connector/queue/job.py", line 492, in perform
> self.result = self.func(session, *self.args, **self.kwargs)
> File "/opt/odoo/connector/connector/queue/job.py", line 540, in func
> _logger.warn("module_name = %s", module_name)
> AttributeError: 'module' object has no attribute 'export_user'
>
> I am restarting odoo between modifications, and keep editing the Admin
> user. For some strange reason
> it worked ONCE, (right after I added 'print module' right before the
> getattr() call in in job.py
> but on the next try it failed again. It mystifies me.
>
> Can anybody give me tips on where to look?
>
> Thanks,
> Ron
>
>
References