Odoo Help

Welcome!

This community 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.

0

How to capture a field change without _compute in another field?

By
Alejandro Santana
on 1/12/15, 8:20 AM 645 views

I need to capture changes in field 'stage_id' in model 'crm.lead' and trigger a function. More specifically, it needs to work when the Opportunity stage is changed via kanban view.

I tried using @api.depends... but it looks like these @api.depends functions are only triggered if there is a field 'X' with _compute pointing to such function. But I need that field 'X' to be manually modifiable (and it looks _compute prevents it).

Can this be handle in any way?

OK, typing error: I typed '_compute=' in fields definition instead of 'compute='.

Anubía, soluciones en la nube, S.L., Alejandro Santana
on 1/13/15, 6:36 AM
1

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 1/14/15, 10:39 AM

Check for the value in the ORM methods i.e. create & write, this way, Vals/values will provide if any changes made to any fields..

However, If you are using Version 8 or so,  Message log will capture activities of the status [trackvisibility]

Yes, I am overriding write() method often, as changes can be detected by the presence (or not, if fields was not changed) of a key in 'values' dictionary. And also, previous value can be checked with self.your_field, against values.get('your_field', None) or similar. Trackvisibility is nice to log changes, but not to do something else along a change.

Anubía, soluciones en la nube, S.L., Alejandro Santana
on 1/14/15, 1:05 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 1/12/15, 8:20 AM
Seen: 645 times
Last updated: 3/16/15, 8:10 AM