Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
2923 Переглядів

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.


Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Автор

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

Related Posts Відповіді Переглядів Дія
1
січ. 18
4280
3
жовт. 16
7050
1
вер. 17
3705
3
лип. 17
3845
1
трав. 16
10280