Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1614 มุมมอง

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")
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Get data from JS file to XML file แก้ไขแล้ว
1
ส.ค. 20
8762
2
มิ.ย. 20
3769
2
ก.ค. 24
988
2
มิ.ย. 23
41928
1
ธ.ค. 22
3045