This question has been flagged
1 Reply
1951 Views

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
Discard
Best Answer

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
Discard
Author

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