Skip to main content
iVentureTeam

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.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 18, 2026Updated August 18, 20265 min read
Technical nameiap_buy_more_credits
Field typesnone (view widget)
Viewsform (settings pages and IAP-related dialogs)
Moduleiap, auto-installed with any in-app purchase service
Used in core7 occurrences across crm_iap_enrich, crm_iap_mine, partner_autocomplete, sms, snailmail_account, stock_sms
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupNo. Placed in view XML with a widget element; no Studio path
Alternativesdocumentation_link, web_ribbon, Plain button element

What the IAP credits widget does

Odoo's pay-per-use services, SMS, lead mining, partner autocomplete, snailmail, all bill against IAP credit accounts, and every one of their settings panels needs the same two links: one to the service's account where credits are bought, one to the list of all IAP services. Rather than duplicating buttons, core ships this widget in the iap module and reuses it seven times.

Because it is a view widget, it attaches to no field and carries no record data. The component reads two attributes: service_name, which it passes to a silent iap.account.get_account_id ORM call when the first button is clicked, then opens that account's form view; and hide_service, which suppresses the second button. The second button simply fires the iap.iap_account_action window action.

One template detail with real-world consequences: both buttons carry the o-hidden-ios class, so these purchase entry points do not render inside Odoo's iOS app, in line with Apple's in-app purchase rules.

What this means for your team

If you operate Odoo with SMS notifications, lead enrichment or document digitization, credits are a consumable your admins occasionally top up under time pressure, usually when messages stop sending. This widget is the door they walk through, so it is worth knowing two operational facts about it.

First, the button does not buy anything; it opens the right iap.account record, and the purchase flow starts there. If your users report "the buy button does nothing", the account lookup is the thing to debug, not a payment issue. Second, because the widget resolves the account by service name at click time, multi-company setups where IAP accounts differ per company behave correctly without any per-view configuration.

For custom modules that consume IAP services of your own, reusing this widget in your settings view gives users the exact pattern they already know from SMS settings, one attribute and zero custom JavaScript.

Supported options in Odoo 19

Verified against action_buttons_widget.js in the Odoo 19.0 iap module. The widget declares no supportedOptions and reads no options dict; its two knobs are XML attributes on the widget element, extracted in extractProps, and are listed below as such.

OptionTypeWhat it does
service_name (attribute)string, requiredTechnical 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 stringAny 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

Standard usage in a settings view

<widget name="iap_buy_more_credits"
        service_name="sms"/>

Renders both links for the SMS service account.

Credits link only

<widget name="iap_buy_more_credits"
        service_name="partner_autocomplete"
        hide_service="1"/>

Only Manage Service & Buy Credits renders; the services overview link is hidden, the pattern core uses inside focused dialogs.

What the buttons actually call

Reading the click handlers precisely prevents the two standard misdiagnoses.

The credits button is a lookup plus a navigation. It calls iap.account.get_account_id with the service name through the silent ORM (no error dialog on failure), then opens the returned id as a form view. Server-side, that method finds or creates the account for the current company; the widget itself has no idea whether credits exist, so it never shows balances.

The services button is a plain action. It executes the iap.iap_account_action window action, the same list you reach through Settings. Nothing about the current record is involved, which is consistent with the widget being a view widget: give it standardWidgetProps and it renders anywhere a form renders.

The name oversells it. No credit purchase happens in this component; naming aside, it is two navigation buttons with an account resolver. The purchase itself is handled by the IAP account form and Odoo's hosted flow from there.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. File byte-identical on the development branch. See below.
Odoo 19.0VerifiedVerified against the shipped source and template.
Odoo 18.0VerifiedIdentical behavior; file differs only by the module pragma.
Odoo 17.0VerifiedWidget present with the same attributes.
Odoo 16.0VerifiedWidget 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

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The development branch is unstable until release, and we re-verify this page against the shipped version.

For this widget the branch currently shows no change whatsoever: the 19.0 file is byte-identical on master, attributes, handlers, template reference and registration included. Custom views using it should carry into Odoo 20 without edits, subject to the usual re-verification when the release ships.

Common problems and fixes

SymptomCause and fix
Clicking Buy Credits appears to do nothingThe 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 missingThe 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 appBoth 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 viewservice_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 accountIt 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

WidgetBest forKey difference
iap_buy_more_creditsSettings panels of IAP-backed servicesResolves the right IAP account by service name at click time
documentation_linkLinking settings panels to docs pagesStatic external link, no ORM interaction
web_ribbonFlagging record state on formsDecorative view widget, no click behavior
Plain button elementOne-off actions in custom viewsA button with type=object needs no widget but re-implements the account lookup

The practical test: this widget is for IAP service accounts specifically. For linking to documentation from a settings page use the documentation link widget; for arbitrary buttons, a plain button element with an action is simpler than any widget.

Frequently asked questions

What does the iap_buy_more_credits widget do in Odoo?+
It renders up to two links in settings views of IAP-backed services: Manage Service & Buy Credits, which looks up the service's iap.account by the widget's service_name attribute and opens it, and View My Services, which opens the IAP accounts overview. The purchase itself happens on the account form, not in the widget.
How do I add a buy-credits link for my own IAP service?+
Place <widget name="iap_buy_more_credits" service_name="your_service"/> in your settings view, with the technical service name your IAP registration uses. Add hide_service="1" if you want only the credits link.
Why can't iOS users see the buy credits button?+
The template gives both buttons the o-hidden-ios class, so they are hidden inside Odoo's iOS app, which keeps external purchase links out of Apple's in-app purchase scope. Manage credits from a desktop browser instead.
Does the widget show the current credit balance?+
No. It has no data of its own and makes no calls until clicked. Balances live on the IAP account records the buttons open.
Is iap_buy_more_credits a field widget?+
No, it is registered in the view_widgets registry and used with the <widget> element, bound to no field. Its configuration surface is two XML attributes, service_name and hide_service; it accepts no options dictionary.
Which Odoo versions support this widget?+
16.0 through 19.0 with identical XML usage, and the Odoo 20 development branch currently carries the file unchanged. Only the internal registration style has evolved across versions, which affects JavaScript patches, not views.

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

How this page was produced

This page was verified by reading action_buttons_widget.js and its template action_buttons_widget.xml in the Odoo 19.0 iap module, including both click handlers and the extractProps mapping of the two attributes. Version stability was confirmed by listing and diffing the file across 16.0 through master. The Odoo 20 section reads the unreleased development branch and is marked as such. Corrections welcome via our contact page.