@gisce/ooui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +10 -0
  2. package/dist/Binary.d.ts +14 -0
  3. package/dist/Binary.js +46 -0
  4. package/dist/Binary.js.map +1 -0
  5. package/dist/Boolean.d.ts +8 -0
  6. package/dist/Boolean.js +26 -0
  7. package/dist/Boolean.js.map +1 -0
  8. package/dist/Button.d.ts +29 -0
  9. package/dist/Button.js +108 -0
  10. package/dist/Button.js.map +1 -0
  11. package/dist/Char.d.ts +26 -0
  12. package/dist/Char.js +89 -0
  13. package/dist/Char.js.map +1 -0
  14. package/dist/Container.d.ts +44 -0
  15. package/dist/Container.js +148 -0
  16. package/dist/Container.js.map +1 -0
  17. package/dist/ContainerWidget.d.ts +42 -0
  18. package/dist/ContainerWidget.js +125 -0
  19. package/dist/ContainerWidget.js.map +1 -0
  20. package/dist/Date.d.ts +8 -0
  21. package/dist/Date.js +26 -0
  22. package/dist/Date.js.map +1 -0
  23. package/dist/DateTime.d.ts +8 -0
  24. package/dist/DateTime.js +26 -0
  25. package/dist/DateTime.js.map +1 -0
  26. package/dist/FiberGrid.d.ts +5 -0
  27. package/dist/FiberGrid.js +23 -0
  28. package/dist/FiberGrid.js.map +1 -0
  29. package/dist/Field.d.ts +59 -0
  30. package/dist/Field.js +162 -0
  31. package/dist/Field.js.map +1 -0
  32. package/dist/Float.d.ts +24 -0
  33. package/dist/Float.js +64 -0
  34. package/dist/Float.js.map +1 -0
  35. package/dist/FloatTime.d.ts +7 -0
  36. package/dist/FloatTime.js +26 -0
  37. package/dist/FloatTime.js.map +1 -0
  38. package/dist/Form.d.ts +53 -0
  39. package/dist/Form.js +199 -0
  40. package/dist/Form.js.map +1 -0
  41. package/dist/Group.d.ts +5 -0
  42. package/dist/Group.js +23 -0
  43. package/dist/Group.js.map +1 -0
  44. package/dist/Image.d.ts +7 -0
  45. package/dist/Image.js +26 -0
  46. package/dist/Image.js.map +1 -0
  47. package/dist/Integer.d.ts +8 -0
  48. package/dist/Integer.js +26 -0
  49. package/dist/Integer.js.map +1 -0
  50. package/dist/Label.d.ts +23 -0
  51. package/dist/Label.js +80 -0
  52. package/dist/Label.js.map +1 -0
  53. package/dist/Many2many.d.ts +26 -0
  54. package/dist/Many2many.js +80 -0
  55. package/dist/Many2many.js.map +1 -0
  56. package/dist/Many2one.d.ts +20 -0
  57. package/dist/Many2one.js +63 -0
  58. package/dist/Many2one.js.map +1 -0
  59. package/dist/NewLine.d.ts +5 -0
  60. package/dist/NewLine.js +26 -0
  61. package/dist/NewLine.js.map +1 -0
  62. package/dist/Notebook.d.ts +8 -0
  63. package/dist/Notebook.js +41 -0
  64. package/dist/Notebook.js.map +1 -0
  65. package/dist/One2many.d.ts +44 -0
  66. package/dist/One2many.js +130 -0
  67. package/dist/One2many.js.map +1 -0
  68. package/dist/Page.d.ts +5 -0
  69. package/dist/Page.js +23 -0
  70. package/dist/Page.js.map +1 -0
  71. package/dist/ProgressBar.d.ts +7 -0
  72. package/dist/ProgressBar.js +26 -0
  73. package/dist/ProgressBar.js.map +1 -0
  74. package/dist/Reference.d.ts +7 -0
  75. package/dist/Reference.js +26 -0
  76. package/dist/Reference.js.map +1 -0
  77. package/dist/SearchFilter.d.ts +28 -0
  78. package/dist/SearchFilter.js +81 -0
  79. package/dist/SearchFilter.js.map +1 -0
  80. package/dist/Selection.d.ts +20 -0
  81. package/dist/Selection.js +63 -0
  82. package/dist/Selection.js.map +1 -0
  83. package/dist/Separator.d.ts +12 -0
  84. package/dist/Separator.js +46 -0
  85. package/dist/Separator.js.map +1 -0
  86. package/dist/Text.d.ts +29 -0
  87. package/dist/Text.js +96 -0
  88. package/dist/Text.js.map +1 -0
  89. package/dist/Timeline.d.ts +17 -0
  90. package/dist/Timeline.js +56 -0
  91. package/dist/Timeline.js.map +1 -0
  92. package/dist/Tree.d.ts +31 -0
  93. package/dist/Tree.js +96 -0
  94. package/dist/Tree.js.map +1 -0
  95. package/dist/Widget.d.ts +47 -0
  96. package/dist/Widget.js +116 -0
  97. package/dist/Widget.js.map +1 -0
  98. package/dist/WidgetFactory.d.ts +9 -0
  99. package/dist/WidgetFactory.js +157 -0
  100. package/dist/WidgetFactory.js.map +1 -0
  101. package/dist/helpers/attributeParser.d.ts +6 -0
  102. package/dist/helpers/attributeParser.js +83 -0
  103. package/dist/helpers/attributeParser.js.map +1 -0
  104. package/dist/helpers/contextParser.d.ts +5 -0
  105. package/dist/helpers/contextParser.js +52 -0
  106. package/dist/helpers/contextParser.js.map +1 -0
  107. package/dist/helpers/domainParser.d.ts +5 -0
  108. package/dist/helpers/domainParser.js +26 -0
  109. package/dist/helpers/domainParser.js.map +1 -0
  110. package/dist/helpers/fieldParser.d.ts +5 -0
  111. package/dist/helpers/fieldParser.js +20 -0
  112. package/dist/helpers/fieldParser.js.map +1 -0
  113. package/dist/helpers/nodeParser.d.ts +7 -0
  114. package/dist/helpers/nodeParser.js +50 -0
  115. package/dist/helpers/nodeParser.js.map +1 -0
  116. package/dist/helpers/onChangeParser.d.ts +5 -0
  117. package/dist/helpers/onChangeParser.js +16 -0
  118. package/dist/helpers/onChangeParser.js.map +1 -0
  119. package/dist/helpers/stateParser.d.ts +14 -0
  120. package/dist/helpers/stateParser.js +46 -0
  121. package/dist/helpers/stateParser.js.map +1 -0
  122. package/dist/index.d.ts +33 -0
  123. package/dist/index.js +34 -0
  124. package/dist/index.js.map +1 -0
  125. package/package.json +49 -0
  126. package/src/Binary.ts +29 -0
  127. package/src/Boolean.ts +12 -0
  128. package/src/Button.ts +78 -0
  129. package/src/Char.ts +65 -0
  130. package/src/Container.ts +171 -0
  131. package/src/ContainerWidget.ts +105 -0
  132. package/src/Date.ts +12 -0
  133. package/src/DateTime.ts +12 -0
  134. package/src/FiberGrid.ts +9 -0
  135. package/src/Field.ts +147 -0
  136. package/src/Float.ts +45 -0
  137. package/src/FloatTime.ts +8 -0
  138. package/src/Form.ts +212 -0
  139. package/src/Group.ts +9 -0
  140. package/src/Image.ts +8 -0
  141. package/src/Integer.ts +13 -0
  142. package/src/Label.ts +46 -0
  143. package/src/Many2many.ts +59 -0
  144. package/src/Many2one.ts +44 -0
  145. package/src/NewLine.ts +9 -0
  146. package/src/Notebook.ts +24 -0
  147. package/src/One2many.ts +106 -0
  148. package/src/Page.ts +9 -0
  149. package/src/ProgressBar.ts +8 -0
  150. package/src/Reference.ts +10 -0
  151. package/src/SearchFilter.ts +81 -0
  152. package/src/Selection.ts +44 -0
  153. package/src/Separator.ts +30 -0
  154. package/src/Text.ts +76 -0
  155. package/src/Timeline.ts +44 -0
  156. package/src/Tree.ts +93 -0
  157. package/src/Widget.ts +121 -0
  158. package/src/WidgetFactory.ts +158 -0
  159. package/src/helpers/attributeParser.ts +108 -0
  160. package/src/helpers/contextParser.ts +66 -0
  161. package/src/helpers/domainParser.ts +39 -0
  162. package/src/helpers/fieldParser.ts +27 -0
  163. package/src/helpers/nodeParser.ts +57 -0
  164. package/src/helpers/onChangeParser.ts +18 -0
  165. package/src/helpers/stateParser.ts +62 -0
  166. package/src/index.ts +67 -0
  167. package/src/spec/Boolean.spec.ts +36 -0
  168. package/src/spec/Button.spec.ts +58 -0
  169. package/src/spec/Char.spec.ts +80 -0
  170. package/src/spec/Container.spec.ts +47 -0
  171. package/src/spec/ContainerWidget.spec.ts +35 -0
  172. package/src/spec/Date.spec.ts +36 -0
  173. package/src/spec/DateTime.spec.ts +36 -0
  174. package/src/spec/Float.spec.ts +29 -0
  175. package/src/spec/Form.spec.ts +976 -0
  176. package/src/spec/Group.spec.ts +32 -0
  177. package/src/spec/Label.spec.ts +46 -0
  178. package/src/spec/Many2many.spec.ts +36 -0
  179. package/src/spec/Many2one.spec.ts +36 -0
  180. package/src/spec/One2many.spec.ts +354 -0
  181. package/src/spec/SearchFilter.spec.ts +955 -0
  182. package/src/spec/Selection.spec.ts +52 -0
  183. package/src/spec/Separator.spec.ts +14 -0
  184. package/src/spec/Tree.spec.ts +214 -0
  185. package/src/spec/Widget.spec.ts +45 -0
  186. package/src/spec/WidgetFactory.spec.ts +40 -0
  187. package/src/spec/attributeParser.spec.ts +173 -0
  188. package/src/spec/contextParser.spec.ts +57 -0
  189. package/src/spec/domainParser.spec.ts +40 -0
  190. package/src/spec/fixtures/WidgetImpl.ts +10 -0
  191. package/src/spec/stateParser.spec.ts +161 -0
