Modifying existing business logic
In the previous recipes, we saw how to fetch data through an RPC and how to modify the UI of the Point of Sale application. In this recipe, we will see how you can modify or extend the existing business logic.
Getting ready
In this recipe, we will use the point_of_sale_customization
module created in the Modifying the Point of Sale screen UI recipe, which is where we fetched the purchase price of a product and displayed the product margin. Now, in this recipe, we will show a warning to the user if they sell the product below the product margin.
How to do it…
Most of the business logic of the Point of Sale application is written in JavaScript, so we just need to make changes to it to achieve the goal of this recipe. Add the following code to /static/src/js/point_of_sale_customization.js
to show a warning when the user sells a product below the purchase price:
/** @odoo-module */ import { ErrorPopup } from "@point_of_sale/app...