CopyClipboardButton
Of Odoo's three clipboard widgets, CopyClipboardButton is the only one that hides the value: just a button that puts the field's content on the clipboard, and nothing at all when the field is empty.
| Technical name | CopyClipboardButton |
|---|---|
| Field types | char, text |
| Views | form, list |
| Module | web, present in every Odoo database |
| Used in core | 3 occurrences across 2 modules: website_sale product feed views and website_event |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. Applied via the widget attribute in view XML |
| Alternatives | CopyClipboardChar, CopyClipboardURL, url |
What the Copy button does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
btn_class | string | Bootstrap button flavor slotted into btn-{value}. New in Odoo 19; 18 hardcoded btn-primary. Any Bootstrap suffix works, including outline and link styles.(default: primary)(since Odoo 19.0) |
The label and the disable rule are attributes, not options. string="Copy URL" sets the button text and disabled="state != 'done'" takes a Python expression evaluated against the record, including virtual ids. Only btn_class goes inside options="{...}". The disabled attribute is parsed for all three clipboard widgets but only this Button variant's template consumes it, a quirk confirmed in the source.
Working examples
What the source guarantees, and what it does not
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Button variant unchanged on the development branch; sibling widgets get icon and styling changes. |
| Odoo 19.0 | Verified | Verified against the shipped source. btn_class option introduced. |
| Odoo 18.0 | Partial / changed | Same behavior with btn-primary hardcoded; no btn_class option. |
| Odoo 17.0 | Partial / changed | string and disabled attributes present, but the button has no primary styling and no btn_class. |
| Odoo 16.0 | Partial / changed | Widget exists in the legacy implementation; no string, disabled, or styling configuration. |
Upgrade note. XML written for 16 keeps working through 19, but styling drifted: 17 rendered a bare rounded button, 18 hardcoded btn-primary, and 19 made the flavor configurable with btn_class. A pre-19 view that relied on the default look may need btn_class set after migrating to keep visual consistency. The string and disabled attributes exist since 17; 16 had neither.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The button does not appear at all | The field is empty; the template renders nothing without a value. Ensure the field is set, or display a conditional placeholder while it is empty. |
| Clicking the button copies nothing | The clipboard API requires a secure context, so plain HTTP deployments fail silently. Serve Odoo over HTTPS; on localhost it works without certificates. |
| Widget not found, field renders as plain text | The registry name is case-sensitive CamelCase. Write widget="CopyClipboardButton" exactly. |
| btn_class has no effect after copying a view from Odoo 19 to 18 | The option is 19-new; 18 hardcodes btn-primary. Drop the option on 18 or restyle via CSS on the o_btn_char_copy class. |
| disabled option inside options dict is ignored | disabled is a view attribute carrying a Python expression, not an option. Write disabled="expression" directly on the field element. |
| Copied value differs from what a link shows on screen | The button copies the raw stored value with no formatting or prefixing. Store the exact string users should receive, or use CopyClipboardURL to show what will be copied. |
Copy button vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
CopyClipboardButton | Copying long or sensitive values without displaying them | Button only; the value never renders and empty fields show nothing |
| CopyClipboardChar | Short codes users read and copy | Shows the value with an attached copy control |
| CopyClipboardURL | Links users may click or copy | Renders the value as a link; copies the raw stored string |
| url | Plain clickable links | No copy affordance at all |
Frequently asked questions
How is CopyClipboardButton different from CopyClipboardChar and CopyClipboardURL?+
How do I change the button's label?+
Can I disable the button conditionally?+
Why does the copy do nothing on our test server?+
What styles can btn_class take?+
Does the widget hash or protect the value since it is hidden?+
Feeds, keys, and webhooks piling up in your Odoo?
Copy buttons usually appear where Odoo meets another system: product feeds, portals, integrations. We build those integrations properly, from generated URLs and API keys to the sync jobs behind them, on Odoo 16 through 19.
Book a free consultation