Skip to Content
Menu
This question has been flagged
1 Reply
2570 Views

i want to add new button a product form or e-commerce product form (web front-end ) based on the condition

ex if a boolean filed is true on product form (back-end ) then should be button will be display for product form

********************xml file*********************

<template id="bid_inherit" inherit_id="website_sale.product">             

<data inherit_id="website_sale.product">                 

<xpath expr="//div[@class='js_product']/a" position="after">                     

<script type="text/javascript" src="/dex_car_dealer/static/src/js/serchauto.js"></script>                         

<div>                             

<form from="role" method="post" t-attf-action="/shop_bid">                                 

<div style="margin: 3% 58% 0 0;">                                     

<label><strong>Last Bid:</strong></label>                                         

<div>                                             

<label><strong>Amount:</strong></label>                                             

<input class="form-control small" placeholder="0.00" name="amount" value="" type="text"/>                                          </div>                                 

</div>                                 

<!--<a id="bid" class="btn btn-primary btn-lg mt8 js_check_product">Bid</a>-->                                                                    <input value="Bid" class="btn btn-info submit" type="submit"/>                             

</form>                                 

    </div>                 

</xpath>                               

</data>       

</template>


*************************main.py***************

@http.route([        '/shop_bid',    ], type='http', auth="public", website=True)   

def bid(self, **post):
        print "XXXXXXXXXXXXXAAAAAAAAAAa"               

bid = request.env['bid']      

 bid1 = bid.search([])                

amount = post.get('amount')       

request.env['bid'].create({'amount_auc':amount})               

values = {            'bid1':bid        }       

return request.redirect("dex_car_dealer.bid_inherit", values)


Avatar
Discard
Best Answer

Hi Apoorv Soral,

You can do this by using Qweb conditions.

Just refer the link for Qweb conditions:

https://www.odoo.com/documentation/11.0/reference/qweb.html

accept answer if helpful.

Thank you..


Avatar
Discard