Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
10760 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ

Use super before calling your function.

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 15
6830
0
thg 3 15
2946
0
thg 3 15
4887
1
thg 3 15
4999
2
thg 11 19
5054