-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconflict_extensions.xml
More file actions
350 lines (328 loc) · 20.9 KB
/
conflict_extensions.xml
File metadata and controls
350 lines (328 loc) · 20.9 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
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- ═══════════════════════════════════════════════════════════════════════
CHANGE REQUEST TYPE FORM EXTENSION - Conflict Configuration
═══════════════════════════════════════════════════════════════════════ -->
<record id="view_spp_change_request_type_form_conflict" model="ir.ui.view">
<field name="name">spp.change.request.type.form.conflict</field>
<field name="model">spp.change.request.type</field>
<field name="inherit_id" ref="spp_change_request_type_form"/>
<field name="arch" type="xml">
<!-- Add conflict rule stat button -->
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_view_conflict_rules"
type="object"
class="oe_stat_button"
icon="fa-exclamation-triangle"
invisible="not enable_conflict_detection">
<field name="conflict_rule_count" widget="statinfo" string="Conflict Rules"/>
</button>
</xpath>
<!-- Add Conflict Detection page to notebook -->
<xpath expr="//page[@name='documents']" position="after">
<page string="Conflict Detection" name="conflict_detection">
<group>
<group string="Conflict Detection">
<field name="enable_conflict_detection"/>
</group>
<group string="Duplicate Detection">
<field name="enable_duplicate_detection"/>
<label for="duplicate_detection_config_id"
invisible="not enable_duplicate_detection"/>
<div invisible="not enable_duplicate_detection">
<field name="duplicate_detection_config_id" class="oe_inline"/>
<button name="action_configure_duplicate_detection"
type="object"
icon="fa-cog"
title="Configure Duplicate Detection"
class="btn-link oe_link"/>
</div>
</group>
</group>
<!-- Conflict Rules Section -->
<separator string="Conflict Rules" invisible="not enable_conflict_detection"/>
<field name="conflict_rule_ids" nolabel="1" invisible="not enable_conflict_detection">
<list editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="scope"/>
<field name="action"
decoration-danger="action == 'block'"
decoration-warning="action == 'warn'"
decoration-muted="action == 'log'"/>
<field name="conflict_states"/>
<field name="check_same_type_only"/>
<field name="time_window_hours"/>
<field name="active"/>
</list>
</field>
<!-- Help Text -->
<div class="alert alert-info" role="alert">
<p><strong>Conflict Detection:</strong> When enabled, the system will check for conflicting
change requests before allowing submission or approval.</p>
<ul>
<li><strong>Block:</strong> Prevents submission until conflict is resolved or overridden.</li>
<li><strong>Warn:</strong> Shows warning but allows submission.</li>
<li><strong>Log:</strong> Silently logs conflict for audit purposes.</li>
</ul>
<p><strong>Duplicate Detection:</strong> Identifies potential duplicate submissions based on
similarity of change request details.</p>
</div>
</page>
</xpath>
</field>
</record>
<!-- ═══════════════════════════════════════════════════════════════════════
CHANGE REQUEST FORM EXTENSION - Conflict Status Display (UX Improved)
═══════════════════════════════════════════════════════════════════════ -->
<record id="view_spp_change_request_form_conflict" model="ir.ui.view">
<field name="name">spp.change.request.form.conflict</field>
<field name="model">spp.change.request</field>
<field name="inherit_id" ref="spp_change_request_form"/>
<field name="arch" type="xml">
<!-- Add conflict stat buttons with user-friendly labels -->
<xpath expr="//button[@name='action_open_preview_wizard']" position="after">
<button name="action_view_conflicts"
type="object"
class="oe_stat_button"
icon="fa-exclamation-triangle"
invisible="conflict_count == 0">
<field name="conflict_count" widget="statinfo" string="Conflicts"/>
</button>
<button name="action_view_duplicates"
type="object"
class="oe_stat_button"
icon="fa-copy"
invisible="duplicate_count == 0">
<field name="duplicate_count" widget="statinfo" string="Duplicates"/>
</button>
</xpath>
<!-- User-friendly ribbons -->
<xpath expr="//div[hasclass('oe_title')]" position="before">
<widget name="web_ribbon" title="Needs Review" bg_color="text-bg-danger"
invisible="conflict_status != 'blocked'"/>
<widget name="web_ribbon" title="Approved by Supervisor" bg_color="text-bg-success"
invisible="conflict_status != 'overridden'"/>
</xpath>
<!-- Simplified header buttons -->
<xpath expr="//button[@name='action_submit_for_approval']" position="before">
<button name="action_open_conflict_wizard"
string="Review Conflicts"
type="object"
class="btn-warning"
invisible="conflict_status not in ('blocked', 'warning')"
data-hotkey="c"/>
<button name="action_recheck_conflicts"
string="Check for Updates"
type="object"
class="btn-link"
invisible="approval_state != 'draft' or not is_conflict_detection_enabled"
help="Check if other requests have been completed"/>
</xpath>
<!-- Simplified Conflicts tab with progressive disclosure -->
<xpath expr="//page[@name='validation']" position="after">
<page string="Conflicts" name="conflicts"
invisible="conflict_count == 0 and duplicate_count == 0">
<!-- BLOCKED: Action-oriented banner -->
<div class="alert alert-danger" role="alert"
invisible="conflict_status != 'blocked'">
<div class="d-flex align-items-center">
<i class="fa fa-ban fa-2x me-3" title="Blocked"/>
<div class="flex-grow-1">
<h5 class="alert-heading mb-2">Cannot Submit This Request</h5>
<p class="mb-2">
Another change request for this beneficiary is already in progress.
You can wait for it to complete, or resolve the issue now.
</p>
<div class="btn-group">
<button name="action_view_conflicts" type="object"
class="btn btn-sm btn-outline-danger">
<i class="fa fa-eye me-1"/> View Other Request
</button>
<button name="action_quick_cancel_this" type="object"
class="btn btn-sm btn-outline-danger"
confirm="Are you sure you want to cancel this request?">
<i class="fa fa-times me-1"/> Cancel My Request
</button>
<button name="action_open_conflict_wizard" type="object"
class="btn btn-sm btn-danger">
<i class="fa fa-wrench me-1"/> More Options
</button>
</div>
</div>
</div>
</div>
<!-- WARNING: Less alarming banner -->
<div class="alert alert-warning" role="status"
invisible="conflict_status != 'warning'">
<div class="d-flex align-items-center">
<i class="fa fa-exclamation-triangle fa-2x me-3" title="Warning"/>
<div class="flex-grow-1">
<h5 class="alert-heading mb-2">Please Review Before Submitting</h5>
<p class="mb-0">
Another change request for this beneficiary may overlap with yours.
Please review before submitting.
</p>
</div>
</div>
</div>
<!-- OVERRIDDEN: Success banner with collapsible details -->
<div class="alert alert-success" role="status"
invisible="conflict_status != 'overridden'">
<div class="d-flex align-items-center">
<i class="fa fa-check-circle fa-2x me-3" title="Approved"/>
<div class="flex-grow-1">
<h5 class="alert-heading mb-2">Approved to Continue</h5>
<p class="mb-2">
A supervisor reviewed the conflict and approved this request to proceed.
</p>
<small class="text-muted">
Approved by <field name="conflict_override_user_id" readonly="1" class="d-inline"/>
on <field name="conflict_override_date" readonly="1" class="d-inline"/>
</small>
</div>
</div>
</div>
<!-- Other Change Requests (simplified view) -->
<group string="Other Change Requests for This Beneficiary"
invisible="conflict_count == 0">
<field name="conflicting_cr_ids" nolabel="1" readonly="1">
<list>
<field name="name"/>
<field name="request_type_id"/>
<field name="display_state"
string="Status"
widget="badge"
decoration-info="display_state == 'draft'"
decoration-warning="display_state in ('pending', 'revision')"
decoration-success="display_state in ('approved', 'applied')"
decoration-danger="display_state == 'rejected'"/>
<field name="create_date" string="Submitted"/>
<field name="create_uid" string="By" widget="many2one_avatar_user"/>
</list>
</field>
</group>
<!-- Possible Duplicates (simplified message) -->
<group string="Possible Duplicate Submission"
invisible="duplicate_count == 0">
<div class="alert alert-info mb-3" role="alert">
<p class="mb-0">
<i class="fa fa-info-circle me-1"/>
This request appears very similar to another recent submission.
If this was submitted by mistake, you can cancel it.
</p>
</div>
<field name="potential_duplicate_ids" nolabel="1" readonly="1">
<list>
<field name="name"/>
<field name="create_date" string="Submitted"/>
<field name="create_uid" string="By" widget="many2one_avatar_user"/>
</list>
</field>
</group>
<!-- Technical details (collapsible for advanced users) -->
<div class="mt-4 border-top pt-3"
invisible="conflict_count == 0 and duplicate_count == 0">
<details>
<summary class="text-primary" style="cursor: pointer; list-style: none;">
<i class="fa fa-cog me-1" title="Settings"/> Technical Details
</summary>
<div class="mt-3">
<group>
<group>
<field name="conflict_status" readonly="1" widget="badge"
string="Internal Status"
decoration-danger="conflict_status == 'blocked'"
decoration-warning="conflict_status == 'warning'"
decoration-info="conflict_status == 'overridden'"
decoration-success="conflict_status == 'none'"/>
<field name="conflict_detection_date" readonly="1" string="Last Checked"/>
</group>
<group invisible="duplicate_count == 0">
<field name="duplicate_status" readonly="1" widget="badge"
decoration-warning="duplicate_status == 'potential'"
decoration-danger="duplicate_status == 'confirmed'"
decoration-muted="duplicate_status == 'merged'"
decoration-success="duplicate_status == 'none'"/>
<field name="duplicate_similarity_score" readonly="1"
widget="progressbar" string="Similarity Score"/>
</group>
</group>
<group invisible="not conflict_messages">
<field name="conflict_messages" readonly="1" string="System Messages"/>
</group>
<group invisible="conflict_status != 'overridden'">
<field name="conflict_override_reason" readonly="1" string="Approval Reason"/>
</group>
</div>
</details>
</div>
<!-- Merged From (rarely used) -->
<group string="Merged From" invisible="not merged_from_cr_ids">
<field name="merged_from_cr_ids" nolabel="1" readonly="1"/>
</group>
<!-- Merged Into -->
<group invisible="not merged_into_cr_id">
<field name="merged_into_cr_id" readonly="1"/>
</group>
</page>
</xpath>
</field>
</record>
<!-- ═══════════════════════════════════════════════════════════════════════
CHANGE REQUEST LIST VIEW EXTENSION - Icon-based Conflict Indicators
═══════════════════════════════════════════════════════════════════════ -->
<record id="view_spp_change_request_list_conflict" model="ir.ui.view">
<field name="name">spp.change.request.list.conflict</field>
<field name="model">spp.change.request</field>
<field name="inherit_id" ref="spp_change_request_list"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='display_state']" position="after">
<!-- Hidden field for domain checks -->
<field name="conflict_status" column_invisible="1"/>
<!-- Icon-based indicators with tooltips -->
<button name="action_view_conflicts"
type="object"
icon="fa-ban"
title="Cannot submit - needs review"
class="btn-link text-danger p-0"
invisible="conflict_status != 'blocked'"/>
<button name="action_view_conflicts"
type="object"
icon="fa-exclamation-triangle"
title="Warning - review recommended"
class="btn-link text-warning p-0"
invisible="conflict_status != 'warning'"/>
<button name="action_view_conflicts"
type="object"
icon="fa-check-circle"
title="Approved by supervisor"
class="btn-link text-success p-0"
invisible="conflict_status != 'overridden'"/>
</xpath>
</field>
</record>
<!-- ═══════════════════════════════════════════════════════════════════════
CHANGE REQUEST SEARCH VIEW EXTENSION - User-friendly Filters
═══════════════════════════════════════════════════════════════════════ -->
<record id="view_spp_change_request_search_conflict" model="ir.ui.view">
<field name="name">spp.change.request.search.conflict</field>
<field name="model">spp.change.request</field>
<field name="inherit_id" ref="spp_change_request_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='rejected']" position="after">
<separator/>
<filter name="has_conflicts" string="Needs Review"
domain="[('conflict_status', 'in', ('blocked', 'warning'))]"/>
<filter name="blocked" string="Cannot Submit"
domain="[('conflict_status', '=', 'blocked')]"/>
<filter name="has_duplicates" string="Possible Duplicates"
domain="[('duplicate_status', '=', 'potential')]"/>
</xpath>
<xpath expr="//filter[@name='group_creator']" position="after">
<filter name="group_conflict" string="Review Status"
context="{'group_by': 'conflict_status'}"/>
</xpath>
</field>
</record>
</odoo>