diff --git a/package-lock.json b/package-lock.json index 13e7e3f..25529e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gisce/ooui", - "version": "0.17.10", + "version": "0.17.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@gisce/ooui", - "version": "0.17.10", + "version": "0.17.11", "dependencies": { "html-entities": "^2.3.3", "moment": "^2.29.3" diff --git a/package.json b/package.json index 46f122c..c4f7792 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Widget.ts b/src/Widget.ts index 616f334..5d11c26 100644 --- a/src/Widget.ts +++ b/src/Widget.ts @@ -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 { diff --git a/src/spec/Form.spec.ts b/src/spec/Form.spec.ts index e5de8b4..f851510 100644 --- a/src/spec/Form.spec.ts +++ b/src/spec/Form.spec.ts @@ -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 = `
`; + 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(); + }); });