-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_program_wizard.xml
More file actions
409 lines (397 loc) · 20.2 KB
/
create_program_wizard.xml
File metadata and controls
409 lines (397 loc) · 20.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Part of OpenSPP. See LICENSE file for full copyright and licensing details.
-->
<odoo>
<!-- ========================================== -->
<!-- BASE WIZARD FORM VIEW -->
<!-- ========================================== -->
<!-- This is the base form view that other modules extend.
Extension modules add their specific fields/pages here. -->
<record id="create_program_wizard_form_view" model="ir.ui.view">
<field name="name">Create Program Wizard</field>
<field name="model">spp.program.create.wizard</field>
<field name="arch" type="xml">
<form string="Create a New Program">
<header>
<field name="state" widget="statusbar" statusbar_visible="step1,step2" />
</header>
<sheet>
<!-- ======================================== -->
<!-- STEP 1: Program Basics (no tabs) -->
<!-- ======================================== -->
<div invisible="state != 'step1'" name="step1_content">
<group>
<group>
<field
name="name"
placeholder="e.g., Emergency Cash Transfer 2025"
string="Program Name"
/>
<field
name="entitlement_type"
widget="radio"
options="{'horizontal': true}"
string="Benefit Type"
/>
</group>
<group>
<field
name="target_type"
widget="radio"
options="{'horizontal': true}"
string="Beneficiaries"
help="Individual: Each person enrolled separately. Group: Households/groups enrolled together."
/>
<field
name="currency_id"
options="{'no_open':True,'no_create':True}"
string="Currency"
/>
</group>
</group>
<group name="benefit_type_section">
<group>
<field
name="import_beneficiaries"
widget="radio"
string="Import beneficiaries now?"
/>
</group>
<group>
<field
name="id_type_id"
options="{'no_open':true,'no_create':true,'no_create_edit':true}"
string="Redemption ID"
help="ID type used to identify beneficiaries when they collect their benefits"
/>
</group>
</group>
<group name="quick_options_section">
<group>
<field
name="auto_approve_entitlements"
widget="boolean_toggle"
string="Auto-approve entitlements"
/>
</group>
<!-- Placeholder for compliance toggle added via CEL views -->
<group name="compliance_toggle_placeholder" />
</group>
</div>
<!-- ======================================== -->
<!-- STEP 2: Configuration Tabs -->
<!-- ======================================== -->
<notebook invisible="state != 'step2'">
<!-- ======================================== -->
<!-- STEP 2: Who Qualifies (Eligibility) -->
<!-- ======================================== -->
<page
string="Who Qualifies?"
name="eligibility"
>
<group colspan="4" col="4">
<!-- Placeholder for eligibility type selection - extended by spp_programs SPP view -->
<group name="eligibility_type_selection" colspan="4" col="4">
<!-- Extended by create_program_wizard_form_view_spp -->
</group>
</group>
</page>
<!-- ======================================== -->
<!-- STEP 2: What They Receive (Entitlement) -->
<!-- ======================================== -->
<page
string="Entitlements"
name="entitlement"
>
<!-- Cash/In-Kind specific content added via extension views -->
<!-- Approval Settings (compact) -->
<group name="approval_settings">
<field
name="entitlement_validation_group_id"
options="{'no_open':True,'no_create':True}"
invisible="1"
/>
<field
name="entitlement_approval_definition_id"
options="{'no_open':True,'no_create':True}"
string="Approval Workflow"
help="Who must approve entitlements before they can be paid"
domain="[('model_id.model', '=', 'spp.entitlement.inkind' if entitlement_type == 'inkind' else 'spp.entitlement')]"
/>
</group>
</page>
<!-- ======================================== -->
<!-- STEP 2: Program Schedule (Cycle) -->
<!-- ======================================== -->
<page
string="Schedule"
name="cycle"
>
<group>
<group>
<field
name="rrule_type"
widget="radio"
options="{'horizontal': true}"
string="Frequency"
/>
<field
name="cycle_duration"
string="Duration"
help="How many days/weeks/months each cycle lasts"
/>
</group>
<group>
<field
name="is_one_time_distribution"
widget="boolean_toggle"
string="One-time only"
/>
<field
name="cycle_approval_definition_id"
options="{'no_open':True,'no_create':True}"
string="Cycle Approval"
help="Who must approve each distribution cycle"
/>
<field
name="approver_group_id"
options="{'no_open':True,'no_create':True}"
invisible="1"
/>
</group>
</group>
<!-- Weekly options (compact) -->
<group invisible="rrule_type != 'weekly' or is_one_time_distribution">
<group>
<field name="mon" />
<field name="tue" />
<field name="wed" />
<field name="thu" />
</group>
<group>
<field name="fri" />
<field name="sat" />
<field name="sun" />
</group>
</group>
<!-- Monthly options (compact) -->
<group invisible="rrule_type != 'monthly' or is_one_time_distribution">
<group>
<field name="month_by" widget="radio" options="{'horizontal': true}" />
</group>
<group invisible="month_by != 'date'">
<field name="day" string="Day (1-31)" />
<div class="text-info small" colspan="2" invisible="not day_warning">
<i class="fa fa-info-circle me-1" title="Info" />
<field name="day_warning" nolabel="1" class="d-inline" />
</div>
</group>
<group invisible="month_by != 'day'">
<field name="byday" string="Which" />
<field name="weekday" />
</group>
</group>
</page>
</notebook>
</sheet>
<footer>
<button
string="Next: Configure Program"
name="next_step"
type="object"
class="btn-primary"
invisible="state != 'step1'"
icon="fa-arrow-right"
/>
<button
string="Back"
name="prev_step"
type="object"
class="btn-secondary"
invisible="state != 'step2'"
icon="fa-arrow-left"
/>
<button
string="Create Program"
name="create_program"
type="object"
class="btn-primary"
invisible="state != 'step2'"
icon="fa-check"
/>
<button string="Cancel" class="btn-secondary" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- ========================================== -->
<!-- SPP EXTENSION VIEW -->
<!-- ========================================== -->
<!-- Adds SPP-specific fields like eligibility domain, admin areas, etc. -->
<record id="create_program_wizard_form_view_spp" model="ir.ui.view">
<field name="name">Create Program Wizard - SPP Extensions</field>
<field name="model">spp.program.create.wizard</field>
<field name="priority">10</field>
<field name="inherit_id" ref="spp_programs.create_program_wizard_form_view" />
<field name="arch" type="xml">
<!-- Add eligibility type selection -->
<xpath expr="//group[@name='eligibility_type_selection']" position="inside">
<field
name="eligibility_type"
colspan="4"
widget="radio"
options="{'horizontal': true}"
string="How should eligibility be determined?"
/>
</xpath>
<!-- Add default eligibility configuration -->
<xpath expr="//group[@name='eligibility_type_selection']" position="after">
<group
colspan="4"
col="4"
name="default_eligibility"
invisible="eligibility_type != 'default_eligibility'"
>
<group colspan="4" string="Geographic Targeting" invisible="1">
<field
name="admin_area_ids"
colspan="4"
widget="many2many_tags"
string="Target Areas"
placeholder="Select administrative areas..."
/>
</group>
<group colspan="4" string="Additional Filters">
<label for="eligibility_domain" string="Filter Criteria:" />
<field
name="eligibility_domain"
colspan="4"
widget="domain"
options="{'model': 'res.partner'}"
nolabel="1"
/>
</group>
</group>
</xpath>
<!-- Add program view selector (hidden from non-admin) -->
<xpath expr="//group[@name='benefit_type_section']" position="after">
<group invisible="1" groups="base.group_no_one">
<field
name="view_id"
options="{'no_open':true,'no_create':true,'no_create_edit':true}"
string="Program Form Template"
/>
</group>
</xpath>
</field>
</record>
<!-- ========================================== -->
<!-- IN-KIND ENTITLEMENT EXTENSION -->
<!-- ========================================== -->
<record id="create_program_wizard_form_view_inkind" model="ir.ui.view">
<field name="name">Create Program Wizard - In-Kind Extensions</field>
<field name="model">spp.program.create.wizard</field>
<field name="priority">12</field>
<field name="inherit_id" ref="spp_programs.create_program_wizard_form_view" />
<field name="arch" type="xml">
<!-- Add in-kind specific fields -->
<xpath expr="//group[@name='approval_settings']" position="before">
<group
string="In-Kind Settings"
name="inkind_settings"
invisible="entitlement_type != 'inkind'"
colspan="4"
col="4"
>
<group colspan="2">
<field
name="manage_inventory"
string="Manage stock movements (inventory)"
widget="boolean_toggle"
/>
</group>
<group colspan="2">
<field
name="is_evaluate_single_item"
string="Evaluate one item"
widget="boolean_toggle"
/>
</group>
</group>
<notebook colspan="4" invisible="entitlement_type != 'inkind'">
<page string="Items" name="inkind_items">
<field name="entitlement_item_ids" nolabel="1" colspan="4">
<list>
<field name="sequence" widget="handle" />
<field name="product_id" />
<field name="quantity" />
<field name="uom_id" />
<field name="multiplier_field" />
<field name="max_multiplier" />
</list>
<form string="Entitlement Item">
<group colspan="4" col="4">
<field
name="product_id"
options="{'no_open':True,'no_create':True,'no_create_edit':True}"
colspan="4"
/>
</group>
<group colspan="4" col="4">
<group colspan="2">
<field name="quantity" />
</group>
<group colspan="2">
<field
name="uom_id"
options="{'no_open':True,'no_create':True,'no_create_edit':True}"
/>
</group>
</group>
<group colspan="4" col="4">
<field
name="condition"
colspan="4"
widget="domain"
options="{'model': 'res.partner'}"
/>
</group>
<group colspan="4" col="4">
<group colspan="2">
<field
name="multiplier_field"
options="{'no_open':True,'no_create':True,'no_create_edit':True}"
/>
</group>
<group colspan="2">
<field name="max_multiplier" />
</group>
</group>
</form>
</field>
</page>
<page string="Inventory Settings" name="inkind_inventory" invisible="not manage_inventory">
<group colspan="4" col="4">
<field
name="warehouse_id"
options="{'no_open':True,'no_create':True,'no_create_edit':True}"
/>
<field name="company_id" invisible="1" options="{'no_open':True}" />
</group>
</page>
</notebook>
</xpath>
</field>
</record>
<!-- ========================================== -->
<!-- WIZARD ACTION -->
<!-- ========================================== -->
<record id="action_create_program_wizard" model="ir.actions.act_window">
<field name="name">Create Program</field>
<field name="res_model">spp.program.create.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="create_program_wizard_form_view" />
</record>
</odoo>