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

Hi,

I'm using a Odoo 18 online instance and I need to apply promotion/coupon code for a sale order through xml-rpc. Is it possible to do this. I analyzed the Odoo source code and '_try_apply_code' method, but it shows the error 'Private methods (such as _try_apply_code) cannot be called remotely.'.  Is there is any way to do this? Hoping someone has the solution?


Thanks in advance

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

Hi John 


have a look at this method _apply_program_reward in sale.order model under the module sale_loyality

but since this method is not public you cannot access it throw XML-RPC so you may develop a public method that call that one after

For the front end odoo has an endpoint that you may also use, this endpoint will apply the coupon, this can also be useful

@route(['/coupon/<string:code>'], type='http', auth='public', website=True, sitemap=False)
def activate_coupon(self, code, r='/shop', **kw):


hope this helps

Daniel

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 8 25
4722
3
thg 7 25
3706
1
thg 10 24
2668
1
thg 4 24
2794
2
thg 3 24
6525