@fctc/edu-logic-lib 1.0.8 → 1.0.10
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.
- package/dist/config.js +257 -6
- package/dist/config.mjs +256 -2
- package/dist/constants.js +152 -53
- package/dist/constants.mjs +141 -2
- package/dist/environment.js +839 -16
- package/dist/environment.mjs +840 -4
- package/dist/hooks.js +4850 -180
- package/dist/hooks.mjs +4813 -9
- package/dist/index.js +5320 -626
- package/dist/index.mjs +5165 -12
- package/dist/models.js +1107 -18
- package/dist/models.mjs +1107 -9
- package/dist/provider.js +1115 -17
- package/dist/provider.mjs +1115 -8
- package/dist/services.js +1922 -31
- package/dist/services.mjs +1922 -7
- package/dist/store.js +576 -248
- package/dist/store.mjs +519 -1
- package/dist/types.js +0 -2
- package/dist/types.mjs +1 -1
- package/dist/utils.js +2355 -61
- package/dist/utils.mjs +2344 -1
- package/package.json +2 -1
- package/dist/chunk-4K3QAEZ6.js +0 -90
- package/dist/chunk-6BLY7NZ6.mjs +0 -120
- package/dist/chunk-6QXB3XX7.mjs +0 -256
- package/dist/chunk-7JD5GMIZ.js +0 -2
- package/dist/chunk-AYUH66EE.mjs +0 -62
- package/dist/chunk-CZHZLKNA.mjs +0 -585
- package/dist/chunk-EK43MEN4.js +0 -635
- package/dist/chunk-ELARQVCE.mjs +0 -2344
- package/dist/chunk-FVGPSTJ7.js +0 -122
- package/dist/chunk-GGOFXFSX.js +0 -2362
- package/dist/chunk-IXDDYGKE.js +0 -61
- package/dist/chunk-MLJQPO4Q.mjs +0 -57
- package/dist/chunk-OADBRQ4A.js +0 -32
- package/dist/chunk-OBR6UTC5.mjs +0 -1
- package/dist/chunk-OFUXC2LA.mjs +0 -86
- package/dist/chunk-P2IGWJDZ.js +0 -1068
- package/dist/chunk-QLUONJPQ.mjs +0 -519
- package/dist/chunk-RWRHCIQI.mjs +0 -1059
- package/dist/chunk-RZBHZYXG.js +0 -582
- package/dist/chunk-S7B3VKMJ.mjs +0 -85
- package/dist/chunk-S7YF2I23.js +0 -95
- package/dist/chunk-UY6GNZNB.js +0 -262
- package/dist/chunk-XYVK476U.mjs +0 -29
- package/dist/chunk-YOV6KAT2.js +0 -66
package/dist/chunk-RWRHCIQI.mjs
DELETED
|
@@ -1,1059 +0,0 @@
|
|
|
1
|
-
import { toQueryString } from './chunk-ELARQVCE.mjs';
|
|
2
|
-
import { getEnv } from './chunk-OFUXC2LA.mjs';
|
|
3
|
-
import { UriConstants } from './chunk-MLJQPO4Q.mjs';
|
|
4
|
-
|
|
5
|
-
// src/services/action-service/index.ts
|
|
6
|
-
var ActionService = {
|
|
7
|
-
async loadAction({
|
|
8
|
-
idAction,
|
|
9
|
-
context
|
|
10
|
-
}) {
|
|
11
|
-
const env = getEnv();
|
|
12
|
-
const jsonData = {
|
|
13
|
-
action_id: idAction,
|
|
14
|
-
with_context: {
|
|
15
|
-
...context
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return env.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
|
|
19
|
-
headers: {
|
|
20
|
-
"Content-Type": "application/json"
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
async callButton({
|
|
25
|
-
model,
|
|
26
|
-
ids = [],
|
|
27
|
-
context,
|
|
28
|
-
method
|
|
29
|
-
}) {
|
|
30
|
-
try {
|
|
31
|
-
const env = getEnv();
|
|
32
|
-
const jsonData = {
|
|
33
|
-
model,
|
|
34
|
-
method,
|
|
35
|
-
ids,
|
|
36
|
-
with_context: context
|
|
37
|
-
};
|
|
38
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
39
|
-
headers: {
|
|
40
|
-
"Content-Type": "application/json"
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error("Error when calling button action:", error);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
async removeRows({
|
|
49
|
-
model,
|
|
50
|
-
ids,
|
|
51
|
-
context
|
|
52
|
-
}) {
|
|
53
|
-
const env = getEnv();
|
|
54
|
-
const jsonData = {
|
|
55
|
-
model,
|
|
56
|
-
method: "unlink",
|
|
57
|
-
ids,
|
|
58
|
-
with_context: context
|
|
59
|
-
};
|
|
60
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
61
|
-
headers: {
|
|
62
|
-
"Content-Type": "application/json"
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
async duplicateRecord({
|
|
67
|
-
model,
|
|
68
|
-
id,
|
|
69
|
-
context
|
|
70
|
-
}) {
|
|
71
|
-
const env = getEnv();
|
|
72
|
-
const jsonData = {
|
|
73
|
-
model,
|
|
74
|
-
method: "copy",
|
|
75
|
-
ids: id,
|
|
76
|
-
with_context: context
|
|
77
|
-
};
|
|
78
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
79
|
-
headers: {
|
|
80
|
-
"Content-Type": "application/json"
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
async print({ id, report, db }) {
|
|
85
|
-
const env = getEnv();
|
|
86
|
-
const jsonData = {
|
|
87
|
-
report,
|
|
88
|
-
id,
|
|
89
|
-
type: "pdf",
|
|
90
|
-
file_response: true,
|
|
91
|
-
db
|
|
92
|
-
};
|
|
93
|
-
const queryString = toQueryString(jsonData);
|
|
94
|
-
const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
|
|
95
|
-
return env.requests.get(urlWithParams, {
|
|
96
|
-
headers: {
|
|
97
|
-
"Content-Type": "application/json"
|
|
98
|
-
},
|
|
99
|
-
responseType: "arraybuffer"
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
async runAction({
|
|
103
|
-
idAction,
|
|
104
|
-
context
|
|
105
|
-
}) {
|
|
106
|
-
const env = getEnv();
|
|
107
|
-
const jsonData = {
|
|
108
|
-
action_id: idAction,
|
|
109
|
-
with_context: {
|
|
110
|
-
...context
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
return env.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
|
|
114
|
-
headers: {
|
|
115
|
-
"Content-Type": "application/json"
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
var action_service_default = ActionService;
|
|
121
|
-
|
|
122
|
-
// src/services/auth-service/index.ts
|
|
123
|
-
var AuthService = {
|
|
124
|
-
async login(body) {
|
|
125
|
-
const env = getEnv();
|
|
126
|
-
const payload = Object.fromEntries(
|
|
127
|
-
Object.entries({
|
|
128
|
-
username: body.email,
|
|
129
|
-
password: body.password,
|
|
130
|
-
grant_type: env?.config?.grantType || "",
|
|
131
|
-
client_id: env?.config?.clientId || "",
|
|
132
|
-
client_secret: env?.config?.clientSecret || ""
|
|
133
|
-
}).filter(([_, value]) => !!value)
|
|
134
|
-
);
|
|
135
|
-
const encodedData = new URLSearchParams(payload).toString();
|
|
136
|
-
return env?.requests?.post(body.path, encodedData, {
|
|
137
|
-
headers: {
|
|
138
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
async forgotPassword(email) {
|
|
143
|
-
const env = getEnv();
|
|
144
|
-
const bodyData = {
|
|
145
|
-
login: email,
|
|
146
|
-
url: `${window.location.origin}/reset-password`
|
|
147
|
-
};
|
|
148
|
-
return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
149
|
-
headers: {
|
|
150
|
-
"Content-Type": "application/json"
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
async resetPassword(data, token) {
|
|
155
|
-
const env = getEnv();
|
|
156
|
-
const bodyData = {
|
|
157
|
-
token,
|
|
158
|
-
password: data.password,
|
|
159
|
-
new_password: data.confirmPassword
|
|
160
|
-
};
|
|
161
|
-
return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
162
|
-
headers: {
|
|
163
|
-
"Content-Type": "application/json"
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
},
|
|
167
|
-
async updatePassword(data, token) {
|
|
168
|
-
const env = getEnv();
|
|
169
|
-
const bodyData = {
|
|
170
|
-
token,
|
|
171
|
-
old_password: data.oldPassword,
|
|
172
|
-
new_password: data.newPassword
|
|
173
|
-
};
|
|
174
|
-
return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
175
|
-
headers: {
|
|
176
|
-
"Content-Type": "application/json"
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
async isValidToken(token) {
|
|
181
|
-
const env = getEnv();
|
|
182
|
-
const bodyData = {
|
|
183
|
-
token
|
|
184
|
-
};
|
|
185
|
-
return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
186
|
-
headers: {
|
|
187
|
-
"Content-Type": "application/json"
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
async loginSocial({
|
|
192
|
-
state,
|
|
193
|
-
access_token
|
|
194
|
-
}) {
|
|
195
|
-
const env = getEnv();
|
|
196
|
-
return env?.requests?.post(
|
|
197
|
-
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
198
|
-
{ state, access_token },
|
|
199
|
-
{
|
|
200
|
-
headers: {
|
|
201
|
-
"Content-Type": "application/json"
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
},
|
|
206
|
-
async getProviders(db) {
|
|
207
|
-
const env = getEnv();
|
|
208
|
-
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
var auth_service_default = AuthService;
|
|
212
|
-
|
|
213
|
-
// src/services/company-service/index.ts
|
|
214
|
-
var CompanyService = {
|
|
215
|
-
async getCurrentCompany() {
|
|
216
|
-
const env = getEnv();
|
|
217
|
-
return await env.requests.get("/company" /* COMPANY_PATH */, {
|
|
218
|
-
headers: {
|
|
219
|
-
"Content-Type": "application/json"
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
async getInfoCompany(id) {
|
|
224
|
-
const env = getEnv();
|
|
225
|
-
const jsonData = {
|
|
226
|
-
ids: [id],
|
|
227
|
-
model: "res.company" /* COMPANY */,
|
|
228
|
-
method: "web_read" /* WEB_READ */,
|
|
229
|
-
kwargs: {
|
|
230
|
-
specification: {
|
|
231
|
-
primary_color: {},
|
|
232
|
-
secondary_color: {},
|
|
233
|
-
logo: {},
|
|
234
|
-
display_name: {},
|
|
235
|
-
secondary_logo: {}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
return await env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
240
|
-
headers: {
|
|
241
|
-
"Content-Type": "application/json"
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
var company_service_default = CompanyService;
|
|
247
|
-
|
|
248
|
-
// src/services/excel-service/index.ts
|
|
249
|
-
var ExcelService = {
|
|
250
|
-
async uploadFile({ formData }) {
|
|
251
|
-
const env = getEnv();
|
|
252
|
-
return env.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
|
|
253
|
-
headers: {
|
|
254
|
-
"Content-Type": "multipart/form-data"
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
},
|
|
258
|
-
async uploadIdFile({ formData }) {
|
|
259
|
-
const env = getEnv();
|
|
260
|
-
return env.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
|
|
261
|
-
headers: {
|
|
262
|
-
"Content-Type": "multipart/form-data"
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
async parsePreview({
|
|
267
|
-
id,
|
|
268
|
-
selectedSheet,
|
|
269
|
-
isHeader,
|
|
270
|
-
context
|
|
271
|
-
}) {
|
|
272
|
-
const env = getEnv();
|
|
273
|
-
const jsonData = {
|
|
274
|
-
model: "base_import.import" /* BASE_IMPORT */,
|
|
275
|
-
method: "parse_preview",
|
|
276
|
-
ids: [id],
|
|
277
|
-
kwargs: {
|
|
278
|
-
options: {
|
|
279
|
-
import_skip_records: [],
|
|
280
|
-
import_set_empty_fields: [],
|
|
281
|
-
fallback_values: {},
|
|
282
|
-
name_create_enabled_fields: {},
|
|
283
|
-
encoding: "",
|
|
284
|
-
separator: "",
|
|
285
|
-
quoting: '"',
|
|
286
|
-
date_format: "",
|
|
287
|
-
datetime_format: "",
|
|
288
|
-
float_thousand_separator: ",",
|
|
289
|
-
float_decimal_separator: ".",
|
|
290
|
-
advanced: true,
|
|
291
|
-
has_headers: isHeader,
|
|
292
|
-
keep_matches: false,
|
|
293
|
-
limit: 2e3,
|
|
294
|
-
sheets: [],
|
|
295
|
-
sheet: selectedSheet,
|
|
296
|
-
skip: 0,
|
|
297
|
-
tracking_disable: true
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
with_context: context
|
|
301
|
-
};
|
|
302
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
303
|
-
headers: {
|
|
304
|
-
"Content-Type": "multipart/form-data"
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
async executeImport({
|
|
309
|
-
columns,
|
|
310
|
-
fields,
|
|
311
|
-
idFile,
|
|
312
|
-
options,
|
|
313
|
-
dryrun,
|
|
314
|
-
context
|
|
315
|
-
}) {
|
|
316
|
-
const env = getEnv();
|
|
317
|
-
const jsonData = {
|
|
318
|
-
model: "base_import.import" /* BASE_IMPORT */,
|
|
319
|
-
method: "execute_import",
|
|
320
|
-
ids: [idFile],
|
|
321
|
-
kwargs: {
|
|
322
|
-
fields,
|
|
323
|
-
columns,
|
|
324
|
-
options,
|
|
325
|
-
dryrun
|
|
326
|
-
},
|
|
327
|
-
with_context: context
|
|
328
|
-
};
|
|
329
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
330
|
-
headers: {
|
|
331
|
-
"Content-Type": "multipart/form-data"
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
},
|
|
335
|
-
async getFileExcel({ model, context }) {
|
|
336
|
-
const env = getEnv();
|
|
337
|
-
const jsonData = {
|
|
338
|
-
model,
|
|
339
|
-
method: "get_import_templates" /* GET_IMPORT */,
|
|
340
|
-
args: [],
|
|
341
|
-
with_context: context
|
|
342
|
-
};
|
|
343
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData);
|
|
344
|
-
},
|
|
345
|
-
async getFieldExport({
|
|
346
|
-
ids,
|
|
347
|
-
model,
|
|
348
|
-
isShow,
|
|
349
|
-
parentField,
|
|
350
|
-
fieldType,
|
|
351
|
-
parentName,
|
|
352
|
-
prefix,
|
|
353
|
-
name,
|
|
354
|
-
context,
|
|
355
|
-
importCompat
|
|
356
|
-
}) {
|
|
357
|
-
const env = getEnv();
|
|
358
|
-
const jsonData = {
|
|
359
|
-
model,
|
|
360
|
-
import_compat: importCompat,
|
|
361
|
-
domain: [["id", "in", ids]],
|
|
362
|
-
with_context: context
|
|
363
|
-
};
|
|
364
|
-
if (isShow) {
|
|
365
|
-
jsonData.parent_field = parentField;
|
|
366
|
-
jsonData.parent_field_type = fieldType;
|
|
367
|
-
jsonData.parent_name = parentName;
|
|
368
|
-
jsonData.name = name;
|
|
369
|
-
jsonData.prefix = prefix;
|
|
370
|
-
jsonData.exclude = [null];
|
|
371
|
-
}
|
|
372
|
-
return env.requests.post("/export/get_fields", jsonData);
|
|
373
|
-
},
|
|
374
|
-
async exportExcel({
|
|
375
|
-
model,
|
|
376
|
-
domain,
|
|
377
|
-
ids,
|
|
378
|
-
fields,
|
|
379
|
-
type,
|
|
380
|
-
importCompat,
|
|
381
|
-
context,
|
|
382
|
-
groupby
|
|
383
|
-
}) {
|
|
384
|
-
const env = getEnv();
|
|
385
|
-
const jsonData = {
|
|
386
|
-
model,
|
|
387
|
-
domain,
|
|
388
|
-
ids,
|
|
389
|
-
import_compat: importCompat,
|
|
390
|
-
fields,
|
|
391
|
-
with_context: context,
|
|
392
|
-
groupby: groupby ?? []
|
|
393
|
-
};
|
|
394
|
-
return env.requests.post_excel(`/export/${type}`, jsonData);
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
var excel_service_default = ExcelService;
|
|
398
|
-
|
|
399
|
-
// src/services/form-service/index.ts
|
|
400
|
-
var FormService = {
|
|
401
|
-
async getComment({ data }) {
|
|
402
|
-
try {
|
|
403
|
-
const env = getEnv();
|
|
404
|
-
const jsonData = {
|
|
405
|
-
thread_id: data.thread_id,
|
|
406
|
-
thread_model: data.thread_model,
|
|
407
|
-
limit: 100,
|
|
408
|
-
with_context: {
|
|
409
|
-
lang: data.lang
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
|
|
413
|
-
headers: {
|
|
414
|
-
"Content-Type": "application/json"
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
} catch (error) {
|
|
418
|
-
console.error("Error when sending message:", error);
|
|
419
|
-
throw error;
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
async sentComment({ data }) {
|
|
423
|
-
try {
|
|
424
|
-
const env = getEnv();
|
|
425
|
-
const jsonData = {
|
|
426
|
-
context: {
|
|
427
|
-
tz: "Asia/Saigon",
|
|
428
|
-
uid: 2,
|
|
429
|
-
allowed_company_ids: [1],
|
|
430
|
-
mail_post_autofollow: false,
|
|
431
|
-
temporary_id: 142183.01
|
|
432
|
-
},
|
|
433
|
-
post_data: {
|
|
434
|
-
body: data.message,
|
|
435
|
-
message_type: "comment",
|
|
436
|
-
attachment_ids: data.attachment_ids,
|
|
437
|
-
attachment_tokens: [],
|
|
438
|
-
subtype_xmlid: data.subtype
|
|
439
|
-
},
|
|
440
|
-
thread_id: Number(data.thread_id),
|
|
441
|
-
thread_model: data.thread_model
|
|
442
|
-
};
|
|
443
|
-
return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
|
|
444
|
-
headers: {
|
|
445
|
-
"Content-Type": "application/json"
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
} catch (error) {
|
|
449
|
-
console.error("Error when sent message:", error);
|
|
450
|
-
throw error;
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
async deleteComment({ data }) {
|
|
454
|
-
try {
|
|
455
|
-
const env = getEnv();
|
|
456
|
-
const jsonData = {
|
|
457
|
-
attachment_ids: [],
|
|
458
|
-
attachment_tokens: [],
|
|
459
|
-
body: "",
|
|
460
|
-
message_id: data.message_id
|
|
461
|
-
};
|
|
462
|
-
return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
|
|
463
|
-
headers: {
|
|
464
|
-
"Content-Type": "application/json"
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
} catch (error) {
|
|
468
|
-
console.error("Error when sent message:", error);
|
|
469
|
-
throw error;
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
async getImage({ data }) {
|
|
473
|
-
try {
|
|
474
|
-
const env = getEnv();
|
|
475
|
-
return env.requests.get(
|
|
476
|
-
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
477
|
-
{
|
|
478
|
-
headers: {
|
|
479
|
-
"Content-Type": "application/json"
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
);
|
|
483
|
-
} catch (error) {
|
|
484
|
-
console.error("Error when sent message:", error);
|
|
485
|
-
throw error;
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
async uploadImage({ data }) {
|
|
489
|
-
try {
|
|
490
|
-
const env = getEnv();
|
|
491
|
-
return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
492
|
-
headers: {
|
|
493
|
-
"Content-Type": "multipart/form-data"
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
} catch (error) {
|
|
497
|
-
console.error("Error when sent message:", error);
|
|
498
|
-
throw error;
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
async getFormView({ data }) {
|
|
502
|
-
try {
|
|
503
|
-
const env = getEnv();
|
|
504
|
-
const jsonData = {
|
|
505
|
-
model: data.model,
|
|
506
|
-
method: "get_formview_action",
|
|
507
|
-
ids: data.id ? [data.id] : [],
|
|
508
|
-
with_context: data.context
|
|
509
|
-
};
|
|
510
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
511
|
-
headers: {
|
|
512
|
-
"Content-Type": "application/json"
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
} catch (error) {
|
|
516
|
-
console.error("Error when fetching form view:", error);
|
|
517
|
-
throw error;
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
async changeStatus({ data }) {
|
|
521
|
-
const env = getEnv();
|
|
522
|
-
const vals = {
|
|
523
|
-
[data.name]: data.stage_id
|
|
524
|
-
};
|
|
525
|
-
const jsonData = {
|
|
526
|
-
model: data.model,
|
|
527
|
-
method: "web_save",
|
|
528
|
-
with_context: {
|
|
529
|
-
lang: data.lang,
|
|
530
|
-
allowed_company_ids: [1],
|
|
531
|
-
uid: 2,
|
|
532
|
-
search_default_my_ticket: true,
|
|
533
|
-
search_default_is_open: true
|
|
534
|
-
},
|
|
535
|
-
ids: [data.id],
|
|
536
|
-
kwargs: {
|
|
537
|
-
vals,
|
|
538
|
-
specification: {}
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
542
|
-
headers: {
|
|
543
|
-
"Content-Type": "application/json"
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
var form_service_default = FormService;
|
|
549
|
-
|
|
550
|
-
// src/services/model-service/index.ts
|
|
551
|
-
var OBJECT_POSITION = 2;
|
|
552
|
-
var ModelService = {
|
|
553
|
-
async getAll({ data }) {
|
|
554
|
-
const env = getEnv();
|
|
555
|
-
const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
556
|
-
fields: data.fields,
|
|
557
|
-
groupby: data.groupby
|
|
558
|
-
} : {
|
|
559
|
-
count_limit: 10001,
|
|
560
|
-
order: data.sort,
|
|
561
|
-
specification: data.specification
|
|
562
|
-
};
|
|
563
|
-
const jsonData = {
|
|
564
|
-
model: String(data.model),
|
|
565
|
-
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
566
|
-
ids: data.ids,
|
|
567
|
-
with_context: data.context,
|
|
568
|
-
kwargs: {
|
|
569
|
-
domain: data.domain,
|
|
570
|
-
limit: data.limit,
|
|
571
|
-
offset: data.offset,
|
|
572
|
-
...jsonReadGroup
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
576
|
-
headers: {
|
|
577
|
-
"Content-Type": "application/json"
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
},
|
|
581
|
-
async getList({
|
|
582
|
-
model,
|
|
583
|
-
ids = [],
|
|
584
|
-
specification = {},
|
|
585
|
-
domain = [],
|
|
586
|
-
offset,
|
|
587
|
-
order,
|
|
588
|
-
context = {},
|
|
589
|
-
limit = 10
|
|
590
|
-
}) {
|
|
591
|
-
const env = getEnv();
|
|
592
|
-
const jsonData = {
|
|
593
|
-
model,
|
|
594
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
595
|
-
ids,
|
|
596
|
-
with_context: context,
|
|
597
|
-
kwargs: {
|
|
598
|
-
specification,
|
|
599
|
-
domain,
|
|
600
|
-
limit,
|
|
601
|
-
offset,
|
|
602
|
-
order
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
606
|
-
headers: {
|
|
607
|
-
"Content-Type": "application/json"
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
},
|
|
611
|
-
async getDetail({
|
|
612
|
-
ids = [],
|
|
613
|
-
model,
|
|
614
|
-
specification,
|
|
615
|
-
context
|
|
616
|
-
}) {
|
|
617
|
-
const env = getEnv();
|
|
618
|
-
const jsonData = {
|
|
619
|
-
model,
|
|
620
|
-
method: "web_read" /* WEB_READ */,
|
|
621
|
-
ids,
|
|
622
|
-
with_context: context,
|
|
623
|
-
kwargs: {
|
|
624
|
-
specification
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
628
|
-
headers: {
|
|
629
|
-
"Content-Type": "application/json"
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
},
|
|
633
|
-
async save({
|
|
634
|
-
model,
|
|
635
|
-
ids = [],
|
|
636
|
-
data = {},
|
|
637
|
-
specification = {},
|
|
638
|
-
context = {}
|
|
639
|
-
}) {
|
|
640
|
-
const env = getEnv();
|
|
641
|
-
const jsonData = {
|
|
642
|
-
model,
|
|
643
|
-
method: "web_save" /* WEB_SAVE */,
|
|
644
|
-
with_context: context,
|
|
645
|
-
ids,
|
|
646
|
-
kwargs: {
|
|
647
|
-
vals: data,
|
|
648
|
-
specification
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
652
|
-
headers: {
|
|
653
|
-
"Content-Type": "application/json"
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
},
|
|
657
|
-
async delete({ ids = [], model }) {
|
|
658
|
-
const env = getEnv();
|
|
659
|
-
const jsonData = {
|
|
660
|
-
model,
|
|
661
|
-
method: "unlink" /* UNLINK */,
|
|
662
|
-
ids
|
|
663
|
-
};
|
|
664
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
665
|
-
headers: {
|
|
666
|
-
"Content-Type": "application/json"
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
},
|
|
670
|
-
async onChange({
|
|
671
|
-
ids = [],
|
|
672
|
-
model,
|
|
673
|
-
object,
|
|
674
|
-
specification,
|
|
675
|
-
context,
|
|
676
|
-
fieldChange
|
|
677
|
-
}) {
|
|
678
|
-
const env = getEnv();
|
|
679
|
-
const jsonData = {
|
|
680
|
-
model,
|
|
681
|
-
method: "onchange" /* ONCHANGE */,
|
|
682
|
-
ids,
|
|
683
|
-
with_context: context,
|
|
684
|
-
args: [
|
|
685
|
-
object ? object : {},
|
|
686
|
-
fieldChange ? fieldChange : [],
|
|
687
|
-
specification
|
|
688
|
-
]
|
|
689
|
-
};
|
|
690
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
691
|
-
headers: {
|
|
692
|
-
"Content-Type": "application/json"
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
},
|
|
696
|
-
async getListFieldsOnchange({ model }) {
|
|
697
|
-
const env = getEnv();
|
|
698
|
-
const jsonData = {
|
|
699
|
-
model,
|
|
700
|
-
method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
|
|
701
|
-
};
|
|
702
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
703
|
-
headers: {
|
|
704
|
-
"Content-Type": "application/json"
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
},
|
|
708
|
-
parseORMOdoo(data) {
|
|
709
|
-
for (const key in data) {
|
|
710
|
-
if (key === "display_name") {
|
|
711
|
-
delete data[key];
|
|
712
|
-
}
|
|
713
|
-
if (!data[key] && data[key] !== 0) {
|
|
714
|
-
data[key] = false;
|
|
715
|
-
} else if (data[key] === "Draft") {
|
|
716
|
-
data[key] = "/";
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
return { ...data };
|
|
720
|
-
},
|
|
721
|
-
toDataJS(data, viewData, model) {
|
|
722
|
-
for (const key in data) {
|
|
723
|
-
if (data[key] === false) {
|
|
724
|
-
if (viewData && model) {
|
|
725
|
-
if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
|
|
726
|
-
data[key] = null;
|
|
727
|
-
}
|
|
728
|
-
} else {
|
|
729
|
-
data[key] = null;
|
|
730
|
-
}
|
|
731
|
-
} else if (data[key] === "/") {
|
|
732
|
-
data[key] = "Draft";
|
|
733
|
-
} else if (data[key] !== false) {
|
|
734
|
-
if (model !== void 0) {
|
|
735
|
-
if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
|
|
736
|
-
data[key] = (data[key] ??= [])?.map((item, index) => {
|
|
737
|
-
const relation = viewData?.models?.[model]?.[key]?.relation;
|
|
738
|
-
if (relation !== void 0) {
|
|
739
|
-
if (viewData?.models?.[relation]) {
|
|
740
|
-
if (item?.length >= 3) {
|
|
741
|
-
if (item[0] === 2 /* DELETE */) {
|
|
742
|
-
delete data[key][index];
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
return ModelService.toDataJS(
|
|
746
|
-
{ ...item[OBJECT_POSITION], id: `virtual_${index}` },
|
|
747
|
-
viewData,
|
|
748
|
-
relation
|
|
749
|
-
);
|
|
750
|
-
} else {
|
|
751
|
-
return ModelService.toDataJS(item, viewData, relation);
|
|
752
|
-
}
|
|
753
|
-
} else {
|
|
754
|
-
if (item?.length >= 3) {
|
|
755
|
-
if (!item[OBJECT_POSITION] || item[0] === 2 /* DELETE */) {
|
|
756
|
-
delete data[key][index];
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
return item[OBJECT_POSITION];
|
|
760
|
-
} else {
|
|
761
|
-
return item;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
return { ...data };
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
var model_service_default = ModelService;
|
|
774
|
-
|
|
775
|
-
// src/services/user-service/index.ts
|
|
776
|
-
var UserService = {
|
|
777
|
-
async getProfile() {
|
|
778
|
-
const env = getEnv();
|
|
779
|
-
return env.requests.get("/userinfo" /* PROFILE_PATH */, {
|
|
780
|
-
headers: {
|
|
781
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
},
|
|
785
|
-
async getUser({ context, id }) {
|
|
786
|
-
const env = getEnv();
|
|
787
|
-
const jsonData = {
|
|
788
|
-
model: "res.users",
|
|
789
|
-
method: "web_read",
|
|
790
|
-
ids: [id],
|
|
791
|
-
with_context: context,
|
|
792
|
-
kwargs: {
|
|
793
|
-
specification: {
|
|
794
|
-
display_name: {},
|
|
795
|
-
image_1920: {},
|
|
796
|
-
name: {},
|
|
797
|
-
login: {},
|
|
798
|
-
email: {},
|
|
799
|
-
password: {},
|
|
800
|
-
visible_group_id: {
|
|
801
|
-
fields: {
|
|
802
|
-
id: {},
|
|
803
|
-
display_name: {}
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
company_id: {
|
|
807
|
-
fields: {
|
|
808
|
-
id: {},
|
|
809
|
-
display_name: {}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
return env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
816
|
-
headers: {
|
|
817
|
-
"Content-Type": "application/json"
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
},
|
|
821
|
-
switchUserLocale: async ({ id, values }) => {
|
|
822
|
-
const env = getEnv();
|
|
823
|
-
const jsonData = {
|
|
824
|
-
model: "res.users",
|
|
825
|
-
domain: [["id", "=", id]],
|
|
826
|
-
values
|
|
827
|
-
};
|
|
828
|
-
return env?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
|
|
829
|
-
headers: {
|
|
830
|
-
"Content-Type": "application/json"
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
var user_service_default = UserService;
|
|
836
|
-
|
|
837
|
-
// src/services/view-service/index.ts
|
|
838
|
-
var ViewService = {
|
|
839
|
-
async getView({
|
|
840
|
-
model,
|
|
841
|
-
views,
|
|
842
|
-
context = {},
|
|
843
|
-
options = {},
|
|
844
|
-
aid
|
|
845
|
-
}) {
|
|
846
|
-
const env = getEnv();
|
|
847
|
-
const defaultOptions = {
|
|
848
|
-
load_filters: true,
|
|
849
|
-
toolbar: true,
|
|
850
|
-
action_id: aid
|
|
851
|
-
};
|
|
852
|
-
const jsonDataView = {
|
|
853
|
-
model,
|
|
854
|
-
method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
|
|
855
|
-
kwargs: {
|
|
856
|
-
views,
|
|
857
|
-
options: { ...options, ...defaultOptions }
|
|
858
|
-
},
|
|
859
|
-
with_context: context
|
|
860
|
-
};
|
|
861
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
862
|
-
headers: {
|
|
863
|
-
"Content-Type": "application/json"
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
},
|
|
867
|
-
async getMenu(context) {
|
|
868
|
-
const env = getEnv();
|
|
869
|
-
const jsonData = {
|
|
870
|
-
model: "ir.ui.menu" /* MENU */,
|
|
871
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
872
|
-
ids: [],
|
|
873
|
-
with_context: context,
|
|
874
|
-
kwargs: {
|
|
875
|
-
specification: {
|
|
876
|
-
active: {},
|
|
877
|
-
name: {},
|
|
878
|
-
is_display: {},
|
|
879
|
-
sequence: {},
|
|
880
|
-
complete_name: {},
|
|
881
|
-
action: {
|
|
882
|
-
fields: {
|
|
883
|
-
display_name: {},
|
|
884
|
-
type: {},
|
|
885
|
-
binding_view_types: {}
|
|
886
|
-
// res_model: {},
|
|
887
|
-
}
|
|
888
|
-
},
|
|
889
|
-
url_icon: {},
|
|
890
|
-
web_icon: {},
|
|
891
|
-
web_icon_data: {},
|
|
892
|
-
groups_id: {
|
|
893
|
-
fields: {
|
|
894
|
-
full_name: {}
|
|
895
|
-
},
|
|
896
|
-
limit: 40,
|
|
897
|
-
order: ""
|
|
898
|
-
},
|
|
899
|
-
display_name: {},
|
|
900
|
-
child_id: {
|
|
901
|
-
fields: {
|
|
902
|
-
active: {},
|
|
903
|
-
name: {},
|
|
904
|
-
is_display: {},
|
|
905
|
-
sequence: {},
|
|
906
|
-
complete_name: {},
|
|
907
|
-
action: {
|
|
908
|
-
fields: {
|
|
909
|
-
display_name: {},
|
|
910
|
-
type: {},
|
|
911
|
-
binding_view_types: {}
|
|
912
|
-
// res_model: {},
|
|
913
|
-
}
|
|
914
|
-
},
|
|
915
|
-
url_icon: {},
|
|
916
|
-
web_icon: {},
|
|
917
|
-
web_icon_data: {},
|
|
918
|
-
groups_id: {
|
|
919
|
-
fields: {
|
|
920
|
-
full_name: {}
|
|
921
|
-
},
|
|
922
|
-
limit: 40,
|
|
923
|
-
order: ""
|
|
924
|
-
},
|
|
925
|
-
display_name: {},
|
|
926
|
-
child_id: {
|
|
927
|
-
fields: {
|
|
928
|
-
active: {},
|
|
929
|
-
name: {},
|
|
930
|
-
is_display: {},
|
|
931
|
-
sequence: {},
|
|
932
|
-
complete_name: {},
|
|
933
|
-
action: {
|
|
934
|
-
fields: {
|
|
935
|
-
display_name: {},
|
|
936
|
-
type: {},
|
|
937
|
-
binding_view_types: {}
|
|
938
|
-
// res_model: {},
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
url_icon: {},
|
|
942
|
-
web_icon: {},
|
|
943
|
-
web_icon_data: {},
|
|
944
|
-
groups_id: {
|
|
945
|
-
fields: {
|
|
946
|
-
full_name: {}
|
|
947
|
-
},
|
|
948
|
-
limit: 40,
|
|
949
|
-
order: ""
|
|
950
|
-
},
|
|
951
|
-
display_name: {},
|
|
952
|
-
child_id: {
|
|
953
|
-
fields: {
|
|
954
|
-
active: {},
|
|
955
|
-
name: {},
|
|
956
|
-
is_display: {},
|
|
957
|
-
sequence: {},
|
|
958
|
-
complete_name: {},
|
|
959
|
-
action: {
|
|
960
|
-
fields: {
|
|
961
|
-
display_name: {},
|
|
962
|
-
type: {},
|
|
963
|
-
binding_view_types: {}
|
|
964
|
-
// res_model: {},
|
|
965
|
-
}
|
|
966
|
-
},
|
|
967
|
-
url_icon: {},
|
|
968
|
-
web_icon: {},
|
|
969
|
-
web_icon_data: {},
|
|
970
|
-
groups_id: {
|
|
971
|
-
fields: {
|
|
972
|
-
full_name: {}
|
|
973
|
-
},
|
|
974
|
-
limit: 40,
|
|
975
|
-
order: ""
|
|
976
|
-
},
|
|
977
|
-
display_name: {},
|
|
978
|
-
child_id: {
|
|
979
|
-
fields: {},
|
|
980
|
-
limit: 40,
|
|
981
|
-
order: ""
|
|
982
|
-
}
|
|
983
|
-
},
|
|
984
|
-
limit: 40,
|
|
985
|
-
order: ""
|
|
986
|
-
}
|
|
987
|
-
},
|
|
988
|
-
limit: 40,
|
|
989
|
-
order: ""
|
|
990
|
-
}
|
|
991
|
-
},
|
|
992
|
-
limit: 40,
|
|
993
|
-
order: ""
|
|
994
|
-
}
|
|
995
|
-
},
|
|
996
|
-
domain: [
|
|
997
|
-
"&",
|
|
998
|
-
["is_display", "=", true],
|
|
999
|
-
"&",
|
|
1000
|
-
["active", "=", true],
|
|
1001
|
-
["parent_id", "=", false]
|
|
1002
|
-
]
|
|
1003
|
-
}
|
|
1004
|
-
};
|
|
1005
|
-
return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
1006
|
-
headers: {
|
|
1007
|
-
"Content-Type": "application/json"
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
},
|
|
1011
|
-
async getSelectionItem({ data }) {
|
|
1012
|
-
const env = getEnv();
|
|
1013
|
-
const jsonData = {
|
|
1014
|
-
model: data.model,
|
|
1015
|
-
ids: [],
|
|
1016
|
-
method: "get_data_select",
|
|
1017
|
-
with_context: data.context,
|
|
1018
|
-
kwargs: {
|
|
1019
|
-
count_limit: 10001,
|
|
1020
|
-
domain: data.domain ? data.domain : [],
|
|
1021
|
-
offset: 0,
|
|
1022
|
-
order: "",
|
|
1023
|
-
specification: data?.specification ?? {
|
|
1024
|
-
id: {},
|
|
1025
|
-
name: {},
|
|
1026
|
-
display_name: {}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
1031
|
-
headers: {
|
|
1032
|
-
"Content-Type": "application/json"
|
|
1033
|
-
}
|
|
1034
|
-
});
|
|
1035
|
-
},
|
|
1036
|
-
async loadMessages() {
|
|
1037
|
-
const env = getEnv();
|
|
1038
|
-
return env.requests.post(
|
|
1039
|
-
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
1040
|
-
{},
|
|
1041
|
-
{
|
|
1042
|
-
headers: {
|
|
1043
|
-
"Content-Type": "application/json"
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
);
|
|
1047
|
-
},
|
|
1048
|
-
async getVersion() {
|
|
1049
|
-
const env = getEnv();
|
|
1050
|
-
return env?.requests.get("", {
|
|
1051
|
-
headers: {
|
|
1052
|
-
"Content-Type": "application/json"
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
var view_service_default = ViewService;
|
|
1058
|
-
|
|
1059
|
-
export { action_service_default, auth_service_default, company_service_default, excel_service_default, form_service_default, model_service_default, user_service_default, view_service_default };
|