Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
166 Tampilan

Hello everyone 👋


I'm currently working on **Odoo 18 POS** and added a custom field `serial_id` to `pos.order.line` (Many2one to `product.serial`). 

The field works fine in the frontend — I can assign a serial to a line using a popup, and the line correctly holds:

```js

line.serial_id = 2;

line.serial_display = "iphone 13 - new new";


However, when the order is validated and synced to the backend, the field is missing in the synced JSON data.

The order lines in the backend always show:

"serial_id": false



I tried adding the field in several methods:

  • export_as_JSON() → not called anymore
  • serialize() in PosOrderline → didn’t include the field in sync_from_ui
  • _order_line_fields() on the backend → never receives the serial_id

So my question is:

🧩 What is the correct method in Odoo 18 POS to include a custom field (like serial_id) from order lines in the synced JSON sent by sync_from_ui?

I believe the new serialization logic may require patching serialize_for_order() or adding the field in another place, but I’d like confirmation from the Odoo team or others who have handled custom POS fields in v18.

Thanks in advance 🙏

Avatar
Buang
Jawaban Terbai

241 / 5.000

You need to extend the original `Orderline` class in the POS interface and patch this method to include your custom field. The solution is Frontend (JavaScript).

Avatar
Buang

Note: You do NOT need to patch the export_as_JSON method in Odoo 18/17 for this purpose.
https://leveldevil-game.io/

Post Terkait Replies Tampilan Aktivitas
2
Sep 25
2972
1
Agu 25
2382
1
Agu 25
1326
0
Jul 25
1323
0
Jul 25
1814