Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Request for Guidance on Migrating from POS UI API v15 to v16

by
Ing. Rolando Pérez Rebollo
- 23/01/2025 22:49:27

I am currently working on migrating a community addon from Odoo v15 to v16 and have encountered a challenge related to the updated POS API.

In v15, the addon interacts with the POS UI and defines custom models using Backbone.Model.extend, as shown here:

var MyCustomModel = Backbone.Model.extend({
    // Custom model logic
});

The goal is to create a new model at the same logic level as Order and Orderline, not to extend those models. While there are plenty of examples showing how to extend Order and Orderline, I have not found clear guidance on defining entirely new models at this level under the v16 API.

In addition, models like Order and Orderline in v15 extended PosModel, which was accessible. However, in v16, PosModel has been made private, and PosGlobalState doesn’t seem to provide the functionality needed for this type of model creation.

Could anyone provide guidance on:

  1. How to create a new model at the same logic level as Order and Orderline in the v16 POS API?
  2. Why was PosModel made private in v16, and is there an alternative for extending POS-related functionality?
  3. Are there updated patterns or best practices in v16 for integrating custom models into the POS framework?

I want to ensure that this approach aligns with the design philosophy of the v16 API and avoids anti-patterns. Your advice, examples, or references to relevant documentation would be greatly appreciated.

Thank you for your help!

Best regards,

\Rolando