Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
185 Tampilan

I’m developing a custom POS module in Odoo 18 and could use some guidance. Each customer can have multiple codes, which are stored in a tab on the customer page. I want to create a dropdown in the POS that displays only the codes for the selected customer and allows me to save the selected code for the POS order. How is it possible?

Avatar
Buang

Hello Odoouser! Here’s how you can dynamically populate a dropdown in your POS module based on the selected customer in Odoo 18:



  First, define a new model to store the customer-specific codes. This model should have a many2one relationship with the res.partner model (customer) and a field to store the code.

  Next, in your POS module, create a new field in the pos.order model to store the selected code. This field should be a many2one relationship with your custom code model.

  Override the _prepare_pos_order_line_vals method in your POS module to include the selected code when creating the order line. This ensures the code is saved with the order.

  Create a new QWeb template to add the dropdown to the POS interface. Use JavaScript to dynamically update the dropdown options based on the selected customer. You can use an RPC call to fetch the codes for the selected customer from the server.

  Finally, ensure that the JavaScript code is correctly linked to the QWeb template and that the RPC call is correctly configured to fetch the data from your custom model.


For personalized assistance:
https://www.pragtech.co.in/contact-us-mql.html

Penulis

Thank you. I’m familiar with the general steps, but I would appreciate more detailed guidance.

Post Terkait Replies Tampilan Aktivitas
2
Sep 25
362
0
Agu 25
787
1
Apr 25
1119
1
Apr 25
1533
1
Jun 25
2423