İçereği Atla
Menü
Bu soru işaretlendi

I created a drop down menu inside odoo website module's checkout page (/shop/cart, code shown below), how can I fetch the user's selection and save it to a field inside my model? Current using latest version of Odoo 16


XML:

If the XML is empty/looks weird... its because the forum keep eating my code away...

(edit: I posted this question on stackoverflow as well, and I cant post link so Ima just put the title of the question here: "How to Fetch User Selection in Drop Down Selection in Odoo Website Module")


My attempt on JS:

$('#some123').on('change', 'select.some1', function(e) {

e.preventDefault();

var value = $( ".some1" ).val();

var ID = $( ".temp" ).val();

});


My attempt on controller (inherited cart_update_json method in WebsiteSale class):

value = kw.get('value')
current_line = kw.get('ID')
record = request.env['sale.order.line'].sudo().search([('product_id', '=', current_line)])
if record:
record.write({'some_field': value})
else:
print("Test")
Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ağu 20
9177
2
Haz 20
4224
2
Tem 24
1415
2
Haz 23
42675
1
Ara 22
3463