Odoo Help


Any function for when change state of workflow? [Closed]

on 7/12/13, 12:36 PM 2,198 views

The Question has been closed

on 07/17/2013 07:55:29


I would like to know if have any function for OpenERP v7 to know if state of workflow change, and if this happens with this function change a field. Basically I want to create a new field date for account_invoice and when state of workflow change this field date is updated automatically.

How do this? Sorry my english.

On 7/17/13, 7:54 AM

The solution is create a new field function like this, for example:

'invoice_status_date': fields.function(_get_invoice_status_date, method=True, type="datetime", store={'account.invoice': (lambda self, cr, uid, ids, ctx={}: ids, ['state'], 10),}, string="State change date"),

This field calls a function, in this case _get_invoice_status_date. In this function we can do what we want:

def _get_invoice_status_date(self, cr, uid, ids, field_name, arg, context=None):

        result = {}
        for invoice in self.browse(cr, uid, ids, context=context):
            result[invoice.id] = fields.datetime.now()

        return result

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/12/13, 12:36 PM
Seen: 2198 times
Last updated: 3/16/15, 8:10 AM