Skip to Content
Menu
This question has been flagged
1 Reply
2864 Views

Am using odoo10. In the models/models.py file I have the following:

from connector.event import on_record_create

@on_record_create
def on_create_trigger(session, model_name, record_id, vals):
         print model_name


I have installed the queue_job module and the connector module without errors. But, when I create a new user and hit the save button doesn't print anything. What am I doing wrong?

Avatar
Discard
Author Best Answer

I put my code out of the models module in a file called events.py, then in the init.py added an import for events. Then changed the import in the events.py file, that was wrong. It was as follows:

__init__.py

from . import controllers

from . import models

import events


events.py

from odoo.addons.connector.event import on_record_create

@on_record_create()

def procesa_creacion_de_usuarios(session, model_name, record_id, vals):
       print model_name

And it worked!

Avatar
Discard
Related Posts Replies Views Activity
2
Nov 24
25076
0
Oct 24
82
0
Jun 24
280
2
May 24
5513
3
Mar 24
4962