Skip to Content
Menu
This question has been flagged
6 Replies
5419 Views

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)

Avatar
Discard

pls post Your py file.

Author

main.py is already posted...

Author

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

Hello,

Have you solved this ?

Best Answer

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

Avatar
Discard
Best Answer

same problem here, no solution?

Avatar
Discard