diff --git a/src/One2many.ts b/src/One2many.ts index c6feddc..ef318b8 100644 --- a/src/One2many.ts +++ b/src/One2many.ts @@ -76,6 +76,18 @@ class One2many extends Field { this._mustExpand = value; } + /** + * Height + */ + _height?: number; + get height(): number | undefined { + return this._height; + } + + set height(value: number) { + this._height = value; + } + constructor(props: any) { super(props); @@ -105,6 +117,14 @@ class One2many extends Field { if (props.inv_field) { this._inv_field = props.inv_field; } + + if (props.height) { + try { + this._height = parseInt(props.height); + } catch (e) { + this._height = undefined; + } + } } } } diff --git a/src/spec/Form.spec.ts b/src/spec/Form.spec.ts index 3838b2d..0a76ede 100644 --- a/src/spec/Form.spec.ts +++ b/src/spec/Form.spec.ts @@ -9,6 +9,7 @@ import Reference from "../Reference"; import Button from "../Button"; import ButtonGroup from "../ButtonGroup"; import { it, expect, describe } from "vitest"; +import One2many from "../One2many"; const XML_VIEW_FORM = `
`; + const form = new Form({ + formulari: { + type: "selection", + }, + o2m: { type: "one2many" }, + }); + form.parse(arch); + const o2mField = form.findById("o2m") as One2many; + expect(o2mField.height).toBe(50); + }); });