@@ -0,0 +1,32 @@
1
+ import Group from "../Group";
2
+ import WidgetImpl from "./fixtures/WidgetImpl";
3
+
4
+ describe("A Group", () => {
5
+ it("should be constructed with 4 columns and a colspan of 4", () => {
6
+ const group4 = new Group({ col: 4, colspan: 4 });
7
+ expect(group4.colspan).toBe(4);
8
+ expect(group4.container.columns).toBe(4);
9
+ });
10
+ it("should be constructed with 6 columns and a colspan of 2", () => {
11
+ const group4 = new Group({ col: 6, colspan: 2 });
12
+ expect(group4.colspan).toBe(2);
13
+ expect(group4.container.columns).toBe(6);
14
+ });
15
+ it("should have 1 rows if 4 items", () => {
16
+ const group4 = new Group({ col: 4, colspan: 4 });
17
+ group4.container.addWidget(new WidgetImpl({ name: "1" }));
18
+ group4.container.addWidget(new WidgetImpl({ name: "2" }));
19
+ group4.container.addWidget(new WidgetImpl({ name: "3" }));
20
+ group4.container.addWidget(new WidgetImpl({ name: "4" }));
21
+ expect(group4.container.rows.length).toBe(1);
22
+ });
23
+ it("should have 2 rows if 5 items", () => {
24
+ const group4 = new Group({ col: 4, colspan: 4 });
25
+ group4.container.addWidget(new WidgetImpl({ name: "1" }));
26
+ group4.container.addWidget(new WidgetImpl({ name: "2" }));
27
+ group4.container.addWidget(new WidgetImpl({ name: "3" }));
28
+ group4.container.addWidget(new WidgetImpl({ name: "4" }));
29
+ group4.container.addWidget(new WidgetImpl({ name: "5" }));
30
+ expect(group4.container.rows.length).toBe(2);
31
+ });
32
+ });
@@ -0,0 +1,46 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+
3
+ describe("A Label", () => {
4
+ it("should have an id corresponding to field name", () => {
5
+ const widgetFactory = new WidgetFactory();
6
+ const props = {
7
+ name: "label",
8
+ };
9
+
10
+ const widget = widgetFactory.createWidget("label", props);
11
+
12
+ expect(widget.id).toBe("label");
13
+ });
14
+
15
+ it("should properly set label", () => {
16
+ const widgetFactory = new WidgetFactory();
17
+ const props = {
18
+ name: "label",
19
+ string: "label caption",
20
+ };
21
+ const widget = widgetFactory.createWidget("label", props);
22
+
23
+ expect(widget.label).toBe("label caption");
24
+ });
25
+
26
+ it("should have fieldForLabel null by default", () => {
27
+ const widgetFactory = new WidgetFactory();
28
+ const props = {
29
+ name: "label",
30
+ string: "label caption",
31
+ };
32
+ const widget = widgetFactory.createWidget("label", props);
33
+ expect(widget.fieldForLabel).toBeNull();
34
+ });
35
+
36
+ it("should properly parse fieldForLabel prop", () => {
37
+ const widgetFactory = new WidgetFactory();
38
+ const props = {
39
+ name: "field_label",
40
+ string: "label caption",
41
+ fieldForLabel: "field",
42
+ };
43
+ const widget = widgetFactory.createWidget("label", props);
44
+ expect(widget.fieldForLabel).toBe("field");
45
+ });
46
+ });
@@ -0,0 +1,36 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+
3
+ describe("A many2many", () => {
4
+ it("should have an id corresponding to field name", () => {
5
+ const widgetFactory = new WidgetFactory();
6
+ const props = {
7
+ name: "many2many1",
8
+ };
9
+
10
+ const widget = widgetFactory.createWidget("many2many", props);
11
+
12
+ expect(widget.id).toBe("many2many1");
13
+ });
14
+
15
+ it("should properly set label", () => {
16
+ const widgetFactory = new WidgetFactory();
17
+ const props = {
18
+ name: "many2many1",
19
+ string: "Country",
20
+ };
21
+ const widget = widgetFactory.createWidget("many2many", props);
22
+
23
+ expect(widget.label).toBe("Country");
24
+ });
25
+
26
+ it("should properly set relation", () => {
27
+ const widgetFactory = new WidgetFactory();
28
+ const props = {
29
+ name: "many2many1",
30
+ relation: "res.country",
31
+ };
32
+ const widget = widgetFactory.createWidget("many2many", props);
33
+
34
+ expect(widget.relation).toBe("res.country");
35
+ });
36
+ });
@@ -0,0 +1,36 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+
3
+ describe("A Many2one", () => {
4
+ it("should have an id corresponding to field name", () => {
5
+ const widgetFactory = new WidgetFactory();
6
+ const props = {
7
+ name: "many2one1",
8
+ };
9
+
10
+ const widget = widgetFactory.createWidget("many2one", props);
11
+
12
+ expect(widget.id).toBe("many2one1");
13
+ });
14
+
15
+ it("should properly set label", () => {
16
+ const widgetFactory = new WidgetFactory();
17
+ const props = {
18
+ name: "many2one1",
19
+ string: "Country",
20
+ };
21
+ const widget = widgetFactory.createWidget("many2one", props);
22
+
23
+ expect(widget.label).toBe("Country");
24
+ });
25
+
26
+ it("should properly set relation", () => {
27
+ const widgetFactory = new WidgetFactory();
28
+ const props = {
29
+ name: "many2one1",
30
+ relation: "res.country",
31
+ };
32
+ const widget = widgetFactory.createWidget("many2one", props);
33
+
34
+ expect(widget.relation).toBe("res.country");
35
+ });
36
+ });
@@ -0,0 +1,354 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+
3
+ describe("A One2many", () => {
4
+ it("should have an id corresponding to field name", () => {
5
+ const widgetFactory = new WidgetFactory();
6
+ const props = {
7
+ name: "one2many1",
8
+ };
9
+
10
+ const widget = widgetFactory.createWidget("one2many", props);
11
+
12
+ expect(widget.id).toBe("one2many1");
13
+ });
14
+
15
+ it("should properly set label", () => {
16
+ const widgetFactory = new WidgetFactory();
17
+ const props = {
18
+ name: "one2many1",
19
+ string: "Country",
20
+ };
21
+ const widget = widgetFactory.createWidget("one2many", props);
22
+
23
+ expect(widget.label).toBe("Country");
24
+ });
25
+
26
+ it("should properly set relation", () => {
27
+ const widgetFactory = new WidgetFactory();
28
+ const props = {
29
+ name: "one2many1",
30
+ relation: "res.country",
31
+ };
32
+ const widget = widgetFactory.createWidget("one2many", props);
33
+
34
+ expect(widget.relation).toBe("res.country");
35
+ });
36
+
37
+ it("should properly set mode field for tree and form", () => {
38
+ const widgetFactory = new WidgetFactory();
39
+ const props = {
40
+ name: "one2many1",
41
+ relation: "res.country",
42
+ mode: "form,tree",
43
+ };
44
+
45
+ const widget = widgetFactory.createWidget("one2many", props);
46
+
47
+ expect(widget.mode).toBeTruthy();
48
+ expect(Array.isArray(widget.mode)).toBeTruthy();
49
+ expect(widget.mode.length).toBe(2);
50
+ expect(widget.mode.indexOf('form')).not.toBe(-1);
51
+ expect(widget.mode.indexOf('tree')).not.toBe(-1);
52
+ });
53
+
54
+ it("should properly set mode field for tree", () => {
55
+ const widgetFactory = new WidgetFactory();
56
+ const props = {
57
+ name: "one2many1",
58
+ relation: "res.country",
59
+ mode: "tree",
60
+ };
61
+
62
+ const widget = widgetFactory.createWidget("one2many", props);
63
+
64
+ expect(widget.mode).toBeTruthy();
65
+ expect(Array.isArray(widget.mode)).toBeTruthy();
66
+ expect(widget.mode.length).toBe(1);
67
+ expect(widget.mode.indexOf('tree')).not.toBe(-1);
68
+ });
69
+
70
+ it("should properly set views field", () => {
71
+ const widgetFactory = new WidgetFactory();
72
+ const props = {
73
+ name: "one2many1",
74
+ relation: "res.country",
75
+ mode: "form,tree",
76
+ views: {
77
+ form: {
78
+ arch:
79
+ '<form string="Partner Contacts">\n <notebook>\n <page string="General">\n <field name="name" select="2" required="True"/>\n <field domain="[(\'domain\', \'=\', \'contact\')]" name="title" string="Type"/>\n <field name="function"/>\n <field name="type" select="2"/>\n <separator string="Street" colspan="4"/>\n <field name="street" select="2" colspan="4" width="200"/>\n <group colspan="2" col="4">\n <field name="tv" select="2"/>\n <newline/>\n <field name="nv" colspan="4"/>\n </group>\n <group colspan="2" col="8">\n <field name="pnp"/>\n <field name="es"/>\n <field name="pt"/>\n <field name="pu"/>\n <field name="bq" colspan="1"/>\n <field name="aclarador" colspan="5"/>\n </group>\n <field name="street2"/>\n <newline/>\n <field name="zip" select="2"/>\n <field name="apartat_correus"/>\n <newline/>\n <newline/>\n <field name="id_municipi" on_change="onchange_municipi_id(id_municipi,context)"/>\n <field name="id_poblacio" domain="[(\'municipi_id\',\'=\',id_municipi)]"/>\n <field name="state_id" select="2"/>\n <field completion="1" name="country_id" select="2"/>\n <newline/>\n <separator string="Catastre" colspan="4"/>\n <field name="ref_catastral"/>\n <separator string="Comunication channels" colspan="4"/>\n <field name="phone"/>\n <field name="fax"/>\n <newline/>\n <field name="mobile"/>\n <field name="email" select="2" widget="email"/>\n </page>\n <page string="Notes">\n <field name="notes" nolabel="1" colspan="4"/>\n </page>\n </notebook>\n </form>\n ',
80
+ fields: {
81
+ aclarador: {
82
+ size: 256,
83
+ string: "Aclarador",
84
+ type: "char",
85
+ views: {},
86
+ },
87
+ apartat_correus: {
88
+ size: 5,
89
+ string: "Apartat de Correus",
90
+ type: "char",
91
+ views: {},
92
+ },
93
+ bq: {
94
+ size: 4,
95
+ string: "Bloc",
96
+ type: "char",
97
+ views: {},
98
+ },
99
+ country_id: {
100
+ context: "",
101
+ domain: [],
102
+ relation: "res.country",
103
+ size: 64,
104
+ string: "Country",
105
+ type: "many2one",
106
+ views: {},
107
+ },
108
+ email: {
109
+ size: 240,
110
+ string: "E-Mail",
111
+ type: "char",
112
+ views: {},
113
+ },
114
+ es: {
115
+ size: 10,
116
+ string: "Escala",
117
+ type: "char",
118
+ views: {},
119
+ },
120
+ fax: {
121
+ size: 64,
122
+ string: "Fax",
123
+ type: "char",
124
+ views: {},
125
+ },
126
+ function: {
127
+ context: "",
128
+ domain: [],
129
+ relation: "res.partner.function",
130
+ size: 64,
131
+ string: "Function",
132
+ type: "many2one",
133
+ views: {},
134
+ },
135
+ id_municipi: {
136
+ context: "",
137
+ domain: [],
138
+ relation: "res.municipi",
139
+ size: 64,
140
+ string: "Municipi",
141
+ type: "many2one",
142
+ views: {},
143
+ },
144
+ id_poblacio: {
145
+ context: "",
146
+ domain: [],
147
+ relation: "res.poblacio",
148
+ size: 64,
149
+ string: "Població",
150
+ type: "many2one",
151
+ views: {},
152
+ },
153
+ mobile: {
154
+ size: 64,
155
+ string: "Mobile",
156
+ type: "char",
157
+ views: {},
158
+ },
159
+ name: {
160
+ size: 128,
161
+ string: "Contact Name",
162
+ type: "char",
163
+ views: {},
164
+ },
165
+ notes: {
166
+ string: "Notes",
167
+ type: "text",
168
+ views: {},
169
+ },
170
+ nv: {
171
+ size: 256,
172
+ string: "Carrer",
173
+ type: "char",
174
+ views: {},
175
+ },
176
+ phone: {
177
+ size: 64,
178
+ string: "Phone",
179
+ type: "char",
180
+ views: {},
181
+ },
182
+ pnp: {
183
+ size: 10,
184
+ string: "Número",
185
+ type: "char",
186
+ views: {},
187
+ },
188
+ pt: {
189
+ size: 10,
190
+ string: "Planta",
191
+ type: "char",
192
+ views: {},
193
+ },
194
+ pu: {
195
+ size: 10,
196
+ string: "Porta",
197
+ type: "char",
198
+ views: {},
199
+ },
200
+ ref_catastral: {
201
+ size: 20,
202
+ string: "Ref Catastral (c)",
203
+ type: "char",
204
+ views: {},
205
+ },
206
+ state_id: {
207
+ context: "",
208
+ domain: "[('country_id','=',country_id)]",
209
+ relation: "res.country.state",
210
+ size: 64,
211
+ string: "Fed. State",
212
+ type: "many2one",
213
+ views: {},
214
+ },
215
+ street: {
216
+ digits: [16, 2],
217
+ readonly: 1,
218
+ size: 128,
219
+ string: "Street",
220
+ type: "char",
221
+ views: {},
222
+ },
223
+ street2: {
224
+ size: 128,
225
+ string: "Street2",
226
+ type: "char",
227
+ views: {},
228
+ },
229
+ title: {
230
+ selection: [
231
+ ["Ms.", "Madam"],
232
+ ["Mss", "Miss"],
233
+ ["M.", "Sir"],
234
+ ["", ""],
235
+ ],
236
+ size: 32,
237
+ string: "Title",
238
+ type: "selection",
239
+ views: {},
240
+ },
241
+ tv: {
242
+ context: "",
243
+ domain: [],
244
+ relation: "res.tipovia",
245
+ size: 64,
246
+ string: "Tipus Via",
247
+ type: "many2one",
248
+ views: {},
249
+ },
250
+ type: {
251
+ help:
252
+ "Used to select automatically the right address according to the context in sales and purchases documents.",
253
+ selection: [
254
+ ["default", "Default"],
255
+ ["invoice", "Invoice"],
256
+ ["delivery", "Delivery"],
257
+ ["contact", "Contact"],
258
+ ["other", "Other"],
259
+ ["ov", "Oficina Virtual"],
260
+ ],
261
+ string: "Address Type",
262
+ type: "selection",
263
+ views: {},
264
+ },
265
+ zip: {
266
+ change_default: true,
267
+ size: 24,
268
+ string: "Zip",
269
+ type: "char",
270
+ views: {},
271
+ },
272
+ },
273
+ },
274
+ tree: {
275
+ arch:
276
+ '<tree string="Partner Contacts">\n <field name="name"/>\n <field name="street"/>\n <field name="type"/>\n <field name="zip"/>\n <field name="city"/>\n <field name="country_id"/>\n <field name="phone"/>\n <field name="email"/>\n </tree>\n ',
277
+ fields: {
278
+ city: {
279
+ size: 128,
280
+ string: "City",
281
+ type: "char",
282
+ views: {},
283
+ },
284
+ country_id: {
285
+ context: "",
286
+ domain: [],
287
+ relation: "res.country",
288
+ size: 64,
289
+ string: "Country",
290
+ type: "many2one",
291
+ views: {},
292
+ },
293
+ email: {
294
+ size: 240,
295
+ string: "E-Mail",
296
+ type: "char",
297
+ views: {},
298
+ },
299
+ name: {
300
+ size: 128,
301
+ string: "Contact Name",
302
+ type: "char",
303
+ views: {},
304
+ },
305
+ phone: {
306
+ size: 64,
307
+ string: "Phone",
308
+ type: "char",
309
+ views: {},
310
+ },
311
+ street: {
312
+ digits: [16, 2],
313
+ readonly: 1,
314
+ size: 128,
315
+ string: "Street",
316
+ type: "char",
317
+ views: {},
318
+ },
319
+ type: {
320
+ help:
321
+ "Used to select automatically the right address according to the context in sales and purchases documents.",
322
+ selection: [
323
+ ["default", "Default"],
324
+ ["invoice", "Invoice"],
325
+ ["delivery", "Delivery"],
326
+ ["contact", "Contact"],
327
+ ["other", "Other"],
328
+ ["ov", "Oficina Virtual"],
329
+ ],
330
+ string: "Address Type",
331
+ type: "selection",
332
+ views: {},
333
+ },
334
+ zip: {
335
+ change_default: true,
336
+ size: 24,
337
+ string: "Zip",
338
+ type: "char",
339
+ views: {},
340
+ },
341
+ },
342
+ },
343
+ },
344
+ };
345
+ const widget = widgetFactory.createWidget("one2many", props);
346
+
347
+ expect(widget.views.form).toBeTruthy();
348
+ expect(widget.views.form.arch).toBeTruthy();
349
+ expect(widget.views.form.fields).toBeTruthy();
350
+ expect(widget.views.tree).toBeTruthy();
351
+ expect(widget.views.tree.arch).toBeTruthy();
352
+ expect(widget.views.tree.fields).toBeTruthy();
353
+ });
354
+ });