Odoo Help

0

Override method write when occurs action "save" for update objects

By
Mikhno Viktoria
on 4/9/14, 1:53 PM 4,426 views

Hi! I try override method 'write' when create and update objects for sync with db Magento. At the moment, my method first sync with Magento and then save change.

    def write(self, cr, uid, ids, vals, context=None):

        self.ex_bulk_prod(cr, uid, ids[0], context)
        return super(product_product, self).write(cr, uid, ids, vals, context=context)

Please anybody prompt me, how make first to save change and only then sync with Magento.

Use super before calling your function.

devza
on 10/27/14, 9:46 AM
0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 10/27/14, 11:11 AM

Like Tobiasz adequetly responds, the super call is the call to the original save change. So the sooner the super call is done, the sooner you will save.

Note however: If the synced call to magento also prompts some changes, then you might need to save again.

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

Register

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

2 follower(s)

Stats

Asked: 4/9/14, 1:53 PM
Seen: 4426 times
Last updated: 3/16/15, 8:10 AM