@waron97/prbot 1.0.0 → 1.0.1

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 (17) hide show
  1. package/index.js +13 -0
  2. package/package.json +2 -1
  3. package/dotenv +0 -85908
  4. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-23 09:21:16.xml +0 -3122
  5. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-23 09:25:03.xml +0 -3122
  6. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-23 09:28:23.xml +0 -3122
  7. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-23 09:31:30.xml +0 -3122
  8. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-26 22:53:31.xml +0 -3170
  9. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-29 09:38:23.xml +0 -3170
  10. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-23 09:21:17.xml +0 -4160
  11. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-23 09:25:05.xml +0 -4160
  12. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-23 09:28:25.xml +0 -4160
  13. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-23 09:31:31.xml +0 -4160
  14. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-26 22:53:34.xml +0 -4208
  15. package/out/xml_data_for_ML - RISOLUZIONE CONTRATTUALE_2026-01-29 09:38:25.xml +0 -4208
  16. package/out/xml_data_for_ML - Taglio Colonna Gas per Morosit/303/240 - Relazioni mancanti: Fasi - Workflow e Fasi - Esiti Consentiti_2026-01-26 22:57:38.xml" +0 -2358
  17. package/out/xml_data_for_ML - Taglio Colonna Gas per Morosit/303/240_2026-01-26 22:57:40.xml" +0 -3667
