Skip to Content
Menu
This question has been flagged
2 Replies
8072 Views

Hello all,

 Now I want to show many2one field in the website to send backed data.How should I do?Please Kindly guide to me.Your help is highly appreciating.Thanks

Avatar
Discard
Best Answer
Try this
<div class="form-group form-field o_website_form_required_custom">
<div class="col-md-12" style="margin-bottom:10px;">
<label class="col-md-offset-1 col-md-1 col-sm-4 control-label" style="padding-top: 8px;" for="search">CHAIR*</label>
<div class="col-md-5 col-sm-8">
<select id="chair" required="True" class="form-control" style="width: 432px; height: 35px;">
<t t-foreach="chair_details" t-as="chair">
<option t-att-value="chair.id" t-esc="chair.name"/></t>
</select>
</div>
<div class="col-md-5" style="padding-left:0px !important;">
<p style="font-size: 16px;padding-top: 9px;">( Select the chair that free in the preferred time )</p>
</div>
</div>
</div>
Avatar
Discard
Author

thanks Imran, It's work fine.

You are Most Welcome

Best Answer

Hello Muhammad i need help here, i had added a many2one field ('stock.warehouse') to website sale ( payment phase ) , but i still could not get the selected value by the user.


this is my code:

----> python

def _get_shop_payment_values(self, order, **kwargs):
sup = super(WebsiteEcommerce, self)._get_shop_payment_values(order)
company_id = request.env.user.company_id
sup['jours'] = 'jours'
sup['livraison_domicile'] = company_id.livraison_domicile
sup['livraison_collect'] = company_id.livraison_collect
   sup['warehouses']=request.env['stock.warehouse'].sudo().search([])

return sup

----> xml:

       <div class="form-group" attrs="{'inivisible':[('type_livraison','=','domicile')]}">
    <label for="warehouse" class="control-label">Magasin</label>
<div class="col-md-5 col-sm-8">
<select id="magasin" required="True" class="form-control" name="magasin"
style="width: 432px; height: 35px;">
<t t-foreach="warehouses" t-as="warehouse">
<option t-att-value="warehouse.id" t-esc="warehouse.name"/>
</t>
</select>
</div>
</div>

getting the selected value

    @http.route(['/shop/confirmation'], type='http', auth="public", website=True, sitemap=False)

def payment_confirmation(self, **post):
print('post',**post)
order = request.website.sale_get_order(force_create=1)
print('current order', order)
values = {key: post.get(key) for key in ('magasin')}
print("VALLLLLLL", values)

# print(post.get('livraison_domicile'))
return super(WebsiteEcommerce, self).payment_confirmation()


but this still not working , i appreciate your help.
Avatar
Discard
Related Posts Replies Views Activity
1
Jul 24
3804
3
Aug 22
17681
1
Mar 22
2422
0
Jan 21
994
0
May 20
2894