Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2903 Vistas

Hello everybody, I have a little problem that I don't know how resolve it. In my personal module, when the manager of the department approves a employee form, the data is passed to a external table, but one of the fields (a integer) changes from 1 to 2 when the data is passed.

My problem is the following, the manager makes a second approvement when the integer field is 3, so I would like to know if is possible check it in Odoo when in the external table the integer value is changed from 2 to 3.


Thank you.


Avatar
Descartar
Mejor respuesta

It's difficult to assess the best strategy without knowing how it's all set up, but a write hook could be useful if the external table has a link to the manager. On employee form it would look something like this:

def write(self, vals):
    for rec in self:
        if rec.<integer_field> == 2 and vals.get('<integer_field>') == 3:
            rec.employee_id.manager_id.<let_manager_know>()
    return super(<ManagerClass>, self).write(vals)

Generally it's easier to check for a change at the source unless it's for a computed field, in which case a depends is your best bet.

Avatar
Descartar
Autor

Finally I made it with a little cron, but thanks for your answer!

Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 18
4266
3
oct 16
7047
1
sept 17
3703
3
jul 17
3834
1
may 16
10268