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

Hi, 

I have a simple coding question. I am inheriting from a model pos.order. I want to execute a simple function from that model and then modify it, but it doesn't work. This is how I made it:

class pos_order(osv.osv):
    _inherit = 'pos.order'
_name = 'pos.order'
    @api.multi
def create_picking(self):
        return super(pos_order, self).create_picking() 


I don't know why the super function does not work. I already confirmed that code in that file will be executed, but in that case "super" does not work. No idea what I am doing wrong. 

Any ideas?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Check the dependency set on __openerp__.py.

Your module must depend from the point_of_sale module.

Best regards.

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

you sir, are the real hero. Thank you very much, I just spend two hours logging T_T

You solution works for me, thank you!

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

You're inheriting class with old api (osv.osv), but declare method with new api, passing only self argument. Try to pass all arguments:

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

     (do_something)

     return super(pos_order, self).create_picking(cr, uid, ids, context=context)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 15
4570
2
thg 5 25
291
2
thg 6 15
9074
1
thg 12 22
3090
0
thg 5 22
2427