Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
2881 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur

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

Publications associées Réponses Vues Activité
1
janv. 18
4236
3
oct. 16
7040
1
sept. 17
3699
3
juil. 17
3822
1
mai 16
10253