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

I am creating a form with one orderline in Website Ecommerce page like below image

http://prntscr.com/fhni23

Here When I click on the confirm Order button this corresponding order line should should go to add to cart page .How its possible need a help? 

This in odoo 10 below i can show the correspnding order from backend ,but when I click on Confirm order how this ?


I tried like below.............


@http.route('/wishlist/add-to-cart', type='http', auth="public", website=True)
def add_to_cart(self,product_id,add_qty=1, set_qty=0):
cr, uid, context, registry = request.cr, request.uid, request.context, request.registry

# Check user input

try:
product_id = int(product_id)
except:
product_id = None

if product_id:
product_id = registry["product.product"].browse(cr, uid, [product_id])

# Is the product ok
if product_id and product_id.sale_ok and product_id.website_published:
# Get the cart-sale-order
so = request.website.sale_get_order(force_create=1)
# Update the cart
so._cart_update(cr, uid, product_id=product_id.id, add_qty=add_qty)

# Redirect to cart anyway
return request.redirect("/shop/cart")


In template I modified URL Like below..............................


<td>
<t t-if="po_line>

<a class="btn btn-primary btn-sm mt8 js_check_product a-submit" href="/wishlist/add-to-cart">Confirm Order</a>


</td>

i got error like 

response = f(*args, **kw)

TypeError: add_to_cart() takes at least 2 arguments (1 given)

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

pls post Your py file.

Tác giả

main.py is already posted...

Tác giả

hi.....Which py file you are asking?

Hello,

Have you solved this ?

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

Dear just change your return URL like : return request.redirect("/shop/checkout")

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

same problem here, no solution?

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