@@ -1,2358 +0,0 @@
1
- <odoo>
2
- <data>
3
- <record id="symple_triplet_phase_A1938_-_Verifica_Compatibilit__Processi" model="symple.triplet.phase">
4
- <field name="active">True</field>
5
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2638_-_Incompatibilit__Bloccante_E-ML-GM08-3-0001'),ref('symple_triplet_phase_result_C2639_-_Incompatibilit__Non_bloccante_E-ML-GM08-3-0002'),ref('symple_triplet_phase_result_C2654_-_Processo_Compatibile_E-ML-GM08-3-0003'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0004')])]"/>
6
- <field name="child_case">False</field>
7
- <field name="code">def main():
8
- service_point = case_id.service_point_ids[0]
9
- billing_profile = service_point.billing_profile_id
10
- asset = service_point.asset(active=False)
11
-
12
- if not asset:
13
- asset_id = False
14
- else:
15
- asset_id = asset._id
16
-
17
- (result, incompatible_case_ids) = ( # "OK" | "KO" | "PARTIAL_KO" # List[int]
18
- case_id.check_compatibility_matrix(
19
- asset_id=asset_id,
20
- client_id=case_id.customer_id.user_sequence,
21
- billing_id=billing_profile.name,
22
- # external_id -> default a case.ticket_type_id.univocal_code
23
- )
24
- )
25
-
26
- if incompatible_case_ids:
27
- case_id.write({"incompatible_ticket_ids": incompatible_case_ids})
28
-
29
- if result in ["OK", "PARTIAL_KO"]:
30
- case_id.create_matrix_process(
31
- asset_id=asset_id,
32
- client_id=case_id.customer_id.user_sequence,
33
- billing_id=billing_profile.name,
34
- # external_id -> default a case.ticket_type_id.univocal_code
35
- )
36
-
37
- return result
38
-
39
-
40
- try:
41
- result = main()
42
- except Exception as e:
43
- log(format_exc())
44
- case_id.write({"error_message": str(e)})</field>
45
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
46
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
47
- <field name="is_a_postalizer_phase">False</field>
48
- <field name="is_compute_refund">False</field>
49
- <field name="is_dl">False</field>
50
- <field name="is_needs_child_case">False</field>
51
- <field name="is_pick_refund_template">False</field>
52
- <field name="is_process_managed">False</field>
53
- <field name="is_quote_accepted">False</field>
54
- <field name="is_quote_sent">False</field>
55
- <field name="is_timeout">False</field>
56
- <field name="is_voidable">False</field>
57
- <field name="name">A1938 - Verifica Compatibilità Processi</field>
58
- <field name="set_result_automatically">from_code</field>
59
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
60
- <field name="is_externally_integrated">False</field>
61
- <field name="is_process_cancellable_relaunchable">False</field>
62
- <field name="wizard_info">{"key":"value"}</field>
63
- <field name="phase_code">F-ML-GM08-3-0001</field>
64
- <field name="check_closed_child_tickets">False</field>
65
- </record>
66
- <record id="symple_triplet_phase_A1937_-_Verifica_Case_Incompatibile" model="symple.triplet.phase">
67
- <field name="active">True</field>
68
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2647_-_OK_-_Incompatibilit__Risolta_E-ML-GM08-3-0005'),ref('symple_triplet_phase_result_C2641_-_KO_-_Incompatibilit__Non_risolta_E-ML-GM08-3-0006'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0007')])]"/>
69
- <field name="child_case">False</field>
70
- <field name="code"># Available variables:
71
- # - case_id: the case that just reached this phase
72
- # - request: allows you to make HTTP requests (method, url, headers, data)
73
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
74
- # - json_load: allows you to use JSON.load to convert a json into an object
75
- # - env: Odoo Environment on which the action is triggered
76
- # - time, datetime, dateutil, timezone: useful Python libraries
77
- # - float_compare: Odoo function to compare floats based on specific precisions
78
- # - ValidationError: Warning Exception to use with raise
79
- # - Command: x2Many commands namespace
80
- # - OrderedDict: ordered dictionaries
81
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
82
- # (line = case id, func = phase name)
83
- # To return a result, assign: result = {...}
84
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
85
- # phase result will not be set.
86
-
87
-
88
-
89
- </field>
90
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
91
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
92
- <field name="is_a_postalizer_phase">False</field>
93
- <field name="is_compute_refund">False</field>
94
- <field name="is_dl">False</field>
95
- <field name="is_needs_child_case">False</field>
96
- <field name="is_pick_refund_template">False</field>
97
- <field name="is_process_managed">False</field>
98
- <field name="is_quote_accepted">False</field>
99
- <field name="is_quote_sent">False</field>
100
- <field name="is_timeout">False</field>
101
- <field name="is_voidable">False</field>
102
- <field name="name">A1937 - Verifica Case Incompatibile</field>
103
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
104
- <field name="is_externally_integrated">False</field>
105
- <field name="is_process_cancellable_relaunchable">False</field>
106
- <field name="wizard_info">{"key":"value"}</field>
107
- <field name="phase_code">F-ML-GM08-3-0002</field>
108
- <field name="check_closed_child_tickets">False</field>
109
- </record>
110
- <record id="symple_triplet_phase_A1311_-_Invio_Lettera__Extra_sistema_" model="symple.triplet.phase">
111
- <field name="active">True</field>
112
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1884_-_OK_-_Lettera_inviata_E-ML-GM08-3-0008'),ref('symple_triplet_phase_result_C1885_-_KO_-_Lettera_non_inviata_E-ML-GM08-3-0009'),ref('symple_triplet_phase_result_C1886_-_Annullamento_Case_durante_Invio_Lettera_E-ML-GM08-3-0010'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0011')])]"/>
113
- <field name="child_case">False</field>
114
- <field name="code"># Available variables:
115
- # - case_id: the case that just reached this phase
116
- # - request: allows you to make HTTP requests (method, url, headers, data)
117
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
118
- # - json_load: allows you to use JSON.load to convert a json into an object
119
- # - env: Odoo Environment on which the action is triggered
120
- # - time, datetime, dateutil, timezone: useful Python libraries
121
- # - float_compare: Odoo function to compare floats based on specific precisions
122
- # - ValidationError: Warning Exception to use with raise
123
- # - Command: x2Many commands namespace
124
- # - OrderedDict: ordered dictionaries
125
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
126
- # (line = case id, func = phase name)
127
- # To return a result, assign: result = {...}
128
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
129
- # phase result will not be set.
130
-
131
-
132
-
133
- </field>
134
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
135
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
136
- <field name="is_a_postalizer_phase">False</field>
137
- <field name="is_compute_refund">False</field>
138
- <field name="is_dl">False</field>
139
- <field name="is_needs_child_case">False</field>
140
- <field name="is_pick_refund_template">False</field>
141
- <field name="is_process_managed">False</field>
142
- <field name="is_quote_accepted">False</field>
143
- <field name="is_quote_sent">False</field>
144
- <field name="is_timeout">False</field>
145
- <field name="is_voidable">False</field>
146
- <field name="name">A1311 - Invio Lettera (Extra sistema)</field>
147
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
148
- <field name="is_externally_integrated">False</field>
149
- <field name="is_process_cancellable_relaunchable">False</field>
150
- <field name="wizard_info">{"key":"value"}</field>
151
- <field name="phase_code">F-ML-GM08-3-0003</field>
152
- <field name="check_closed_child_tickets">False</field>
153
- </record>
154
- <record id="symple_triplet_phase_A1310_-_In_attesa_11_giorni_lavorativi" model="symple.triplet.phase">
155
- <field name="active">True</field>
156
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1887_-_OK_-_Avanzamento_dopo_11_giorni_E-ML-GM08-3-0012'),ref('symple_triplet_phase_result_C1001_-_Annullamento_E-ML-GM08-3-0013'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0014')])]"/>
157
- <field name="child_case">False</field>
158
- <field name="code"># Available variables:
159
- # - case_id: the case that just reached this phase
160
- # - request: allows you to make HTTP requests (method, url, headers, data)
161
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
162
- # - json_load: allows you to use JSON.load to convert a json into an object
163
- # - env: Odoo Environment on which the action is triggered
164
- # - time, datetime, dateutil, timezone: useful Python libraries
165
- # - float_compare: Odoo function to compare floats based on specific precisions
166
- # - ValidationError: Warning Exception to use with raise
167
- # - Command: x2Many commands namespace
168
- # - OrderedDict: ordered dictionaries
169
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
170
- # (line = case id, func = phase name)
171
- # To return a result, assign: result = {...}
172
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
173
- # phase result will not be set.
174
-
175
-
176
-
177
- </field>
178
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
179
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
180
- <field name="is_a_postalizer_phase">False</field>
181
- <field name="is_compute_refund">False</field>
182
- <field name="is_dl">False</field>
183
- <field name="is_needs_child_case">False</field>
184
- <field name="is_pick_refund_template">False</field>
185
- <field name="is_process_managed">False</field>
186
- <field name="is_quote_accepted">False</field>
187
- <field name="is_quote_sent">False</field>
188
- <field name="is_timeout">False</field>
189
- <field name="is_voidable">False</field>
190
- <field name="name">A1310 - In attesa 11 giorni lavorativi</field>
191
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
192
- <field name="is_externally_integrated">False</field>
193
- <field name="is_process_cancellable_relaunchable">False</field>
194
- <field name="wizard_info">{"key":"value"}</field>
195
- <field name="phase_code">F-ML-GM08-3-0004</field>
196
- <field name="check_closed_child_tickets">False</field>
197
- </record>
198
- <record id="symple_triplet_phase_A1559_-_Invio_alla_Market_Communication" model="symple.triplet.phase">
199
- <field name="active">True</field>
200
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2458_-_OK_Inviata_E-ML-GM08-3-0015'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0016')])]"/>
201
- <field name="child_case">False</field>
202
- <field name="code">try:
203
- # get headers
204
- tenant_id = env["ir.config_parameter"].sudo().get_param("m2c_header_tenant_id")
205
- org_token = env["ir.config_parameter"].sudo().get_param("m2c_header_org_token")
206
- headers = {"tenantId": tenant_id, "orgToken": org_token}
207
-
208
- customer = case_id.customer_id
209
-
210
- # fake data to be modified
211
- ifs_dict = {
212
- "ifs_code": "SMG2",
213
- "case_id": str(case_id.id),
214
- "ifs_data_message": {
215
- "COD_SERVIZIO": "SMG2",
216
- "COD_FLUSSO": "0050",
217
- "OWNER": "SORGE",
218
- "PIVA_DISTRIBUTORE": case_id.service_point_ids[
219
- 0
220
- ].pdr_id.distributor_id.numbers_only_vat,
221
- "PRIORITA": "",
222
- "SERV_UI": "NO",
223
- "CF_CF": customer.fiscal_code if customer.is_individual_client else "",
224
- "CF_PIVA": customer.numbers_only_vat if customer.is_company else "",
225
- "COD_PDR": case_id.service_point_ids[0].pdr_id.code,
226
- "NOTE": "",
227
- },
228
- }
229
-
230
- ifs_json = json_dumps(ifs_dict)
231
- btw_url = "http://b2w-symphony-rest-service/api/symphony/process-instances/ml_IFS_passthrough"
232
- response = request("POST", btw_url, headers=headers, data=ifs_json)
233
- if str(response.status_code) == "200":
234
- result = "OK"
235
- else:
236
- message = str(response.status_code)
237
- case_id.write(
238
- {
239
- "info_message": (
240
- (case_id.info_message + "\n" + message + str(response.text))
241
- if case_id.info_message
242
- else message + str(response.text)
243
- )
244
- }
245
- )
246
- except Exception as e:
247
- case_id.write(
248
- {
249
- "info_message": (
250
- (case_id.info_message + "\n" + str(e))
251
- if case_id.info_message
252
- else str(e)
253
- )
254
- }
255
- )</field>
256
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
257
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
258
- <field name="is_a_postalizer_phase">False</field>
259
- <field name="is_compute_refund">False</field>
260
- <field name="is_dl">False</field>
261
- <field name="is_needs_child_case">False</field>
262
- <field name="is_pick_refund_template">False</field>
263
- <field name="is_process_managed">False</field>
264
- <field name="is_quote_accepted">False</field>
265
- <field name="is_quote_sent">False</field>
266
- <field name="is_timeout">False</field>
267
- <field name="is_voidable">False</field>
268
- <field name="name">A1559 - Invio alla Market Communication</field>
269
- <field name="set_result_automatically">from_code</field>
270
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
271
- <field name="is_externally_integrated">False</field>
272
- <field name="is_process_cancellable_relaunchable">False</field>
273
- <field name="wizard_info">{"key":"value"}</field>
274
- <field name="phase_code">F-ML-GM08-3-0005</field>
275
- <field name="check_closed_child_tickets">False</field>
276
- </record>
277
- <record id="symple_triplet_phase_A1715_-_In_attesa_check_IFS" model="symple.triplet.phase">
278
- <field name="active">True</field>
279
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2224_-_OK_-_Ammissibilit__Hub_E-ML-GM08-3-0017'),ref('symple_triplet_phase_result_C2225_-_KO_-_Ammissibilit__Hub_E-ML-GM08-3-0018'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0019'),ref('symple_triplet_phase_result_C1001_-_Annullamento_E-ML-GM08-3-00096')])]"/>
280
- <field name="child_case">False</field>
281
- <field name="code"># Available variables:
282
- # - case_id: the case that just reached this phase
283
- # - request: allows you to make HTTP requests (method, url, headers, data)
284
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
285
- # - json_load: allows you to use JSON.load to convert a json into an object
286
- # - env: Odoo Environment on which the action is triggered
287
- # - time, datetime, dateutil, timezone: useful Python libraries
288
- # - float_compare: Odoo function to compare floats based on specific precisions
289
- # - ValidationError: Warning Exception to use with raise
290
- # - Command: x2Many commands namespace
291
- # - OrderedDict: ordered dictionaries
292
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
293
- # (line = case id, func = phase name)
294
- # To return a result, assign: result = {...}
295
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
296
- # phase result will not be set.
297
-
298
-
299
-
300
- </field>
301
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
302
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
303
- <field name="is_a_postalizer_phase">False</field>
304
- <field name="is_compute_refund">False</field>
305
- <field name="is_dl">False</field>
306
- <field name="is_needs_child_case">False</field>
307
- <field name="is_pick_refund_template">False</field>
308
- <field name="is_process_managed">False</field>
309
- <field name="is_quote_accepted">False</field>
310
- <field name="is_quote_sent">False</field>
311
- <field name="is_timeout">False</field>
312
- <field name="is_voidable">False</field>
313
- <field name="name">A1715 - In attesa check IFS</field>
314
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
315
- <field name="is_externally_integrated">False</field>
316
- <field name="is_process_cancellable_relaunchable">False</field>
317
- <field name="wizard_info">{"key":"value"}</field>
318
- <field name="phase_code">F-ML-GM08-3-0006</field>
319
- <field name="check_closed_child_tickets">False</field>
320
- </record>
321
- <record id="symple_triplet_phase_A1717_-_Gestione_scarti_da_cruscotto" model="symple.triplet.phase">
322
- <field name="active">True</field>
323
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2416_-_Risottomessa_da_cruscotto_E-ML-GM08-3-0020'),ref('symple_triplet_phase_result_C1931_-_Errore_non_rilavorabile_E-ML-GM08-3-0021'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0022')])]"/>
324
- <field name="child_case">False</field>
325
- <field name="code"># Available variables:
326
- # - case_id: the case that just reached this phase
327
- # - request: allows you to make HTTP requests (method, url, headers, data)
328
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
329
- # - json_load: allows you to use JSON.load to convert a json into an object
330
- # - env: Odoo Environment on which the action is triggered
331
- # - time, datetime, dateutil, timezone: useful Python libraries
332
- # - float_compare: Odoo function to compare floats based on specific precisions
333
- # - ValidationError: Warning Exception to use with raise
334
- # - Command: x2Many commands namespace
335
- # - OrderedDict: ordered dictionaries
336
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
337
- # (line = case id, func = phase name)
338
- # To return a result, assign: result = {...}
339
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
340
- # phase result will not be set.
341
-
342
-
343
-
344
- </field>
345
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
346
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
347
- <field name="is_a_postalizer_phase">False</field>
348
- <field name="is_compute_refund">False</field>
349
- <field name="is_dl">False</field>
350
- <field name="is_needs_child_case">False</field>
351
- <field name="is_pick_refund_template">False</field>
352
- <field name="is_process_managed">False</field>
353
- <field name="is_quote_accepted">False</field>
354
- <field name="is_quote_sent">False</field>
355
- <field name="is_timeout">False</field>
356
- <field name="is_voidable">False</field>
357
- <field name="name">A1717 - Gestione scarti da cruscotto</field>
358
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
359
- <field name="is_externally_integrated">False</field>
360
- <field name="is_process_cancellable_relaunchable">False</field>
361
- <field name="wizard_info">{"key":"value"}</field>
362
- <field name="phase_code">F-ML-GM08-3-0007</field>
363
- <field name="check_closed_child_tickets">False</field>
364
- </record>
365
- <record id="symple_triplet_phase_A0823_-_Inserimento_richiesta_sul_Portale_del_DL" model="symple.triplet.phase">
366
- <field name="active">True</field>
367
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C3117_-_OK_pratica_inserita_E-ML-GM08-3-0023'),ref('symple_triplet_phase_result_C3119_-_gestione_manuale_E-ML-GM08-3-0024'),ref('symple_triplet_phase_result_C1001_-_Annullamento_E-ML-GM08-3-0025'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0026')])]"/>
368
- <field name="child_case">False</field>
369
- <field name="code"># Available variables:
370
- # - case_id: the case that just reached this phase
371
- # - request: allows you to make HTTP requests (method, url, headers, data)
372
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
373
- # - json_load: allows you to use JSON.load to convert a json into an object
374
- # - env: Odoo Environment on which the action is triggered
375
- # - time, datetime, dateutil, timezone: useful Python libraries
376
- # - float_compare: Odoo function to compare floats based on specific precisions
377
- # - ValidationError: Warning Exception to use with raise
378
- # - Command: x2Many commands namespace
379
- # - OrderedDict: ordered dictionaries
380
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
381
- # (line = case id, func = phase name)
382
- # To return a result, assign: result = {...}
383
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
384
- # phase result will not be set.
385
-
386
-
387
-
388
- </field>
389
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
390
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
391
- <field name="is_a_postalizer_phase">False</field>
392
- <field name="is_compute_refund">False</field>
393
- <field name="is_dl">False</field>
394
- <field name="is_needs_child_case">False</field>
395
- <field name="is_pick_refund_template">False</field>
396
- <field name="is_process_managed">False</field>
397
- <field name="is_quote_accepted">False</field>
398
- <field name="is_quote_sent">False</field>
399
- <field name="is_timeout">False</field>
400
- <field name="is_voidable">False</field>
401
- <field name="name">A0823 - Inserimento richiesta sul Portale del DL</field>
402
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
403
- <field name="is_externally_integrated">False</field>
404
- <field name="is_process_cancellable_relaunchable">False</field>
405
- <field name="wizard_info">{"key":"value"}</field>
406
- <field name="phase_code">F-ML-GM08-3-0008</field>
407
- <field name="check_closed_child_tickets">False</field>
408
- </record>
409
- <record id="symple_triplet_phase_A1880_-_Verifica_Tipologia_di_Comunicazione" model="symple.triplet.phase">
410
- <field name="active">True</field>
411
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2602_-_Tipologia_RPA_E-ML-GM08-3-0027'),ref('symple_triplet_phase_result_C2603_-_Tipologia_PEC_E-ML-GM08-3-0028'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0029')])]"/>
412
- <field name="child_case">False</field>
413
- <field name="code"># Available variables:
414
- # - case_id: the case that just reached this phase
415
- # - request: allows you to make HTTP requests (method, url, headers, data)
416
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
417
- # - json_load: allows you to use JSON.load to convert a json into an object
418
- # - env: Odoo Environment on which the action is triggered
419
- # - time, datetime, dateutil, timezone: useful Python libraries
420
- # - float_compare: Odoo function to compare floats based on specific precisions
421
- # - ValidationError: Warning Exception to use with raise
422
- # - Command: x2Many commands namespace
423
- # - OrderedDict: ordered dictionaries
424
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
425
- # (line = case id, func = phase name)
426
- # To return a result, assign: result = {...}
427
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
428
- # phase result will not be set.
429
-
430
-
431
-
432
- </field>
433
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
434
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
435
- <field name="is_a_postalizer_phase">False</field>
436
- <field name="is_compute_refund">False</field>
437
- <field name="is_dl">False</field>
438
- <field name="is_needs_child_case">False</field>
439
- <field name="is_pick_refund_template">False</field>
440
- <field name="is_process_managed">False</field>
441
- <field name="is_quote_accepted">False</field>
442
- <field name="is_quote_sent">False</field>
443
- <field name="is_timeout">False</field>
444
- <field name="is_voidable">False</field>
445
- <field name="name">A1880 - Verifica Tipologia di Comunicazione</field>
446
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
447
- <field name="is_externally_integrated">False</field>
448
- <field name="is_process_cancellable_relaunchable">False</field>
449
- <field name="wizard_info">{"key":"value"}</field>
450
- <field name="phase_code">F-ML-GM08-3-0009</field>
451
- <field name="check_closed_child_tickets">False</field>
452
- </record>
453
- <record id="symple_triplet_phase_A0816_-_In_attesa_esito_ammissibilit_" model="symple.triplet.phase">
454
- <field name="active">True</field>
455
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1037_-_Ammissibilit__OK_E-ML-GM08-3-0030'),ref('symple_triplet_phase_result_C1038_-_Ammissibilit__KO_E-ML-GM08-3-0031'),ref('symple_triplet_phase_result_C1001_-_Annullamento_E-ML-GM08-3-0032'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0033')])]"/>
456
- <field name="child_case">False</field>
457
- <field name="code"># Available variables:
458
- # - case_id: the case that just reached this phase
459
- # - request: allows you to make HTTP requests (method, url, headers, data)
460
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
461
- # - json_load: allows you to use JSON.load to convert a json into an object
462
- # - env: Odoo Environment on which the action is triggered
463
- # - time, datetime, dateutil, timezone: useful Python libraries
464
- # - float_compare: Odoo function to compare floats based on specific precisions
465
- # - ValidationError: Warning Exception to use with raise
466
- # - Command: x2Many commands namespace
467
- # - OrderedDict: ordered dictionaries
468
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
469
- # (line = case id, func = phase name)
470
- # To return a result, assign: result = {...}
471
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
472
- # phase result will not be set.
473
-
474
-
475
-
476
- </field>
477
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
478
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
479
- <field name="is_a_postalizer_phase">False</field>
480
- <field name="is_compute_refund">False</field>
481
- <field name="is_dl">False</field>
482
- <field name="is_needs_child_case">False</field>
483
- <field name="is_pick_refund_template">False</field>
484
- <field name="is_process_managed">False</field>
485
- <field name="is_quote_accepted">False</field>
486
- <field name="is_quote_sent">False</field>
487
- <field name="is_timeout">False</field>
488
- <field name="is_voidable">False</field>
489
- <field name="name">A0816 - In attesa esito ammissibilità</field>
490
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
491
- <field name="is_externally_integrated">False</field>
492
- <field name="is_process_cancellable_relaunchable">False</field>
493
- <field name="wizard_info">{"key":"value"}</field>
494
- <field name="phase_code">F-ML-GM08-3-0010</field>
495
- <field name="check_closed_child_tickets">False</field>
496
- </record>
497
- <record id="symple_triplet_phase_A1761_-_Verifica_Inserimento_richiesta_su_Portale_DL" model="symple.triplet.phase">
498
- <field name="active">True</field>
499
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1035_-_Inserita_richiesta_sul_portale_del_DL_E-ML-GM08-3-0034'),ref('symple_triplet_phase_result_C2463_-_Gestito_Fuori_linea_E-ML-GM08-3-0035'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0036')])]"/>
500
- <field name="child_case">False</field>
501
- <field name="code"># Available variables:
502
- # - case_id: the case that just reached this phase
503
- # - request: allows you to make HTTP requests (method, url, headers, data)
504
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
505
- # - json_load: allows you to use JSON.load to convert a json into an object
506
- # - env: Odoo Environment on which the action is triggered
507
- # - time, datetime, dateutil, timezone: useful Python libraries
508
- # - float_compare: Odoo function to compare floats based on specific precisions
509
- # - ValidationError: Warning Exception to use with raise
510
- # - Command: x2Many commands namespace
511
- # - OrderedDict: ordered dictionaries
512
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
513
- # (line = case id, func = phase name)
514
- # To return a result, assign: result = {...}
515
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
516
- # phase result will not be set.
517
-
518
-
519
-
520
- </field>
521
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
522
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
523
- <field name="is_a_postalizer_phase">False</field>
524
- <field name="is_compute_refund">False</field>
525
- <field name="is_dl">False</field>
526
- <field name="is_needs_child_case">False</field>
527
- <field name="is_pick_refund_template">False</field>
528
- <field name="is_process_managed">False</field>
529
- <field name="is_quote_accepted">False</field>
530
- <field name="is_quote_sent">False</field>
531
- <field name="is_timeout">False</field>
532
- <field name="is_voidable">False</field>
533
- <field name="name">A1761 - Verifica Inserimento richiesta su Portale DL</field>
534
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
535
- <field name="is_externally_integrated">False</field>
536
- <field name="is_process_cancellable_relaunchable">False</field>
537
- <field name="wizard_info">{"key":"value"}</field>
538
- <field name="phase_code">F-ML-GM08-3-0011</field>
539
- <field name="check_closed_child_tickets">False</field>
540
- </record>
541
- <record id="symple_triplet_phase_A0825_-_In_attesa_Esito_finale" model="symple.triplet.phase">
542
- <field name="active">True</field>
543
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1526_-_Esito_finale_OK_-_Interruzione_E-ML-GM08-3-0037'),ref('symple_triplet_phase_result_C1043_-_Esito_finale_KO_E-ML-GM08-3-0038'),ref('symple_triplet_phase_result_C2655_-_Richiesta_Gestione_Sollecito_E-ML-GM08-3-0039'),ref('symple_triplet_phase_result_C1001_-_Annullamento_E-ML-GM08-3-0040'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0041')])]"/>
544
- <field name="child_case">False</field>
545
- <field name="code"># Available variables:
546
- # - case_id: the case that just reached this phase
547
- # - request: allows you to make HTTP requests (method, url, headers, data)
548
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
549
- # - json_load: allows you to use JSON.load to convert a json into an object
550
- # - env: Odoo Environment on which the action is triggered
551
- # - time, datetime, dateutil, timezone: useful Python libraries
552
- # - float_compare: Odoo function to compare floats based on specific precisions
553
- # - ValidationError: Warning Exception to use with raise
554
- # - Command: x2Many commands namespace
555
- # - OrderedDict: ordered dictionaries
556
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
557
- # (line = case id, func = phase name)
558
- # To return a result, assign: result = {...}
559
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
560
- # phase result will not be set.
561
-
562
-
563
-
564
- </field>
565
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
566
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
567
- <field name="is_a_postalizer_phase">False</field>
568
- <field name="is_compute_refund">False</field>
569
- <field name="is_dl">False</field>
570
- <field name="is_needs_child_case">False</field>
571
- <field name="is_pick_refund_template">False</field>
572
- <field name="is_process_managed">False</field>
573
- <field name="is_quote_accepted">False</field>
574
- <field name="is_quote_sent">False</field>
575
- <field name="is_timeout">False</field>
576
- <field name="is_voidable">True</field>
577
- <field name="name">A0825 - In attesa Esito finale</field>
578
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
579
- <field name="is_externally_integrated">False</field>
580
- <field name="is_process_cancellable_relaunchable">False</field>
581
- <field name="wizard_info">{"key":"value"}</field>
582
- <field name="phase_code">F-ML-GM08-3-0012</field>
583
- <field name="check_closed_child_tickets">False</field>
584
- </record>
585
- <record id="symple_triplet_phase_A1312_-_Controlli_CRM_per_Taglio_Colonna" model="symple.triplet.phase">
586
- <field name="active">True</field>
587
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1613_-_Controlli_CRM_OK_E-ML-GM08-3-0042'),ref('symple_triplet_phase_result_C1614_-_Controlli_CRM_KO_E-ML-GM08-3-0043')])]"/>
588
- <field name="child_case">False</field>
589
- <field name="code"># Available variables:
590
- # - case_id: the case that just reached this phase
591
- # - request: allows you to make HTTP requests (method, url, headers, data)
592
- # - json_dumps: allows you to use JSON.dumps to converto object to json
593
- # - env: Odoo Environment on which the action is triggered
594
- # - time, datetime, dateutil, timezone: useful Python libraries
595
- # - float_compare: Odoo function to compare floats based on specific precisions
596
- # - ValidationError: Warning Exception to use with raise
597
- # - Command: x2Many commands namespace
598
- # - OrderedDict: ordered dictionaries
599
- # To return a result, assign: result = {...}
600
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
601
- # phase result will not be set.
602
-
603
- logs = []
604
- IrConfigParam = env["ir.config_parameter"]
605
-
606
-
607
- def get_assets(client_id, code):
608
- token = IrConfigParam.get_b2w_access_token()
609
- url = IrConfigParam.get_param("b2w_order_management_endpoint") + "assets"
610
- headers = {"Authorization": "Bearer " + token, "Content-Type": "application/json"}
611
-
612
- body = json_dumps(
613
- {
614
- "filters": [
615
- {"field": "accountcode", "type": "=", "value": str(client_id)},
616
- {"field": "type", "type": "=", "value": "product"},
617
- {"field": "podcode", "type": "=", "value": code},
618
- ],
619
- "sorters": [{"field": "created_date", "direction": "desc"}],
620
- "page": 1,
621
- "size": 999999,
622
- }
623
- )
624
-
625
- response = request("POST", url, headers=headers, data=body)
626
-
627
- if response.status_code != 200:
628
- try:
629
- logs.append({"message": "response json", "data": response.json()})
630
- except Exception:
631
- logs.append({"message": "response text", "data": response.text})
632
-
633
- raise Exception("Non è stato possibile scaricare gli asset")
634
-
635
- json = response.json()
636
- return json.get("items", [])
637
-
638
-
639
- def all_disconnected(assets):
640
- for asset in assets:
641
- if asset.get("sm_state") != "cessato":
642
- return False
643
- return True
644
-
645
-
646
- def disconnectable(assets):
647
- r = []
648
- for asset in assets:
649
- if asset.get("sm_state") == "attivo":
650
- r.append(asset)
651
- return r
652
-
653
-
654
- try:
655
- client_id = case_id.customer_id.id
656
- if not case_id.pdr_ids:
657
- raise ValidationError("Non è possibile creare un case di Morosità senza POD")
658
-
659
- if not case_id.service_point_ids:
660
- raise ValidationError("Nessun service point trovato per il POD")
661
-
662
- point = case_id.pod_ids[0] if case_id.pod_ids else case_id.pdr_ids[0]
663
-
664
- assets = get_assets(client_id, point.code)
665
- d = disconnectable(assets)
666
- case_id.sudo().kv_store().set("assets", d)
667
-
668
- if len(assets) == 0:
669
- case_id.write(
670
- {
671
- "error_message": "The POD {} does not exist in the CRM".format(
672
- point.code,
673
- )
674
- }
675
- )
676
- elif all_disconnected(assets):
677
- raise ValidationError("PDR already disconnected")
678
- else:
679
- if len(d) > 1:
680
- raise ValidationError("More than one POD instance active in the CRM")
681
- else:
682
- result = "OK"
683
-
684
-
685
- except Exception as inst:
686
- case_id.write({"error_message": str(inst)})
687
- logs.append(
688
- {
689
- "message": "Exception occurred",
690
- "data": {"exception": str(inst), "traceback": format_exc()},
691
- }
692
- )
693
-
694
- if logs:
695
- log(json_dumps(logs, indent=2))</field>
696
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
697
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
698
- <field name="is_a_postalizer_phase">False</field>
699
- <field name="is_compute_refund">False</field>
700
- <field name="is_dl">False</field>
701
- <field name="is_needs_child_case">False</field>
702
- <field name="is_pick_refund_template">False</field>
703
- <field name="is_process_managed">False</field>
704
- <field name="is_quote_accepted">False</field>
705
- <field name="is_quote_sent">False</field>
706
- <field name="is_timeout">False</field>
707
- <field name="is_voidable">False</field>
708
- <field name="name">A1312 - Controlli CRM per Taglio Colonna</field>
709
- <field name="set_result_automatically">from_code</field>
710
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
711
- <field name="is_externally_integrated">False</field>
712
- <field name="is_process_cancellable_relaunchable">False</field>
713
- <field name="wizard_info">{"key":"value"}</field>
714
- <field name="phase_code">F-ML-GM08-3-0013</field>
715
- <field name="check_closed_child_tickets">False</field>
716
- </record>
717
- <record id="symple_triplet_phase_A1316_-_CRM_-_Creazione_Ordine_per_Taglio_Colonna" model="symple.triplet.phase">
718
- <field name="active">True</field>
719
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1891_-_OK_-_Creazione_Ordine_E-ML-GM08-3-0044'),ref('symple_triplet_phase_result_C1892_-_KO_-_Creazione_Ordine_CRM_E-ML-GM08-3-0045')])]"/>
720
- <field name="child_case">False</field>
721
- <field name="code"># Available variables:
722
- # - case_id: the case that just reached this phase
723
- # - request: allows you to make HTTP requests (method, url, headers, data)
724
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
725
- # - json_load: allows you to use JSON.load to convert a json into an object
726
- # - env: Odoo Environment on which the action is triggered
727
- # - time, datetime, dateutil, timezone: useful Python libraries
728
- # - float_compare: Odoo function to compare floats based on specific precisions
729
- # - ValidationError: Warning Exception to use with raise
730
- # - Command: x2Many commands namespace
731
- # - OrderedDict: ordered dictionaries
732
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
733
- # (line = case id, func = phase name)
734
- # To return a result, assign: result = {...}
735
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
736
- # phase result will not be set.
737
-
738
- logs = []
739
-
740
-
741
- def log_and_parse_response(response, log_message):
742
- try:
743
- json_data = response.json()
744
- logs.append({"message": log_message, "data": json_data})
745
- return json_data
746
- except Exception:
747
- logs.append({"message": log_message, "response_text": response.text})
748
- return response.text
749
-
750
-
751
- def get_asset(code):
752
- assets = env["ir.config_parameter"].get_assets(
753
- asset_id=None,
754
- additional_params={"prcode": code, "assetstatus": "Active", "rootvid": "null"},
755
- )
756
-
757
- return assets[0]
758
-
759
-
760
- def create_order_disconnect(asset_id, token):
761
- url = "http://b2w-cpq-order-management-service/v1/order"
762
- headers = {
763
- "X-Auth-Request-Access-Token": "" + token,
764
- "Content-Type": "application/json",
765
- "generatesession": "true",
766
- }
767
- body = {
768
- "obj_type": "Order",
769
- "crm_accountcode": case_id.customer_id.user_sequence,
770
- "accountcode": str(case_id.customer_id.id),
771
- "type": "Disconnect",
772
- "subtype": case_id.ticket_type_id.name,
773
- "industry": "BSP Utility",
774
- "commodity": "power" if case_id.service_point_ids[0].pod_id else "gas",
775
- "order_date": datetime.datetime.now().strftime("%Y-%m-%d"),
776
- "contract": True,
777
- "singlecontract": True,
778
- "assets": [asset_id],
779
- "options": {
780
- "userLanguage": "en-US",
781
- "remotePagination": True,
782
- "itemsForPage": 10,
783
- "cartItemsForPage": 10,
784
- },
785
- }
786
-
787
- logs.append(
788
- {"message": "Creating order", "data": {"body": body, "headers": headers}}
789
- )
790
-
791
- response = request("POST", url, headers=headers, data=json_dumps(body))
792
- json = log_and_parse_response(
793
- response,
794
- "Order creation response",
795
- )
796
-
797
- if response.status_code != 200:
798
- raise ValidationError("Failed to create order")
799
-
800
- return json
801
-
802
-
803
- def bind_catalog(config_id, catalog_id, token):
804
- logs.append(
805
- {
806
- "message": "Binding catalog and order",
807
- "data": {
808
- "config_id": config_id,
809
- "catalog_id": catalog_id,
810
- },
811
- }
812
- )
813
-
814
- headers = {
815
- "X-Auth-Request-Access-Token": "" + token,
816
- "Content-Type": "application/json",
817
- "generatesession": "true",
818
- }
819
- url = "http://b2w-cpq-catalog-navigator-node-service/v1/configurations/{}/catalogs/{}".format(
820
- config_id, catalog_id
821
- )
822
-
823
- response = request("GET", url, headers=headers)
824
- json = log_and_parse_response(
825
- response,
826
- "Catalog binding response",
827
- )
828
-
829
- if response.status_code != 200:
830
- raise ValidationError("Failed to set catalog id on order")
831
-
832
- return json
833
-
834
-
835
- def checkout(config_id, token):
836
- logs.append(
837
- {
838
- "message": "Binding catalog and order",
839
- "data": {
840
- "config_id": config_id,
841
- },
842
- }
843
- )
844
-
845
- headers = {
846
- "X-Auth-Request-Access-Token": "" + token,
847
- "Content-Type": "application/json",
848
- "generatesession": "true",
849
- }
850
- url = "http://b2w-cpq-order-management-service/v1/order/{}".format(config_id)
851
-
852
- response = request("POST", url, headers=headers, data="{}")
853
- json = log_and_parse_response(
854
- response,
855
- "Checkout response",
856
- )
857
-
858
- if response.status_code != 200:
859
- raise ValidationError("Failed to checkout")
860
-
861
- return json
862
-
863
-
864
- try:
865
- StagingArea = env["symple.pb.process.data"]
866
- IrConfigParam = env["ir.config_parameter"].sudo()
867
- token = IrConfigParam.get_b2w_access_token()
868
-
869
- code = case_id.service_point_ids[0].code
870
- asset = get_asset(code)
871
- catalog_id = asset["catalogid"]
872
- logs.append({"message": "Asset loaded", "data": asset})
873
- order = create_order_disconnect(asset["_id"], token)
874
- order_id = order["_id"]
875
- config_id = order["conf_id"]
876
- logs.append({"message": "Order created", "data": order})
877
- bind_catalog(config_id, catalog_id, token)
878
- checkout(config_id, token)
879
-
880
- IrConfigParam.update_b2w_statemodel(
881
- "in_cessazione", asset_id=asset["_id"], sm_reason=case_id.ticket_type_id.name
882
- )
883
- case_id.service_point_ids.sudo().write({"state": "deactivating"})
884
-
885
- case_id.kv_store().set_many(
886
- {
887
- "config_id": config_id,
888
- "order_id": order_id,
889
- "asset_id": asset["_id"],
890
- "catalog_id": catalog_id,
891
- }
892
- )
893
-
894
- result = "OK"
895
-
896
- except Exception as e:
897
- logs.append({"message": str(e), "traceback": format_exc()})
898
- case_id.write({"error_message": str(e)})
899
-
900
-
901
- if logs:
902
- log(json_dumps(logs))</field>
903
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
904
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
905
- <field name="is_a_postalizer_phase">False</field>
906
- <field name="is_compute_refund">False</field>
907
- <field name="is_dl">False</field>
908
- <field name="is_needs_child_case">False</field>
909
- <field name="is_pick_refund_template">False</field>
910
- <field name="is_process_managed">False</field>
911
- <field name="is_quote_accepted">False</field>
912
- <field name="is_quote_sent">False</field>
913
- <field name="is_timeout">False</field>
914
- <field name="is_voidable">False</field>
915
- <field name="name">A1316 - CRM - Creazione Ordine per Taglio Colonna</field>
916
- <field name="set_result_automatically">from_code</field>
917
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
918
- <field name="is_externally_integrated">False</field>
919
- <field name="is_process_cancellable_relaunchable">False</field>
920
- <field name="wizard_info">{"key":"value"}</field>
921
- <field name="phase_code">F-ML-GM08-3-0014</field>
922
- <field name="check_closed_child_tickets">False</field>
923
- </record>
924
- <record id="symple_triplet_phase_A1313_-_Integrazione_M2C_per_Taglio_Colonna" model="symple.triplet.phase">
925
- <field name="active">True</field>
926
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1888_-_OK_-_Integrazione_M2C_per_Taglio_Colonna_E-ML-GM08-3-0046'),ref('symple_triplet_phase_result_C1895_-_KO_-_Errore_Integrazione_M2C_E-ML-GM08-3-0047')])]"/>
927
- <field name="child_case">False</field>
928
- <field name="code"># Available variables:
929
- # - case_id: the case that just reached this phase
930
- # - request: allows you to make HTTP requests (method, url, headers, data)
931
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
932
- # - json_load: allows you to use JSON.load to convert a json into an object
933
- # - env: Odoo Environment on which the action is triggered
934
- # - time, datetime, dateutil, timezone: useful Python libraries
935
- # - float_compare: Odoo function to compare floats based on specific precisions
936
- # - ValidationError: Warning Exception to use with raise
937
- # - Command: x2Many commands namespace
938
- # - OrderedDict: ordered dictionaries
939
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
940
- # (line = case id, func = phase name)
941
- # To return a result, assign: result = {...}
942
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
943
- # phase result will not be set.
944
-
945
- logs = []
946
-
947
- try:
948
- logs.append({"message": "Starting M2C integration"})
949
- tenant_id = env["ir.config_parameter"].sudo().get_param("m2c_header_tenant_id")
950
- org_token = env["ir.config_parameter"].sudo().get_param("m2c_header_org_token")
951
- headers = {"tenantId": tenant_id, "orgToken": org_token}
952
-
953
- StagingArea = env["symple.pb.process.data"]
954
- wizard_data_record = StagingArea.search(
955
- [("res_id", "=", case_id.id), ("process_name", "=", "ml_taglio_colonna")],
956
- limit=1,
957
- order="create_date DESC",
958
- )
959
- wizard_payload = wizard_data_record.get_payload()
960
-
961
- end_date = wizard_data_record.get("end_date")
962
-
963
- m2c_payload_debug = {
964
- "case_id": case_id.id,
965
- "tripet": case_id.ticket_type_id.name,
966
- "is_contratti_mandato": True,
967
- "service_points": [case_id.service_point_ids[0].id],
968
- "causale_cessazione": case_id.ticket_type_id.name,
969
- "fine_contratto": str(end_date),
970
- "is_contratti": True,
971
- }
972
-
973
- logs.append(
974
- {
975
- "message": "Calling prepare_m2c_passthrough_payload",
976
- "data": m2c_payload_debug,
977
- }
978
- )
979
-
980
- IrConfigParameter = env["ir.config_parameter"]
981
- m2c_dict = IrConfigParameter.prepare_m2c_passthrough_payload(
982
- case_id,
983
- case_id.ticket_type_id.name,
984
- is_contratti_mandato=True,
985
- service_points=[case_id.service_point_ids[0].id],
986
- is_contratti=True,
987
- contatti_array=[],
988
- contrattiMandatoDettaglio_array=[],
989
- causale_cessazione=case_id.ticket_type_id.name,
990
- fine_contratto=end_date,
991
- fine_contratto_fornitura=end_date,
992
- )
993
-
994
- logs.append({"message": "M2C dict", "data": m2c_dict})
995
-
996
- m2c_url = IrConfigParameter.sudo().get_param("m2c_passthrough_url")
997
- response = request("POST", m2c_url, headers=headers, data=m2c_dict)
998
-
999
- result = "OK"
1000
-
1001
- except Exception as e:
1002
- logs.append({"level": "error", "message": str(e), "traceback": format_exc()})
1003
- prev = case_id.info_message + "\n" if case_id.info_message else ""
1004
- case_id.write({"info_message": prev + str(e)})
1005
-
1006
- if logs:
1007
- log(json_dumps(logs))</field>
1008
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1009
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1010
- <field name="is_a_postalizer_phase">False</field>
1011
- <field name="is_compute_refund">False</field>
1012
- <field name="is_dl">False</field>
1013
- <field name="is_needs_child_case">False</field>
1014
- <field name="is_pick_refund_template">False</field>
1015
- <field name="is_process_managed">False</field>
1016
- <field name="is_quote_accepted">False</field>
1017
- <field name="is_quote_sent">False</field>
1018
- <field name="is_timeout">False</field>
1019
- <field name="is_voidable">False</field>
1020
- <field name="name">A1313 - Integrazione M2C per Taglio Colonna</field>
1021
- <field name="set_result_automatically">from_code</field>
1022
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1023
- <field name="is_externally_integrated">False</field>
1024
- <field name="is_process_cancellable_relaunchable">False</field>
1025
- <field name="wizard_info">{"key":"value"}</field>
1026
- <field name="phase_code">F-ML-GM08-3-0015</field>
1027
- <field name="check_closed_child_tickets">False</field>
1028
- </record>
1029
- <record id="symple_triplet_phase_A1314_-_In_Attesa_M2C_per_Taglio_Colonna" model="symple.triplet.phase">
1030
- <field name="active">True</field>
1031
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1890_-_OK_-_Esito_M2C_E-ML-GM08-3-0048'),ref('symple_triplet_phase_result_C1919_-_Errore_in_fase_di_Attesa_Esito_M2C_per_Taglio_Colonna_E-ML-GM08-3-0049')])]"/>
1032
- <field name="child_case">False</field>
1033
- <field name="code"># Available variables:
1034
- # - case_id: the case that just reached this phase
1035
- # - request: allows you to make HTTP requests (method, url, headers, data)
1036
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1037
- # - json_load: allows you to use JSON.load to convert a json into an object
1038
- # - env: Odoo Environment on which the action is triggered
1039
- # - time, datetime, dateutil, timezone: useful Python libraries
1040
- # - float_compare: Odoo function to compare floats based on specific precisions
1041
- # - ValidationError: Warning Exception to use with raise
1042
- # - Command: x2Many commands namespace
1043
- # - OrderedDict: ordered dictionaries
1044
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1045
- # (line = case id, func = phase name)
1046
- # To return a result, assign: result = {...}
1047
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1048
- # phase result will not be set.
1049
-
1050
-
1051
-
1052
- </field>
1053
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1054
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1055
- <field name="is_a_postalizer_phase">False</field>
1056
- <field name="is_compute_refund">False</field>
1057
- <field name="is_dl">False</field>
1058
- <field name="is_needs_child_case">False</field>
1059
- <field name="is_pick_refund_template">False</field>
1060
- <field name="is_process_managed">False</field>
1061
- <field name="is_quote_accepted">False</field>
1062
- <field name="is_quote_sent">False</field>
1063
- <field name="is_timeout">False</field>
1064
- <field name="is_voidable">False</field>
1065
- <field name="name">A1314 - In Attesa M2C per Taglio Colonna</field>
1066
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1067
- <field name="is_externally_integrated">False</field>
1068
- <field name="is_process_cancellable_relaunchable">False</field>
1069
- <field name="wizard_info">{"key":"value"}</field>
1070
- <field name="phase_code">F-ML-GM08-3-0016</field>
1071
- <field name="check_closed_child_tickets">False</field>
1072
- </record>
1073
- <record id="symple_triplet_phase_A1315_-_Aggiornamento_CRM_per_Taglio_Colonna" model="symple.triplet.phase">
1074
- <field name="active">True</field>
1075
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1889_-_OK_-_Aggiornamento_CRM_E-ML-GM08-3-0050'),ref('symple_triplet_phase_result_C1922_-_Errore_in_fase_Aggiornamento_CRM_per_Taglio_Colonna_E-ML-GM08-3-0051')])]"/>
1076
- <field name="child_case">False</field>
1077
- <field name="code"># Available variables:
1078
- # - case_id: the case that just reached this phase
1079
- # - request: allows you to make HTTP requests (method, url, headers, data)
1080
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1081
- # - json_load: allows you to use JSON.load to convert a json into an object
1082
- # - env: Odoo Environment on which the action is triggered
1083
- # - time, datetime, dateutil, timezone: useful Python libraries
1084
- # - float_compare: Odoo function to compare floats based on specific precisions
1085
- # - ValidationError: Warning Exception to use with raise
1086
- # - Command: x2Many commands namespace
1087
- # - OrderedDict: ordered dictionaries
1088
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1089
- # (line = case id, func = phase name)
1090
- # To return a result, assign: result = {...}
1091
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1092
- # phase result will not be set.
1093
-
1094
- logs = []
1095
-
1096
-
1097
- def log_and_parse_response(response, log_message):
1098
- try:
1099
- json_data = response.json()
1100
- logs.append({"message": log_message, "data": json_data})
1101
- return json_data
1102
- except Exception:
1103
- logs.append({"message": log_message, "response_text": response.text})
1104
- return response.text
1105
-
1106
-
1107
- def order2asset(order_id, token):
1108
- url = "http://b2w-cpq-order-management-service/v1/order/asset/{}".format(order_id)
1109
- headers = {
1110
- "X-Auth-Request-Access-Token": "" + token,
1111
- "Content-Type": "application/json",
1112
- "generatesession": "true",
1113
- }
1114
-
1115
- logs.append(
1116
- {"message": "Creating Order2Asset", "data": {"url": url, "headers": headers}}
1117
- )
1118
-
1119
- response = request("POST", url, headers=headers)
1120
- json = log_and_parse_response(
1121
- response,
1122
- "Order2Asset response",
1123
- )
1124
-
1125
- if response.status_code != 200:
1126
- raise ValidationError("Failed to launch order2asset")
1127
-
1128
- return json
1129
-
1130
-
1131
- try:
1132
- IrConfigParam = env["ir.config_parameter"].sudo()
1133
- token = IrConfigParam.get_b2w_access_token()
1134
-
1135
- order_id, asset_id = case_id.kv_store().get_many("order_id", "asset_id")
1136
-
1137
- order2asset(order_id, token)
1138
- logs.append({"message": "order2asset done"})
1139
- case_id.service_point_ids.sudo().write({"state": "inactive"})
1140
- IrConfigParam.update_b2w_statemodel(
1141
- "cessato", asset_id=asset_id, sm_reason=case_id.ticket_type_id.name
1142
- )
1143
-
1144
- case_id.service_point_ids[0].write(
1145
- {
1146
- "state": "inactive",
1147
- "supply_end_date": datetime.date.today().strftime("%Y-%m-%d"),
1148
- }
1149
- )
1150
-
1151
- logs.append({"message": "service point updated"})
1152
-
1153
- result = "OK"
1154
-
1155
- except Exception as e:
1156
- logs.append({"message": str(e), "traceback": format_exc()})
1157
- case_id.write({"error_message": str(e)})
1158
-
1159
-
1160
- if logs:
1161
- log(json_dumps(logs))</field>
1162
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1163
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1164
- <field name="is_a_postalizer_phase">False</field>
1165
- <field name="is_compute_refund">False</field>
1166
- <field name="is_dl">False</field>
1167
- <field name="is_needs_child_case">False</field>
1168
- <field name="is_pick_refund_template">False</field>
1169
- <field name="is_process_managed">False</field>
1170
- <field name="is_quote_accepted">False</field>
1171
- <field name="is_quote_sent">False</field>
1172
- <field name="is_timeout">False</field>
1173
- <field name="is_voidable">False</field>
1174
- <field name="name">A1315 - Aggiornamento CRM per Taglio Colonna</field>
1175
- <field name="set_result_automatically">from_code</field>
1176
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1177
- <field name="is_externally_integrated">False</field>
1178
- <field name="is_process_cancellable_relaunchable">False</field>
1179
- <field name="wizard_info">{"key":"value"}</field>
1180
- <field name="phase_code">F-ML-GM08-3-0017</field>
1181
- <field name="check_closed_child_tickets">False</field>
1182
- </record>
1183
- <record id="symple_triplet_phase_A1379_-_Apertura_Case_Invio_Onere" model="symple.triplet.phase">
1184
- <field name="active">True</field>
1185
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2003_-_OK_-_Case_di_invio_oneri_aperto_E-ML-GM08-3-0052')])]"/>
1186
- <field name="child_case">False</field>
1187
- <field name="code"># RES1 = C2003 - OK - Case di invio oneri aperto
1188
-
1189
- OK = "RES1"
1190
-
1191
- logs = []
1192
- debug_logs = []
1193
- error_occurred = False
1194
-
1195
-
1196
- def make_log(message, data=None, always=False):
1197
- log_entry = {"message": message}
1198
- if data is not None:
1199
- log_entry["data"] = data
1200
-
1201
- if always:
1202
- logs.append(log_entry)
1203
- else:
1204
- debug_logs.append(log_entry)
1205
-
1206
-
1207
- # --------------------------------------
1208
-
1209
-
1210
- def main():
1211
- detail = env["helpdesk.ticket.type"].search([("code", "=", "GM08-4")])
1212
- env["helpdesk.ticket"].create(
1213
- {
1214
- "name": case_id.symple_interaction_id.name,
1215
- "parent_case_id": case_id.id,
1216
- "description": case_id.symple_interaction_id.note,
1217
- "assign_date": datetime.datetime.now(),
1218
- "triplet_type_id": detail.subtype_id.type_id.id,
1219
- "triplet_subtype_id": detail.subtype_id.id,
1220
- "ticket_type_id": detail.id,
1221
- "symple_interaction_id": case_id.symple_interaction_id.id,
1222
- "triplet_phase_id": detail.workflow_id.triplet_phase_id.id,
1223
- "triplet_active_phase_id": detail.workflow_id.triplet_phase_id.id,
1224
- "pdr_ids": case_id.pdr_ids.ids,
1225
- "service_point_ids": case_id.service_point_ids.ids,
1226
- }
1227
- )
1228
-
1229
- return OK
1230
-
1231
-
1232
- try:
1233
- result = main()
1234
- except Exception as e:
1235
- error_occurred = True
1236
- make_log(
1237
- "Error occurred in phase",
1238
- {"error": str(e), "traceback": format_exc()},
1239
- always=True,
1240
- )
1241
- case_id.write({"error_message": str(e)})
1242
-
1243
-
1244
- if error_occurred and debug_logs:
1245
- logs.append({"message": "debug_logs", "logs": debug_logs})
1246
-
1247
- if logs:
1248
- log(json_dumps(logs, indent=2))</field>
1249
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1250
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1251
- <field name="is_a_postalizer_phase">False</field>
1252
- <field name="is_compute_refund">False</field>
1253
- <field name="is_dl">False</field>
1254
- <field name="is_needs_child_case">False</field>
1255
- <field name="is_pick_refund_template">False</field>
1256
- <field name="is_process_managed">False</field>
1257
- <field name="is_quote_accepted">False</field>
1258
- <field name="is_quote_sent">False</field>
1259
- <field name="is_timeout">False</field>
1260
- <field name="is_voidable">False</field>
1261
- <field name="name">A1379 - Apertura Case Invio Onere</field>
1262
- <field name="set_result_automatically">from_code</field>
1263
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1264
- <field name="is_externally_integrated">False</field>
1265
- <field name="is_process_cancellable_relaunchable">False</field>
1266
- <field name="wizard_info">{"key":"value"}</field>
1267
- <field name="phase_code">F-ML-GM08-3-0018</field>
1268
- <field name="check_closed_child_tickets">False</field>
1269
- </record>
1270
- <record id="symple_triplet_phase_A1317_-_Errore_in_fase_di_Controlli_CRM_per_Taglio_Colonna" model="symple.triplet.phase">
1271
- <field name="active">True</field>
1272
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1926_-_OK_-_Risolto_Errore_durante_Controlli_CRM_E-ML-GM08-3-0053'),ref('symple_triplet_phase_result_C1925_-_Annullamento_in_fase_di_Controlli_CRM_per_Taglio_Colonna_E-ML-GM08-3-0054')])]"/>
1273
- <field name="child_case">False</field>
1274
- <field name="code"># Available variables:
1275
- # - case_id: the case that just reached this phase
1276
- # - request: allows you to make HTTP requests (method, url, headers, data)
1277
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1278
- # - json_load: allows you to use JSON.load to convert a json into an object
1279
- # - env: Odoo Environment on which the action is triggered
1280
- # - time, datetime, dateutil, timezone: useful Python libraries
1281
- # - float_compare: Odoo function to compare floats based on specific precisions
1282
- # - ValidationError: Warning Exception to use with raise
1283
- # - Command: x2Many commands namespace
1284
- # - OrderedDict: ordered dictionaries
1285
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1286
- # (line = case id, func = phase name)
1287
- # To return a result, assign: result = {...}
1288
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1289
- # phase result will not be set.
1290
-
1291
-
1292
-
1293
- </field>
1294
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1295
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1296
- <field name="is_a_postalizer_phase">False</field>
1297
- <field name="is_compute_refund">False</field>
1298
- <field name="is_dl">False</field>
1299
- <field name="is_needs_child_case">False</field>
1300
- <field name="is_pick_refund_template">False</field>
1301
- <field name="is_process_managed">False</field>
1302
- <field name="is_quote_accepted">False</field>
1303
- <field name="is_quote_sent">False</field>
1304
- <field name="is_timeout">False</field>
1305
- <field name="is_voidable">False</field>
1306
- <field name="name">A1317 - Errore in fase di Controlli CRM per Taglio Colonna</field>
1307
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1308
- <field name="is_externally_integrated">False</field>
1309
- <field name="is_process_cancellable_relaunchable">False</field>
1310
- <field name="wizard_info">{"key":"value"}</field>
1311
- <field name="phase_code">F-ML-GM08-3-0019</field>
1312
- <field name="check_closed_child_tickets">False</field>
1313
- </record>
1314
- <record id="symple_triplet_phase_A1318_-_Errore_in_fase_di_Creazione_Ordine_CRM_per_Taglio_Colonna" model="symple.triplet.phase">
1315
- <field name="active">True</field>
1316
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1893_-_Annulla_Creazione_Ordine_CRM_E-ML-GM08-3-0055'),ref('symple_triplet_phase_result_C1894_-_OK_-_Errore_Risolto_Creazione_Ordine_E-ML-GM08-3-0056')])]"/>
1317
- <field name="child_case">False</field>
1318
- <field name="code"># Available variables:
1319
- # - case_id: the case that just reached this phase
1320
- # - request: allows you to make HTTP requests (method, url, headers, data)
1321
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1322
- # - json_load: allows you to use JSON.load to convert a json into an object
1323
- # - env: Odoo Environment on which the action is triggered
1324
- # - time, datetime, dateutil, timezone: useful Python libraries
1325
- # - float_compare: Odoo function to compare floats based on specific precisions
1326
- # - ValidationError: Warning Exception to use with raise
1327
- # - Command: x2Many commands namespace
1328
- # - OrderedDict: ordered dictionaries
1329
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1330
- # (line = case id, func = phase name)
1331
- # To return a result, assign: result = {...}
1332
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1333
- # phase result will not be set.
1334
-
1335
-
1336
-
1337
- </field>
1338
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1339
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1340
- <field name="is_a_postalizer_phase">False</field>
1341
- <field name="is_compute_refund">False</field>
1342
- <field name="is_dl">False</field>
1343
- <field name="is_needs_child_case">False</field>
1344
- <field name="is_pick_refund_template">False</field>
1345
- <field name="is_process_managed">False</field>
1346
- <field name="is_quote_accepted">False</field>
1347
- <field name="is_quote_sent">False</field>
1348
- <field name="is_timeout">False</field>
1349
- <field name="is_voidable">False</field>
1350
- <field name="name">A1318 - Errore in fase di Creazione Ordine CRM per Taglio Colonna</field>
1351
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1352
- <field name="is_externally_integrated">False</field>
1353
- <field name="is_process_cancellable_relaunchable">False</field>
1354
- <field name="wizard_info">{"key":"value"}</field>
1355
- <field name="phase_code">F-ML-GM08-3-0020</field>
1356
- <field name="check_closed_child_tickets">False</field>
1357
- </record>
1358
- <record id="symple_triplet_phase_A1319_-_Errore_in_fase_di_Integrazione_M2C_per_Taglio_Colonna" model="symple.triplet.phase">
1359
- <field name="active">True</field>
1360
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1917_-_Annulla_-_Integrazione_M2C_per_Taglio_Colonna_E-ML-GM08-3-0057'),ref('symple_triplet_phase_result_C1918_-_OK_-_Errore_Risolto_in_fase_Integrazione_M2C_per_Taglio_Colonna_E-ML-GM08-3-0058')])]"/>
1361
- <field name="child_case">False</field>
1362
- <field name="code"># Available variables:
1363
- # - case_id: the case that just reached this phase
1364
- # - request: allows you to make HTTP requests (method, url, headers, data)
1365
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1366
- # - json_load: allows you to use JSON.load to convert a json into an object
1367
- # - env: Odoo Environment on which the action is triggered
1368
- # - time, datetime, dateutil, timezone: useful Python libraries
1369
- # - float_compare: Odoo function to compare floats based on specific precisions
1370
- # - ValidationError: Warning Exception to use with raise
1371
- # - Command: x2Many commands namespace
1372
- # - OrderedDict: ordered dictionaries
1373
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1374
- # (line = case id, func = phase name)
1375
- # To return a result, assign: result = {...}
1376
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1377
- # phase result will not be set.
1378
-
1379
-
1380
-
1381
- </field>
1382
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1383
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1384
- <field name="is_a_postalizer_phase">False</field>
1385
- <field name="is_compute_refund">False</field>
1386
- <field name="is_dl">False</field>
1387
- <field name="is_needs_child_case">False</field>
1388
- <field name="is_pick_refund_template">False</field>
1389
- <field name="is_process_managed">False</field>
1390
- <field name="is_quote_accepted">False</field>
1391
- <field name="is_quote_sent">False</field>
1392
- <field name="is_timeout">False</field>
1393
- <field name="is_voidable">False</field>
1394
- <field name="name">A1319 - Errore in fase di Integrazione M2C per Taglio Colonna</field>
1395
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1396
- <field name="is_externally_integrated">False</field>
1397
- <field name="is_process_cancellable_relaunchable">False</field>
1398
- <field name="wizard_info">{"key":"value"}</field>
1399
- <field name="phase_code">F-ML-GM08-3-0021</field>
1400
- <field name="check_closed_child_tickets">False</field>
1401
- </record>
1402
- <record id="symple_triplet_phase_A1320_-_Errore_in_fase_Attesa_Esito_M2C_per_Taglio_Colonna" model="symple.triplet.phase">
1403
- <field name="active">True</field>
1404
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1920_-_Annulla_-_Attesa_Esito_M2c_E-ML-GM08-3-0059'),ref('symple_triplet_phase_result_C1921_-_OK_-_Risolto_Errore_in_fase_Attesa_Esito_M2C_per_Taglio_Colonna_E-ML-GM08-3-0060')])]"/>
1405
- <field name="child_case">False</field>
1406
- <field name="code"># Available variables:
1407
- # - case_id: the case that just reached this phase
1408
- # - request: allows you to make HTTP requests (method, url, headers, data)
1409
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1410
- # - json_load: allows you to use JSON.load to convert a json into an object
1411
- # - env: Odoo Environment on which the action is triggered
1412
- # - time, datetime, dateutil, timezone: useful Python libraries
1413
- # - float_compare: Odoo function to compare floats based on specific precisions
1414
- # - ValidationError: Warning Exception to use with raise
1415
- # - Command: x2Many commands namespace
1416
- # - OrderedDict: ordered dictionaries
1417
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1418
- # (line = case id, func = phase name)
1419
- # To return a result, assign: result = {...}
1420
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1421
- # phase result will not be set.
1422
-
1423
- logs = []
1424
-
1425
- try:
1426
- logs.append({"message": "Starting M2C integration"})
1427
- tenant_id = env["ir.config_parameter"].sudo().get_param("m2c_header_tenant_id")
1428
- org_token = env["ir.config_parameter"].sudo().get_param("m2c_header_org_token")
1429
- headers = {"tenantId": tenant_id, "orgToken": org_token}
1430
-
1431
- end_date = datetime.date.today().strftime("%Y-%m-%d")
1432
-
1433
- m2c_payload_debug = {
1434
- "case_id": case_id.id,
1435
- "tripet": "SB06 - 1 - Cessazione per Subentro",
1436
- "is_contratti_mandato": True,
1437
- "service_points": [case_id.service_point_ids[0].id],
1438
- "causale_cessazione": case_id.ticket_type_id.name,
1439
- "fine_contratto_fornitura": str(end_date),
1440
- "is_contratti": True,
1441
- }
1442
-
1443
- logs.append(
1444
- {
1445
- "message": "Calling prepare_m2c_passthrough_payload",
1446
- "data": m2c_payload_debug,
1447
- }
1448
- )
1449
-
1450
- IrConfigParameter = env["ir.config_parameter"]
1451
- m2c_dict = IrConfigParameter.prepare_m2c_passthrough_payload(
1452
- case_id,
1453
- case_id.ticket_type_id.name,
1454
- is_contratti_mandato=True,
1455
- service_points=[case_id.service_point_ids[0].id],
1456
- is_contratti=True,
1457
- contatti_array=[],
1458
- contrattiMandatoDettaglio_array=[],
1459
- causale_cessazione=case_id.ticket_type_id.name,
1460
- # fine_contratto=end_date,
1461
- fine_contratto=end_date,
1462
- )
1463
-
1464
- logs.append({"message": "M2C dict", "data": m2c_dict})
1465
-
1466
- m2c_url = IrConfigParameter.sudo().get_param("m2c_passthrough_url")
1467
- response = request("POST", m2c_url, headers=headers, data=m2c_dict)
1468
-
1469
- result = "OK"
1470
-
1471
- except Exception as e:
1472
- logs.append({"level": "error", "message": str(e), "traceback": format_exc()})
1473
- prev = case_id.info_message + "\n" if case_id.info_message else ""
1474
- case_id.write({"info_message": prev + str(e)})
1475
-
1476
- if logs:
1477
- log(json_dumps(logs))
1478
- </field>
1479
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1480
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1481
- <field name="is_a_postalizer_phase">False</field>
1482
- <field name="is_compute_refund">False</field>
1483
- <field name="is_dl">False</field>
1484
- <field name="is_needs_child_case">False</field>
1485
- <field name="is_pick_refund_template">False</field>
1486
- <field name="is_process_managed">False</field>
1487
- <field name="is_quote_accepted">False</field>
1488
- <field name="is_quote_sent">False</field>
1489
- <field name="is_timeout">False</field>
1490
- <field name="is_voidable">False</field>
1491
- <field name="name">A1320 - Errore in fase Attesa Esito M2C per Taglio Colonna</field>
1492
- <field name="set_result_automatically">from_code</field>
1493
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1494
- <field name="is_externally_integrated">False</field>
1495
- <field name="is_process_cancellable_relaunchable">False</field>
1496
- <field name="wizard_info">{"key":"value"}</field>
1497
- <field name="phase_code">F-ML-GM08-3-0022</field>
1498
- <field name="check_closed_child_tickets">False</field>
1499
- </record>
1500
- <record id="symple_triplet_phase_A1321_-_Errore_in_fase_di_Aggiornamento_CRM_per_Taglio_Colonna" model="symple.triplet.phase">
1501
- <field name="active">True</field>
1502
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1923_-_Annulla_-_Aggiornamento_CRM_E-ML-GM08-3-0061'),ref('symple_triplet_phase_result_C1924_-_OK_-_Risolto_Errore_in_fase_Aggiornamento_CRM_per_Taglio_Colonna_E-ML-GM08-3-0062')])]"/>
1503
- <field name="child_case">False</field>
1504
- <field name="code"># Available variables:
1505
- # - case_id: the case that just reached this phase
1506
- # - request: allows you to make HTTP requests (method, url, headers, data)
1507
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1508
- # - json_load: allows you to use JSON.load to convert a json into an object
1509
- # - env: Odoo Environment on which the action is triggered
1510
- # - time, datetime, dateutil, timezone: useful Python libraries
1511
- # - float_compare: Odoo function to compare floats based on specific precisions
1512
- # - ValidationError: Warning Exception to use with raise
1513
- # - Command: x2Many commands namespace
1514
- # - OrderedDict: ordered dictionaries
1515
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1516
- # (line = case id, func = phase name)
1517
- # To return a result, assign: result = {...}
1518
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1519
- # phase result will not be set.
1520
-
1521
-
1522
-
1523
- </field>
1524
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1525
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1526
- <field name="is_a_postalizer_phase">False</field>
1527
- <field name="is_compute_refund">False</field>
1528
- <field name="is_dl">False</field>
1529
- <field name="is_needs_child_case">False</field>
1530
- <field name="is_pick_refund_template">False</field>
1531
- <field name="is_process_managed">False</field>
1532
- <field name="is_quote_accepted">False</field>
1533
- <field name="is_quote_sent">False</field>
1534
- <field name="is_timeout">False</field>
1535
- <field name="is_voidable">False</field>
1536
- <field name="name">A1321 - Errore in fase di Aggiornamento CRM per Taglio Colonna</field>
1537
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1538
- <field name="is_externally_integrated">False</field>
1539
- <field name="is_process_cancellable_relaunchable">False</field>
1540
- <field name="wizard_info">{"key":"value"}</field>
1541
- <field name="phase_code">F-ML-GM08-3-0023</field>
1542
- <field name="check_closed_child_tickets">False</field>
1543
- </record>
1544
- <record id="symple_triplet_phase_A1595_-_Invio_Annullamento_alla_Market_Communication" model="symple.triplet.phase">
1545
- <field name="active">True</field>
1546
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2458_-_OK_Inviata_E-ML-GM08-3-0063'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0064')])]"/>
1547
- <field name="child_case">False</field>
1548
- <field name="code"># Available variables:
1549
- # - case_id: the case that just reached this phase
1550
- # - request: allows you to make HTTP requests (method, url, headers, data)
1551
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1552
- # - json_load: allows you to use JSON.load to convert a json into an object
1553
- # - env: Odoo Environment on which the action is triggered
1554
- # - time, datetime, dateutil, timezone: useful Python libraries
1555
- # - float_compare: Odoo function to compare floats based on specific precisions
1556
- # - ValidationError: Warning Exception to use with raise
1557
- # - Command: x2Many commands namespace
1558
- # - OrderedDict: ordered dictionaries
1559
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1560
- # (line = case id, func = phase name)
1561
- # To return a result, assign: result = {...}
1562
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1563
- # phase result will not be set.
1564
-
1565
-
1566
- try:
1567
- tenant_id = env["ir.config_parameter"].sudo().get_param("m2c_header_tenant_id")
1568
- org_token = env["ir.config_parameter"].sudo().get_param("m2c_header_org_token")
1569
- headers = {"tenantId": tenant_id, "orgToken": org_token}
1570
-
1571
- service_point = case_id.service_point_ids[0]
1572
- pdr_id = service_point.pdr_id
1573
-
1574
- ok_payload = {
1575
- "refName": "Annulment",
1576
- "refId": case_id.symphonie_process,
1577
- "messageProcessVars": {
1578
- "ifs_code": "ANG1",
1579
- "ang1Info":{
1580
- "PIVA_DISTRIBUTORE": pdr_id.distributor_id.numbers_only_vat,
1581
- "COD_SERVIZIO_ANN": "SMG2"
1582
- }
1583
- },
1584
- }
1585
-
1586
- url = env["ir.config_parameter"].sudo().get_param("b2w_wake_up_process_url")
1587
- payload = json_dumps(ok_payload)
1588
- try:
1589
- response = request("POST", url, data=payload, headers=headers)
1590
- if response.status_code != 200:
1591
- message = str(response.status_code)
1592
- case_id.write(
1593
- {
1594
- "info_message": (
1595
- case_id.info_message
1596
- + "\n"
1597
- + message
1598
- + "\n"
1599
- + str(response.text)
1600
- )
1601
- if case_id.info_message
1602
- else (message + str(response.text))
1603
- }
1604
- )
1605
- else:
1606
- result = "OK"
1607
-
1608
- except Exception as e:
1609
- message = "Call to annull the process failed"
1610
- case_id.write(
1611
- {
1612
- "info_message": (case_id.info_message + "\n" + message + "\n" + str(e))
1613
- if case_id.info_message
1614
- else (message + "\n" + str(e))
1615
- }
1616
- )
1617
-
1618
- except Exception as e:
1619
- case_id.write(
1620
- {
1621
- "info_message": (case_id.info_message + "\n" + str(e))
1622
- if case_id.info_message
1623
- else str(e)
1624
- }
1625
- )</field>
1626
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1627
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1628
- <field name="is_a_postalizer_phase">False</field>
1629
- <field name="is_compute_refund">False</field>
1630
- <field name="is_dl">False</field>
1631
- <field name="is_needs_child_case">False</field>
1632
- <field name="is_pick_refund_template">False</field>
1633
- <field name="is_process_managed">False</field>
1634
- <field name="is_quote_accepted">False</field>
1635
- <field name="is_quote_sent">False</field>
1636
- <field name="is_timeout">False</field>
1637
- <field name="is_voidable">False</field>
1638
- <field name="name">A1595 - Invio Annullamento alla Market Communication</field>
1639
- <field name="set_result_automatically">from_code</field>
1640
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1641
- <field name="is_externally_integrated">False</field>
1642
- <field name="is_process_cancellable_relaunchable">False</field>
1643
- <field name="wizard_info">{"key":"value"}</field>
1644
- <field name="phase_code">F-ML-GM08-3-0024</field>
1645
- <field name="check_closed_child_tickets">False</field>
1646
- </record>
1647
- <record id="symple_triplet_phase_A1767_-_In_attesa_check_IFS_Annullamento" model="symple.triplet.phase">
1648
- <field name="active">True</field>
1649
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C2599_-_annullamento_confermato_E-ML-GM08-3-0065'),ref('symple_triplet_phase_result_C2475_-_OK_-_Ammissibilit__Annullamento_Hub_E-ML-GM08-3-0066'),ref('symple_triplet_phase_result_C2476_-_KO_-_Ammissibilit__Annullamento_Hub_E-ML-GM08-3-0067'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0068')])]"/>
1650
- <field name="child_case">False</field>
1651
- <field name="code"># Available variables:
1652
- # - case_id: the case that just reached this phase
1653
- # - request: allows you to make HTTP requests (method, url, headers, data)
1654
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1655
- # - json_load: allows you to use JSON.load to convert a json into an object
1656
- # - env: Odoo Environment on which the action is triggered
1657
- # - time, datetime, dateutil, timezone: useful Python libraries
1658
- # - float_compare: Odoo function to compare floats based on specific precisions
1659
- # - ValidationError: Warning Exception to use with raise
1660
- # - Command: x2Many commands namespace
1661
- # - OrderedDict: ordered dictionaries
1662
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1663
- # (line = case id, func = phase name)
1664
- # To return a result, assign: result = {...}
1665
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1666
- # phase result will not be set.
1667
-
1668
-
1669
-
1670
- </field>
1671
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1672
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1673
- <field name="is_a_postalizer_phase">False</field>
1674
- <field name="is_compute_refund">False</field>
1675
- <field name="is_dl">False</field>
1676
- <field name="is_needs_child_case">False</field>
1677
- <field name="is_pick_refund_template">False</field>
1678
- <field name="is_process_managed">False</field>
1679
- <field name="is_quote_accepted">False</field>
1680
- <field name="is_quote_sent">False</field>
1681
- <field name="is_timeout">False</field>
1682
- <field name="is_voidable">False</field>
1683
- <field name="name">A1767 - In attesa check IFS Annullamento</field>
1684
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1685
- <field name="is_externally_integrated">False</field>
1686
- <field name="is_process_cancellable_relaunchable">False</field>
1687
- <field name="wizard_info">{"key":"value"}</field>
1688
- <field name="phase_code">F-ML-GM08-3-0025</field>
1689
- <field name="check_closed_child_tickets">False</field>
1690
- </record>
1691
- <record id="symple_triplet_phase_A0832_-_Invio_Richiesta_Annullamento" model="symple.triplet.phase">
1692
- <field name="active">True</field>
1693
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1058_-_Inserita_richiesta_Annullamento_sul_portale_del_DL_E-ML-GM08-3-0069'),ref('symple_triplet_phase_result_C3119_-_gestione_manuale_E-ML-GM08-3-0070'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0071')])]"/>
1694
- <field name="child_case">False</field>
1695
- <field name="code"># Available variables:
1696
- # - case_id: the case that just reached this phase
1697
- # - request: allows you to make HTTP requests (method, url, headers, data)
1698
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1699
- # - json_load: allows you to use JSON.load to convert a json into an object
1700
- # - env: Odoo Environment on which the action is triggered
1701
- # - time, datetime, dateutil, timezone: useful Python libraries
1702
- # - float_compare: Odoo function to compare floats based on specific precisions
1703
- # - ValidationError: Warning Exception to use with raise
1704
- # - Command: x2Many commands namespace
1705
- # - OrderedDict: ordered dictionaries
1706
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1707
- # (line = case id, func = phase name)
1708
- # To return a result, assign: result = {...}
1709
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1710
- # phase result will not be set.
1711
-
1712
-
1713
-
1714
- </field>
1715
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1716
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1717
- <field name="is_a_postalizer_phase">False</field>
1718
- <field name="is_compute_refund">False</field>
1719
- <field name="is_dl">False</field>
1720
- <field name="is_needs_child_case">False</field>
1721
- <field name="is_pick_refund_template">False</field>
1722
- <field name="is_process_managed">False</field>
1723
- <field name="is_quote_accepted">False</field>
1724
- <field name="is_quote_sent">False</field>
1725
- <field name="is_timeout">False</field>
1726
- <field name="is_voidable">False</field>
1727
- <field name="name">A0832 - Invio Richiesta Annullamento</field>
1728
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1729
- <field name="is_externally_integrated">False</field>
1730
- <field name="is_process_cancellable_relaunchable">False</field>
1731
- <field name="wizard_info">{"key":"value"}</field>
1732
- <field name="phase_code">F-ML-GM08-3-0026</field>
1733
- <field name="check_closed_child_tickets">False</field>
1734
- </record>
1735
- <record id="symple_triplet_phase_A1939_-_Verifica_Inserimento_Annullamento_sul_Portale_del_DL" model="symple.triplet.phase">
1736
- <field name="active">True</field>
1737
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1058_-_Inserita_richiesta_Annullamento_sul_portale_del_DL_E-ML-GM08-3-0072'),ref('symple_triplet_phase_result_C2463_-_Gestito_Fuori_linea_E-ML-GM08-3-0073'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0074')])]"/>
1738
- <field name="child_case">False</field>
1739
- <field name="code"># Available variables:
1740
- # - case_id: the case that just reached this phase
1741
- # - request: allows you to make HTTP requests (method, url, headers, data)
1742
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1743
- # - json_load: allows you to use JSON.load to convert a json into an object
1744
- # - env: Odoo Environment on which the action is triggered
1745
- # - time, datetime, dateutil, timezone: useful Python libraries
1746
- # - float_compare: Odoo function to compare floats based on specific precisions
1747
- # - ValidationError: Warning Exception to use with raise
1748
- # - Command: x2Many commands namespace
1749
- # - OrderedDict: ordered dictionaries
1750
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1751
- # (line = case id, func = phase name)
1752
- # To return a result, assign: result = {...}
1753
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1754
- # phase result will not be set.
1755
-
1756
-
1757
-
1758
- </field>
1759
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOT')])" />
1760
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1761
- <field name="is_a_postalizer_phase">False</field>
1762
- <field name="is_compute_refund">False</field>
1763
- <field name="is_dl">False</field>
1764
- <field name="is_needs_child_case">False</field>
1765
- <field name="is_pick_refund_template">False</field>
1766
- <field name="is_process_managed">False</field>
1767
- <field name="is_quote_accepted">False</field>
1768
- <field name="is_quote_sent">False</field>
1769
- <field name="is_timeout">False</field>
1770
- <field name="is_voidable">False</field>
1771
- <field name="name">A1939 - Verifica Inserimento Annullamento sul Portale del DL</field>
1772
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1773
- <field name="is_externally_integrated">False</field>
1774
- <field name="is_process_cancellable_relaunchable">False</field>
1775
- <field name="wizard_info">{"key":"value"}</field>
1776
- <field name="phase_code">F-ML-GM08-3-0027</field>
1777
- <field name="check_closed_child_tickets">False</field>
1778
- </record>
1779
- <record id="symple_triplet_phase_A0833_-_In_attesa_ricezione_Ammissibilit__Annullamento" model="symple.triplet.phase">
1780
- <field name="active">True</field>
1781
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1059_-_Ammissibilit__Annullamento_OK_E-ML-GM08-3-0075'),ref('symple_triplet_phase_result_C1060_-_Ammissibilit__Annullamento_KO_E-ML-GM08-3-0076'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0077')])]"/>
1782
- <field name="child_case">False</field>
1783
- <field name="code"># Available variables:
1784
- # - case_id: the case that just reached this phase
1785
- # - request: allows you to make HTTP requests (method, url, headers, data)
1786
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1787
- # - json_load: allows you to use JSON.load to convert a json into an object
1788
- # - env: Odoo Environment on which the action is triggered
1789
- # - time, datetime, dateutil, timezone: useful Python libraries
1790
- # - float_compare: Odoo function to compare floats based on specific precisions
1791
- # - ValidationError: Warning Exception to use with raise
1792
- # - Command: x2Many commands namespace
1793
- # - OrderedDict: ordered dictionaries
1794
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1795
- # (line = case id, func = phase name)
1796
- # To return a result, assign: result = {...}
1797
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1798
- # phase result will not be set.
1799
-
1800
-
1801
-
1802
- </field>
1803
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1804
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1805
- <field name="is_a_postalizer_phase">False</field>
1806
- <field name="is_compute_refund">False</field>
1807
- <field name="is_dl">False</field>
1808
- <field name="is_needs_child_case">False</field>
1809
- <field name="is_pick_refund_template">False</field>
1810
- <field name="is_process_managed">False</field>
1811
- <field name="is_quote_accepted">False</field>
1812
- <field name="is_quote_sent">False</field>
1813
- <field name="is_timeout">False</field>
1814
- <field name="is_voidable">False</field>
1815
- <field name="name">A0833 - In attesa ricezione Ammissibilità Annullamento</field>
1816
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1817
- <field name="is_externally_integrated">False</field>
1818
- <field name="is_process_cancellable_relaunchable">False</field>
1819
- <field name="wizard_info">{"key":"value"}</field>
1820
- <field name="phase_code">F-ML-GM08-3-0028</field>
1821
- <field name="check_closed_child_tickets">False</field>
1822
- </record>
1823
- <record id="symple_triplet_phase_A1790_-_Gestione_Errore_Annullamento" model="symple.triplet.phase">
1824
- <field name="active">True</field>
1825
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1035_-_Inserita_richiesta_sul_portale_del_DL_E-ML-GM08-3-0078'),ref('symple_triplet_phase_result_C1037_-_Ammissibilit__OK_E-ML-GM08-3-0079'),ref('symple_triplet_phase_result_C1038_-_Ammissibilit__KO_E-ML-GM08-3-0080'),ref('symple_triplet_phase_result_C2416_-_Risottomessa_da_cruscotto_E-ML-GM08-3-0081'),ref('symple_triplet_phase_result_C2409_-_KO_Confermato_E-ML-GM08-3-0082'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0083'),ref('symple_triplet_phase_result_C1526_-_Esito_finale_OK_-_Interruzione_E-ML-GM08-3-00099'),ref('symple_triplet_phase_result_C1043_-_Esito_finale_KO_E-ML-GM08-3-000100')])]"/>
1826
- <field name="child_case">False</field>
1827
- <field name="code"># Available variables:
1828
- # - case_id: the case that just reached this phase
1829
- # - request: allows you to make HTTP requests (method, url, headers, data)
1830
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1831
- # - json_load: allows you to use JSON.load to convert a json into an object
1832
- # - env: Odoo Environment on which the action is triggered
1833
- # - time, datetime, dateutil, timezone: useful Python libraries
1834
- # - float_compare: Odoo function to compare floats based on specific precisions
1835
- # - ValidationError: Warning Exception to use with raise
1836
- # - Command: x2Many commands namespace
1837
- # - OrderedDict: ordered dictionaries
1838
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1839
- # (line = case id, func = phase name)
1840
- # To return a result, assign: result = {...}
1841
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1842
- # phase result will not be set.
1843
-
1844
-
1845
-
1846
- </field>
1847
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1848
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1849
- <field name="is_a_postalizer_phase">False</field>
1850
- <field name="is_compute_refund">False</field>
1851
- <field name="is_dl">False</field>
1852
- <field name="is_needs_child_case">False</field>
1853
- <field name="is_pick_refund_template">False</field>
1854
- <field name="is_process_managed">False</field>
1855
- <field name="is_quote_accepted">False</field>
1856
- <field name="is_quote_sent">False</field>
1857
- <field name="is_timeout">False</field>
1858
- <field name="is_voidable">False</field>
1859
- <field name="name">A1790 - Gestione Errore Annullamento</field>
1860
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1861
- <field name="is_externally_integrated">False</field>
1862
- <field name="is_process_cancellable_relaunchable">False</field>
1863
- <field name="wizard_info">{"key":"value"}</field>
1864
- <field name="phase_code">F-ML-GM08-3-0029</field>
1865
- <field name="check_closed_child_tickets">False</field>
1866
- </record>
1867
- <record id="symple_triplet_phase_A0831_-_Verifica_Fase_Precedente" model="symple.triplet.phase">
1868
- <field name="active">True</field>
1869
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1055_-_Ritorno_in_In_attesa_esito_Ammissibilit__E-ML-GM08-3-0084'),ref('symple_triplet_phase_result_C2482_-_Ritorno_in_Inserimento_richiesta_sul_portale_del_DL_E-ML-GM08-3-0085'),ref('symple_triplet_phase_result_C1056_-_Ritorno_in_In_attesa_Esito_finale_E-ML-GM08-3-0086'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-0087')])]"/>
1870
- <field name="child_case">False</field>
1871
- <field name="code"># Available variables:
1872
- # - case_id: the case that just reached this phase
1873
- # - request: allows you to make HTTP requests (method, url, headers, data)
1874
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1875
- # - json_load: allows you to use JSON.load to convert a json into an object
1876
- # - env: Odoo Environment on which the action is triggered
1877
- # - time, datetime, dateutil, timezone: useful Python libraries
1878
- # - float_compare: Odoo function to compare floats based on specific precisions
1879
- # - ValidationError: Warning Exception to use with raise
1880
- # - Command: x2Many commands namespace
1881
- # - OrderedDict: ordered dictionaries
1882
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1883
- # (line = case id, func = phase name)
1884
- # To return a result, assign: result = {...}
1885
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1886
- # phase result will not be set.
1887
-
1888
- try:
1889
- env["helpdesk.ticket"].restore_latest_checkpoint_phase(case_id.id)
1890
-
1891
-
1892
- except Exception as e:
1893
- prev = case_id.info_message + "\n" if case_id.info_message else ""
1894
- case_id.write({"info_message": prev + str(e)})
1895
- </field>
1896
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1897
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
1898
- <field name="is_a_postalizer_phase">False</field>
1899
- <field name="is_compute_refund">False</field>
1900
- <field name="is_dl">False</field>
1901
- <field name="is_needs_child_case">False</field>
1902
- <field name="is_pick_refund_template">False</field>
1903
- <field name="is_process_managed">False</field>
1904
- <field name="is_quote_accepted">False</field>
1905
- <field name="is_quote_sent">False</field>
1906
- <field name="is_timeout">False</field>
1907
- <field name="is_voidable">False</field>
1908
- <field name="name">A0831 - Verifica Fase Precedente</field>
1909
- <field name="set_result_automatically">from_code</field>
1910
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1911
- <field name="is_externally_integrated">False</field>
1912
- <field name="is_process_cancellable_relaunchable">False</field>
1913
- <field name="wizard_info">{"key":"value"}</field>
1914
- <field name="phase_code">F-ML-GM08-3-0030</field>
1915
- <field name="check_closed_child_tickets">False</field>
1916
- </record>
1917
- <record id="symple_triplet_phase_A1378_-_Case_Lavorato_-_Punto_Interrotto" model="symple.triplet.phase">
1918
- <field name="active">True</field>
1919
- <field name="child_case">False</field>
1920
- <field name="code">if case_id.matrix_process_id:
1921
- case_id.close_matrix_process()</field>
1922
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1923
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','Done')])" />
1924
- <field name="is_a_postalizer_phase">False</field>
1925
- <field name="is_compute_refund">False</field>
1926
- <field name="is_dl">False</field>
1927
- <field name="is_needs_child_case">False</field>
1928
- <field name="is_pick_refund_template">False</field>
1929
- <field name="is_process_managed">False</field>
1930
- <field name="is_quote_accepted">False</field>
1931
- <field name="is_quote_sent">False</field>
1932
- <field name="is_timeout">False</field>
1933
- <field name="is_voidable">False</field>
1934
- <field name="name">A1378 - Case Lavorato - Punto Interrotto</field>
1935
- <field name="set_result_automatically">from_code</field>
1936
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1937
- <field name="is_externally_integrated">False</field>
1938
- <field name="is_process_cancellable_relaunchable">False</field>
1939
- <field name="wizard_info">{"key":"value"}</field>
1940
- <field name="phase_code">F-ML-GM08-3-0031</field>
1941
- <field name="check_closed_child_tickets">False</field>
1942
- </record>
1943
- <record id="symple_triplet_phase_A0811_-_Case_Lavorato_KO" model="symple.triplet.phase">
1944
- <field name="active">True</field>
1945
- <field name="child_case">False</field>
1946
- <field name="code">if case_id.matrix_process_id:
1947
- case_id.close_matrix_process(status="ERROR")</field>
1948
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1949
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','Done KO')])" />
1950
- <field name="is_a_postalizer_phase">False</field>
1951
- <field name="is_compute_refund">False</field>
1952
- <field name="is_dl">False</field>
1953
- <field name="is_needs_child_case">False</field>
1954
- <field name="is_pick_refund_template">False</field>
1955
- <field name="is_process_managed">False</field>
1956
- <field name="is_quote_accepted">False</field>
1957
- <field name="is_quote_sent">False</field>
1958
- <field name="is_timeout">False</field>
1959
- <field name="is_voidable">False</field>
1960
- <field name="name">A0811 - Case Lavorato KO</field>
1961
- <field name="set_result_automatically">from_code</field>
1962
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
1963
- <field name="is_externally_integrated">False</field>
1964
- <field name="is_process_cancellable_relaunchable">False</field>
1965
- <field name="wizard_info">{"key":"value"}</field>
1966
- <field name="phase_code">F-ML-GM08-3-0032</field>
1967
- <field name="check_closed_child_tickets">False</field>
1968
- </record>
1969
- <record id="symple_triplet_phase_A0809_-_Case_Annullato" model="symple.triplet.phase">
1970
- <field name="active">True</field>
1971
- <field name="child_case">False</field>
1972
- <field name="code"># Available variables:
1973
- # - case_id: the case that just reached this phase
1974
- # - request: allows you to make HTTP requests (method, url, headers, data)
1975
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
1976
- # - json_load: allows you to use JSON.load to convert a json into an object
1977
- # - env: Odoo Environment on which the action is triggered
1978
- # - time, datetime, dateutil, timezone: useful Python libraries
1979
- # - float_compare: Odoo function to compare floats based on specific precisions
1980
- # - ValidationError: Warning Exception to use with raise
1981
- # - Command: x2Many commands namespace
1982
- # - OrderedDict: ordered dictionaries
1983
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
1984
- # (line = case id, func = phase name)
1985
- # To return a result, assign: result = {...}
1986
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
1987
- # phase result will not be set.
1988
-
1989
-
1990
-
1991
- </field>
1992
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
1993
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','Cancelled')])" />
1994
- <field name="is_a_postalizer_phase">False</field>
1995
- <field name="is_compute_refund">False</field>
1996
- <field name="is_dl">False</field>
1997
- <field name="is_needs_child_case">False</field>
1998
- <field name="is_pick_refund_template">False</field>
1999
- <field name="is_process_managed">False</field>
2000
- <field name="is_quote_accepted">False</field>
2001
- <field name="is_quote_sent">False</field>
2002
- <field name="is_timeout">False</field>
2003
- <field name="is_voidable">False</field>
2004
- <field name="name">A0809 - Case Annullato</field>
2005
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2006
- <field name="is_externally_integrated">False</field>
2007
- <field name="is_process_cancellable_relaunchable">False</field>
2008
- <field name="wizard_info">{"key":"value"}</field>
2009
- <field name="phase_code">F-ML-GM08-3-0033</field>
2010
- <field name="check_closed_child_tickets">False</field>
2011
- </record>
2012
- <record id="symple_triplet_phase_A1309_-_Chiuso_e_Riattivato" model="symple.triplet.phase">
2013
- <field name="active">True</field>
2014
- <field name="child_case">False</field>
2015
- <field name="code"># Available variables:
2016
- # - case_id: the case that just reached this phase
2017
- # - request: allows you to make HTTP requests (method, url, headers, data)
2018
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
2019
- # - json_load: allows you to use JSON.load to convert a json into an object
2020
- # - env: Odoo Environment on which the action is triggered
2021
- # - time, datetime, dateutil, timezone: useful Python libraries
2022
- # - float_compare: Odoo function to compare floats based on specific precisions
2023
- # - ValidationError: Warning Exception to use with raise
2024
- # - Command: x2Many commands namespace
2025
- # - OrderedDict: ordered dictionaries
2026
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
2027
- # (line = case id, func = phase name)
2028
- # To return a result, assign: result = {...}
2029
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
2030
- # phase result will not be set.
2031
-
2032
-
2033
-
2034
- </field>
2035
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
2036
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','Done')])" />
2037
- <field name="is_a_postalizer_phase">False</field>
2038
- <field name="is_compute_refund">False</field>
2039
- <field name="is_dl">False</field>
2040
- <field name="is_needs_child_case">False</field>
2041
- <field name="is_pick_refund_template">False</field>
2042
- <field name="is_process_managed">False</field>
2043
- <field name="is_quote_accepted">False</field>
2044
- <field name="is_quote_sent">False</field>
2045
- <field name="is_timeout">False</field>
2046
- <field name="is_voidable">False</field>
2047
- <field name="name">A1309 - Chiuso e Riattivato</field>
2048
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2049
- <field name="is_externally_integrated">False</field>
2050
- <field name="is_process_cancellable_relaunchable">False</field>
2051
- <field name="wizard_info">{"key":"value"}</field>
2052
- <field name="phase_code">F-ML-GM08-3-0034</field>
2053
- <field name="check_closed_child_tickets">False</field>
2054
- </record>
2055
- <record id="symple_triplet_phase_A2345_-_Apertura_Wizard_Taglio_Colonna_GAS" model="symple.triplet.phase">
2056
- <field name="active">True</field>
2057
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1032_-_Acquisizione_Dati_E-ML-GM08-3-0088')])]"/>
2058
- <field name="allowed_process_ids" model="symple.pb.process" eval="[(6, 0, obj().search([('name','in',('ml_taglio_colonna',)),]).ids)]" />
2059
- <field name="child_case">False</field>
2060
- <field name="code"># Available variables:
2061
- # - case_id: the case that just reached this phase
2062
- # - request: allows you to make HTTP requests (method, url, headers, data)
2063
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
2064
- # - json_load: allows you to use JSON.load to convert a json into an object
2065
- # - env: Odoo Environment on which the action is triggered
2066
- # - time, datetime, dateutil, timezone: useful Python libraries
2067
- # - float_compare: Odoo function to compare floats based on specific precisions
2068
- # - ValidationError: Warning Exception to use with raise
2069
- # - Command: x2Many commands namespace
2070
- # - OrderedDict: ordered dictionaries
2071
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
2072
- # (line = case id, func = phase name)
2073
- # To return a result, assign: result = {...}
2074
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
2075
- # phase result will not be set.
2076
-
2077
-
2078
-
2079
- </field>
2080
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
2081
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
2082
- <field name="is_a_postalizer_phase">False</field>
2083
- <field name="is_compute_refund">False</field>
2084
- <field name="is_dl">False</field>
2085
- <field name="is_needs_child_case">False</field>
2086
- <field name="is_pick_refund_template">False</field>
2087
- <field name="is_process_managed">False</field>
2088
- <field name="is_quote_accepted">False</field>
2089
- <field name="is_quote_sent">False</field>
2090
- <field name="is_timeout">False</field>
2091
- <field name="is_voidable">False</field>
2092
- <field name="name">A2345 - Apertura Wizard Taglio Colonna GAS</field>
2093
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2094
- <field name="is_externally_integrated">False</field>
2095
- <field name="is_process_cancellable_relaunchable">False</field>
2096
- <field name="wizard_info">{"key":"value"}</field>
2097
- <field name="phase_code">F-ML-GM08-3-0035</field>
2098
- <field name="check_closed_child_tickets">False</field>
2099
- </record>
2100
- <record id="symple_triplet_phase_A1093_-_Apertura_Case_Interruzione_Servizio" model="symple.triplet.phase">
2101
- <field name="active">True</field>
2102
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1613_-_Controlli_CRM_OK_E-ML-GM08-3-0001-prelim'),ref('symple_triplet_phase_result_C1614_-_Controlli_CRM_KO_E-ML-GM08-3-00090'),ref('symple_triplet_phase_result_C2214_-_Controlli_CRM_OK_Forzato_E-ML-GM08-3-00091')])]"/>
2103
- <field name="child_case">False</field>
2104
- <field name="code"># Available variables:
2105
- # - case_id: the case that just reached this phase
2106
- # - request: allows you to make HTTP requests (method, url, headers, data)
2107
- # - json_dumps: allows you to use JSON.dumps to converto object to json
2108
- # - env: Odoo Environment on which the action is triggered
2109
- # - time, datetime, dateutil, timezone: useful Python libraries
2110
- # - float_compare: Odoo function to compare floats based on specific precisions
2111
- # - ValidationError: Warning Exception to use with raise
2112
- # - Command: x2Many commands namespace
2113
- # - OrderedDict: ordered dictionaries
2114
- # To return a result, assign: result = {...}
2115
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
2116
- # phase result will not be set.
2117
-
2118
- logs = []
2119
- IrConfigParam = env["ir.config_parameter"]
2120
-
2121
-
2122
- def get_assets(client_id, code):
2123
- token = IrConfigParam.get_b2w_access_token()
2124
- url = IrConfigParam.get_param("b2w_order_management_endpoint") + "assets"
2125
- headers = {"Authorization": "Bearer " + token, "Content-Type": "application/json"}
2126
-
2127
- body = json_dumps(
2128
- {
2129
- "filters": [
2130
- {"field": "accountcode", "type": "=", "value": str(client_id)},
2131
- {"field": "type", "type": "=", "value": "product"},
2132
- {"field": "podcode", "type": "=", "value": code},
2133
- ],
2134
- "sorters": [{"field": "created_date", "direction": "desc"}],
2135
- "page": 1,
2136
- "size": 999999,
2137
- }
2138
- )
2139
-
2140
- response = request("POST", url, headers=headers, data=body)
2141
-
2142
- if response.status_code != 200:
2143
- try:
2144
- logs.append({"message": "response json", "data": response.json()})
2145
- except Exception:
2146
- logs.append({"message": "response text", "data": response.text})
2147
-
2148
- raise Exception("Non è stato possibile scaricare gli asset")
2149
-
2150
- json = response.json()
2151
- return json.get("items", [])
2152
-
2153
-
2154
- def all_disconnected(assets):
2155
- for asset in assets:
2156
- if asset.get("sm_state") != "cessato":
2157
- return False
2158
- return True
2159
-
2160
-
2161
- def disconnectable(assets):
2162
- r = []
2163
- for asset in assets:
2164
- if asset.get("sm_state") == "attivo":
2165
- r.append(asset)
2166
- return r
2167
-
2168
-
2169
- try:
2170
- client_id = case_id.customer_id.id
2171
- if not case_id.pdr_ids:
2172
- result = "KO"
2173
- raise ValidationError("The PDR does not exist in the CRM")
2174
-
2175
- if not case_id.service_point_ids:
2176
- result = "KO"
2177
- raise ValidationError("No service points found for the PDR")
2178
-
2179
- point = case_id.pdr_ids[0]
2180
- assets = get_assets(client_id, point.code)
2181
- d = disconnectable(assets)
2182
-
2183
- if len(assets) == 0:
2184
- case_id.write(
2185
- {
2186
- "error_message": "The POD {} does not exist in the CRM".format(
2187
- point.code,
2188
- )
2189
- }
2190
- )
2191
- result = "KO"
2192
- elif all_disconnected(assets):
2193
- result = "OK-FORCE"
2194
- else:
2195
- if len(d) > 1:
2196
- result = "KO"
2197
- raise ValidationError("More than one PDR instance active in the CRM")
2198
- else:
2199
- result = "OK"
2200
-
2201
-
2202
- except Exception as inst:
2203
- case_id.write({"error_message": inst})
2204
- log(format_exc(), level="error")
2205
- logs.append(
2206
- {
2207
- "message": "Exception occurred",
2208
- "data": {"exception": str(inst), "traceback": format_exc()},
2209
- }
2210
- )
2211
-
2212
- if logs:
2213
- log(json_dumps(logs))</field>
2214
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
2215
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','New')])" />
2216
- <field name="is_a_postalizer_phase">False</field>
2217
- <field name="is_compute_refund">False</field>
2218
- <field name="is_dl">False</field>
2219
- <field name="is_needs_child_case">False</field>
2220
- <field name="is_pick_refund_template">False</field>
2221
- <field name="is_process_managed">False</field>
2222
- <field name="is_quote_accepted">False</field>
2223
- <field name="is_quote_sent">False</field>
2224
- <field name="is_timeout">False</field>
2225
- <field name="is_voidable">False</field>
2226
- <field name="name">A1093 - Apertura Case Interruzione Servizio</field>
2227
- <field name="set_result_automatically">from_code</field>
2228
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2229
- <field name="is_externally_integrated">False</field>
2230
- <field name="is_process_cancellable_relaunchable">False</field>
2231
- <field name="wizard_info">{"key":"value"}</field>
2232
- <field name="phase_code">F-ML-GM08-3-000-01</field>
2233
- <field name="check_closed_child_tickets">False</field>
2234
- </record>
2235
- <record id="symple_triplet_phase_A1140_-_Errore_validazione_dati_ricevuti" model="symple.triplet.phase">
2236
- <field name="active">True</field>
2237
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C1616_-_Risoluzione_errore_E-ML-GM08-3-00092'),ref('symple_triplet_phase_result_C1617_-_Errore_non_risolvibile_E-ML-GM08-3-00093'),ref('symple_triplet_phase_result_C2215_-_Timeout_risottomissione_case_E-ML-GM08-3-00094'),ref('symple_triplet_phase_result_C1883_-_Chiuso_e_Riattivato_da_M2C_E-ML-GM08-3-00095')])]"/>
2238
- <field name="child_case">False</field>
2239
- <field name="code"># Available variables:
2240
- # - case_id: the case that just reached this phase
2241
- # - request: allows you to make HTTP requests (method, url, headers, data)
2242
- # - json_dumps: allows you to use JSON.dumps to convert an object into a json
2243
- # - json_load: allows you to use JSON.load to convert a json into an object
2244
- # - env: Odoo Environment on which the action is triggered
2245
- # - time, datetime, dateutil, timezone: useful Python libraries
2246
- # - float_compare: Odoo function to compare floats based on specific precisions
2247
- # - ValidationError: Warning Exception to use with raise
2248
- # - Command: x2Many commands namespace
2249
- # - OrderedDict: ordered dictionaries
2250
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
2251
- # (line = case id, func = phase name)
2252
- # - format_exc: forwarded from traceback.format_exc - returns str stack trace of last exception thrown
2253
- # - first: forwarded from odoo.fields.first - safely gets first element of recordset
2254
- # To return a result, assign: result = {...}
2255
- # WARNING: if return = False or return value is not in the result table or no result is returned at all,
2256
- # phase result will not be set.
2257
-
2258
-
2259
-
2260
- </field>
2261
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','BOCR')])" />
2262
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
2263
- <field name="is_a_postalizer_phase">False</field>
2264
- <field name="is_compute_refund">False</field>
2265
- <field name="is_dl">False</field>
2266
- <field name="is_needs_child_case">False</field>
2267
- <field name="is_pick_refund_template">False</field>
2268
- <field name="is_process_managed">False</field>
2269
- <field name="is_quote_accepted">False</field>
2270
- <field name="is_quote_sent">False</field>
2271
- <field name="is_timeout">True</field>
2272
- <field name="is_voidable">False</field>
2273
- <field name="name">A1140 - Errore validazione dati ricevuti</field>
2274
- <field name="timeout_days">7</field>
2275
- <field name="timeout_phase_result" ref="symple_triplet_phase_result_C2215_-_Timeout_risottomissione_case_E-ML-GM08-3-00094"/>
2276
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2277
- <field name="is_externally_integrated">False</field>
2278
- <field name="is_process_cancellable_relaunchable">False</field>
2279
- <field name="wizard_info">{"key":"value"}</field>
2280
- <field name="phase_code">F-ML-GM08-3-000-02</field>
2281
- <field name="check_closed_child_tickets">False</field>
2282
- </record>
2283
- <record id="symple_triplet_phase_A2561_-_verifica_stato_invio_pratica_da_annullare" model="symple.triplet.phase">
2284
- <field name="active">True</field>
2285
- <field name="allowed_phase_result_ids" model="symple.triplet.phase.result" eval="[(6, 0, [ref('symple_triplet_phase_result_C3120_-_annullamento_da_gestire_E-ML-GM08-3-00097'),ref('symple_triplet_phase_result_C2599_-_annullamento_confermato_E-ML-GM08-3-00098')])]"/>
2286
- <field name="child_case">False</field>
2287
- <field name="code"># RES1 = C3120 - annullamento da gestire
2288
- # RES2 = C2599 - annullamento confermato
2289
-
2290
- RES1, RES2 = ("RES1", "RES2")
2291
-
2292
- logs = []
2293
- debug_logs = []
2294
- error_occurred = False
2295
-
2296
-
2297
- def make_log(message, data=None, always=False):
2298
- log_entry = {"message": message}
2299
- if data is not None:
2300
- log_entry["data"] = data
2301
-
2302
- if always:
2303
- logs.append(log_entry)
2304
- else:
2305
- debug_logs.append(log_entry)
2306
-
2307
-
2308
- # --------------------------------------
2309
-
2310
-
2311
- def main():
2312
- pass
2313
-
2314
-
2315
- try:
2316
- result = main()
2317
- except Exception as e:
2318
- error_occurred = True
2319
- make_log(
2320
- "Error occurred in phase",
2321
- {"error": str(e), "traceback": format_exc()},
2322
- always=True,
2323
- )
2324
- case_id.write({"error_message": str(e)})
2325
-
2326
-
2327
- if error_occurred and debug_logs:
2328
- logs.append({"message": "debug_logs", "logs": debug_logs})
2329
-
2330
- if logs:
2331
- log(json_dumps(logs, indent=2))</field>
2332
- <field name="helpdesk_group_id" model="helpdesk.team" eval="obj().search([('name','=','SYSTEM-Sorgenia')])" />
2333
- <field name="helpdesk_stage_id" model="helpdesk.stage" eval="obj().search([('name','=','In Progress')])" />
2334
- <field name="is_a_postalizer_phase">False</field>
2335
- <field name="is_compute_refund">False</field>
2336
- <field name="is_dl">False</field>
2337
- <field name="is_needs_child_case">False</field>
2338
- <field name="is_pick_refund_template">False</field>
2339
- <field name="is_process_managed">False</field>
2340
- <field name="is_quote_accepted">False</field>
2341
- <field name="is_quote_sent">False</field>
2342
- <field name="is_timeout">False</field>
2343
- <field name="is_voidable">False</field>
2344
- <field name="name">A2561 - verifica stato invio pratica da annullare</field>
2345
- <field name="set_result_automatically">from_code</field>
2346
- <field name="workflow_id" ref="symple_workflow_ML_-_Taglio_Colonna_Gas_per_Morosit_"/>
2347
- <field name="is_externally_integrated">False</field>
2348
- <field name="is_process_cancellable_relaunchable">False</field>
2349
- <field name="wizard_info">{"key":"value"}</field>
2350
- <field name="phase_code">F-ML-GM08-3-000-03</field>
2351
- <field name="check_closed_child_tickets">False</field>
2352
- </record>
2353
-
2354
- </data>
2355
- </odoo>
2356
-
2357
- Processed_records: 38
2358
- Managed records: 38