Skip to Content
Menu
This question has been flagged
1480 Views

Hi,
I inherited a website form view and give some input field but data is not fetching on controller
part.

<template id='product_form_view' inherit_id='website_sale.product''>

            

            <xpath expr="//div[1]/section[1]/div[2]/div[2]/form[1]" position="after">

                <form t-if="product._is_add_to_cart_possible()" action="/shop/cart/update" method="POST">

                 <input type="radio" name="sales_types" value="sale" id ='sale'/>Website Sale

                 <input type="radio" name="sales_types" value="cc" id='cc'/>SAS

                 <br/>

                <t t-if="request.website.clickCollectSystem">

                <t t-set='warehouses' t-value='product._get_warehouse()'/>

                <span id='select_shop' style='display:none'>

                    <div  class="d-flex align-items-center" >

                        <strong>Select Shop: </strong>

                        <select id="collect_id" name="fromcollectedwarehouse" class="form-control">

                            <option value="">Click and Collect System</option>

                            <t t-foreach = "warehouses" t-as = "atr_val">

                                <t t-set='address' t-value='atr_val.partner_id.name+atr_val.partner_id.street+atr_val.partner_id.city'/>

                                <option t-att-value="atr_val.id"><t t-esc='atr_val.name'/>&#160;<t t-esc='address'/></option>

                            </t>

                        </select>

                    </div>

                </span>

                    <br/>

                </t>

                 </form>

            </xpath>

           

        </template>
Controlller part:

 @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False)

    def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):

        import pdb;pdb.set_trace()

        """This is used to handle event of add to cart button redirect from detail page but only add fron shop page"""

        super(WebsiteSale, self).cart_update(product_id, add_qty, set_qty, **kw)



        if 'product_template_id' in kw and 'my_cart' in kw:

            return request.redirect("/shop")


        else:

            return request.redirect('/shop/cart')
data is not comes here in kw.
Thanks

Avatar
Discard