Displaying offers when an account lacks credits
If you make an IAP service request after all of the purchased credits are consumed, then the service module will generate InsufficientCreditError
, and the client-side module will handle this error automatically and display a popup. Whenever all of your IAP account credit is consumed, Odoo will display a popup as in the following screenshot to prompt the purchase of more credit:
The default popup is too simple and does not provide enough information. In this recipe, we will look at how you can change the content of this popup with an attractive template.
Getting ready
We will be using the iap_isbn_service
module for this recipe. The offer template is created on the IAP service provider module, so it can be changed at any time without updating the client module.
How to do it...
Follow these steps to add a custom credit template:
-
...