[FIX] web: compile a button with id
Before this commit, button ids (if any) were absent from the templates generated by a view compiler. Part-of: odoo/odoo#95413
This commit is contained in:
@@ -113,6 +113,7 @@ export class ViewButton extends Component {
|
||||
}
|
||||
ViewButton.template = "views.ViewButton";
|
||||
ViewButton.props = [
|
||||
"id?",
|
||||
"tag?",
|
||||
"record?",
|
||||
"className?",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<t t-name="views.ViewButton" owl="1">
|
||||
<t t-tag="props.tag"
|
||||
t-att-id="props.id"
|
||||
t-att-class="getClassName()"
|
||||
t-att-disabled="disabled"
|
||||
t-att-name="props.clickParams.name"
|
||||
|
||||
@@ -34,7 +34,7 @@ const BUTTON_CLICK_PARAMS = [
|
||||
// just override compileButton in kanban compiler to add the debounce?
|
||||
"debounce",
|
||||
];
|
||||
const BUTTON_STRING_PROPS = ["string", "size", "title", "icon"];
|
||||
const BUTTON_STRING_PROPS = ["string", "size", "title", "icon", "id"];
|
||||
const INTERP_REGEXP = /(\{\{|#\{)(.*?)(\}{1,2})/g;
|
||||
|
||||
/**
|
||||
|
||||
@@ -271,4 +271,24 @@ QUnit.module("Form Renderer", (hooks) => {
|
||||
resId: 1,
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("compile a button with id", async (assert) => {
|
||||
serverData.views = {
|
||||
"partner,1,form": /*xml*/ `
|
||||
<form>
|
||||
<header>
|
||||
<button id="action_button" string="ActionButton"/>
|
||||
</header>
|
||||
</form>`,
|
||||
};
|
||||
|
||||
await makeView({
|
||||
serverData,
|
||||
resModel: "partner",
|
||||
type: "form",
|
||||
resId: 1,
|
||||
});
|
||||
|
||||
assert.containsOnce(target, "button[id=action_button]");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user