How it works...

There is nothing new in this recipe. We just updated the receipt by using previous recipes. In step 1, we overrode the get_receipt_render_env() function to send more data to the receipt environment. We compared the product's base price with the product price in the receipt to calculate how much money the customer saved. We sent this data into the receipt environment via the saved_amount key. If you want to learn more about method overriding, refer to the Modifying existing business logic recipe.

In step 2, we modified the default QWeb template of the receipt. The template name of the actual receipt is PosTicket, so we used it as a value in the t-extend attribute. In step 1, we'd already sent the information needed to modify a receipt. In the QWeb template, we get the saved amount in the saved_amount key so we just added one more <div> element in the recipe at the end. This will print the saved amount in the receipt. If you want to learn more about overriding, refer to the Modifying the UI of the POS screens recipe.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset