Odoo Help


4 Answers

Andreas Brueckl Austria

--Andreas Brueckl--

| 8 8 9
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl Austria
3/12/13, 1:14 PM

You can override the write() method of the desired object (e.g. account.account).

def write(self, cr, uid, ids, vals, context=None):
    res = super(my_class, self).write(cr, uid, ids, vals, context=context)
    return res

But this is a very deep intrusion into the system and may have side effects.

Mabye you can also use Automated Actions for this purpose. See menu "Settings / Technical / Automated Actions".

Yug Faa Morocco
3/12/13, 1:17 PM

Exactly, it's the best answer +1

priyankahdp Sri Lanka
3/23/13, 8:27 AM

Thanks Andreas..If we need to add many2one field (that data need to load after function trigger )

ex : select * from hr_department where xxxxxx then how to get them in my that field .?

Andreas Brueckl Austria
3/24/13, 8:10 AM

If you want to set a certain value when an object is written, you can use the provided function and update the vals dict before the call of the write().


Fabien Pinckaers (fp) United States

--Fabien Pinckaers (fp)--
| 7 8 10
San Francisco, United States
--Fabien Pinckaers (fp)--

Odoo Founder & CEO

Fabien Pinckaers (fp) United States
5/24/14, 4:20 AM

You should not develop custom modules for such customizations. Use the base_action_rule module that allows to create such a rule in just a few clicks.

1 Comment
Justin Australia
2/2/15, 1:19 AM

Is it possible to use Automated Actions to trigger client-side wizards/popups? For example, I'm trying to add the ability to detect potential duplicate Partners as a new one is entered (rather than relying on deduplication after the face). You can't trigger a wizard from inside an onchange() where this functionality would be the most useful, but I might be able to trigger a popup when the user attempts to Save a record that could be a duplicate. I've attempted to test this by using Automated Actions to link Partner Create or Write with the Deduplicate Contacts action, but nothing seems to happen.

gayathiri India
5/24/14, 4:06 AM

Thanks Andreas, that's the solution I found too - was hoping to not have to go there. I'll look into the Automated Actions.

Allison United States
3/12/13, 1:15 PM

The solution I found is overwriting the object in questions write() function. I was hoping there was a flag or setting instead, but this does the trick too.

def write(self, cr, uid, ids, vals, context=None):
    # Function calls and such here
    return super(sale_order, self).write(cr, uid, ids, vals, context=context)
Ask a Question
Keep Informed
2 follower(s)
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