iap_buy_more_credits
The Buy Credits links under Odoo's SMS, lead enrichment and snailmail settings are one reusable view widget: iap_buy_more_credits, driven entirely by two attributes.
| Technical name | iap_buy_more_credits |
|---|---|
| Field types | none (view widget) |
| Views | form (settings pages and IAP-related dialogs) |
| Module | iap, auto-installed with any in-app purchase service |
| Used in core | 7 occurrences across crm_iap_enrich, crm_iap_mine, partner_autocomplete, sms, snailmail_account, stock_sms |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. Placed in view XML with a widget element; no Studio path |
| Alternatives | documentation_link, web_ribbon, Plain button element |
What the IAP credits widget does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
service_name (attribute) | string, required | Technical name of the IAP service, e.g. sms or partner_autocomplete. Passed to iap.account.get_account_id when the credits button is clicked; the returned account opens in a form view. |
hide_service (attribute) | boolean-ish string | Any truthy value hides the View My Services button, leaving only Manage Service & Buy Credits. Extracted as the negation showServiceButtons in the source. |
Attributes, not options. Write them directly on the <widget> element, not inside an options dictionary. service_name is required by the component's props; omitting it breaks the render.
Working examples
What the buttons actually call
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. File byte-identical on the development branch. See below. |
| Odoo 19.0 | Verified | Verified against the shipped source and template. |
| Odoo 18.0 | Verified | Identical behavior; file differs only by the module pragma. |
| Odoo 17.0 | Verified | Widget present with the same attributes. |
| Odoo 16.0 | Verified | Widget present; registered directly as a component class in the pre-descriptor style. |
Upgrade note. The widget name and attributes are stable from 16.0 through 19.0; XML carries over untouched. Only the registration style modernized over the years (component class in 16, descriptor object later), which matters solely to JavaScript patches.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Clicking Buy Credits appears to do nothing | The silent ORM lookup failed (access rights on iap.account, or an invalid service_name), and silent calls suppress the error dialog. Check the browser console and server log; verify the service_name matches the IAP service's technical name. |
| The View My Services button is missing | The view sets hide_service, or the user lacks access to the IAP account action. Remove the hide_service attribute if the overview link is wanted. |
| The buttons do not appear in the iOS app | Both buttons carry the o-hidden-ios class in the template. By design, matching Apple's in-app purchase rules; manage credits from a browser instead. |
| Widget errors about missing props on a custom view | service_name is a required prop; the widget element omits the attribute. Add service_name="your_service" to the widget element. |
| Button opens the wrong company's account | It cannot; the account resolves server-side per company at click time. What looks wrong is usually the active company in the company switcher. Switch the active company and click again. |
IAP credits widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
iap_buy_more_credits | Settings panels of IAP-backed services | Resolves the right IAP account by service name at click time |
| documentation_link | Linking settings panels to docs pages | Static external link, no ORM interaction |
| web_ribbon | Flagging record state on forms | Decorative view widget, no click behavior |
Plain button element | One-off actions in custom views | A button with type=object needs no widget but re-implements the account lookup |
Frequently asked questions
What does the iap_buy_more_credits widget do in Odoo?+
How do I add a buy-credits link for my own IAP service?+
Why can't iOS users see the buy credits button?+
Does the widget show the current credit balance?+
Is iap_buy_more_credits a field widget?+
Which Odoo versions support this widget?+
SMS stopped sending and nobody knew credits ran dry?
IAP services fail quietly when accounts hit zero. We wire monitoring around Odoo's credit balances, integrate the services your flows depend on, and build custom IAP consumers with the same settings UX core uses.
Book a free consultation