Skip to content

Commit

Permalink
Merge pull request #71 from gisce/hotfix/bug_webclient#388
Browse files Browse the repository at this point in the history
Fix bug webclient#388
  • Loading branch information
mguellsegarra authored Nov 23, 2022
2 parents 4e3ca1a + 77a11ee commit 657020c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/ooui",
"version": "0.17.10",
"version": "0.17.11",
"main": "./dist/ooui.umd.js",
"module": "./dist/ooui.es.js",
"types": "./dist/index.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions src/Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ abstract class Widget {
if (props.context) {
this._context = props.context;
}
if (props.domain && typeof props.domain === "string") {
this._domain = props.domain;
if (props.domain) {
if (typeof props.domain !== "string") {
this._domain = JSON.stringify(props.domain);
} else {
this._domain = props.domain;
}
}
if (props.widget_props) {
try {
Expand Down
17 changes: 17 additions & 0 deletions src/spec/Form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3137,4 +3137,21 @@ describe("A Form", () => {
const field = form.findById("bank") as Field;
expect(field.readOnly).toBeFalsy();
});
it("Should be able to parse domain in array format", () => {
const arch = `<form>
<field name="bank" />
</form>`;
const fields = {
bank: {
type: "many2one",
domain: [["category_id.name", "=", "ALQ ELEC"]],
},
};
const form = new Form(fields);
form.parse(arch, {
values: {},
});
const field = form.findById("bank") as Field;
expect(field.domain).toBeDefined();
});
});

0 comments on commit 657020c

Please sign in to comment.