@fctc/interface-logic 2.0.4 → 2.0.6

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/services.mjs CHANGED
@@ -3014,15 +3014,21 @@ function useActionService() {
3014
3014
  const loadAction = useCallback2(
3015
3015
  async ({
3016
3016
  idAction,
3017
- context
3017
+ context,
3018
+ service
3018
3019
  }) => {
3019
3020
  const jsonData = {
3020
3021
  action_id: idAction,
3021
3022
  with_context: { ...context }
3022
3023
  };
3023
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
3024
- headers: { "Content-Type": "application/json" }
3025
- });
3024
+ return env.requests.post(
3025
+ "/load_action" /* LOAD_ACTION */,
3026
+ jsonData,
3027
+ {
3028
+ headers: { "Content-Type": "application/json" }
3029
+ },
3030
+ service
3031
+ );
3026
3032
  },
3027
3033
  [env]
3028
3034
  );
@@ -3031,7 +3037,8 @@ function useActionService() {
3031
3037
  model,
3032
3038
  ids = [],
3033
3039
  context,
3034
- method
3040
+ method,
3041
+ service
3035
3042
  }) => {
3036
3043
  try {
3037
3044
  const jsonData = {
@@ -3040,9 +3047,14 @@ function useActionService() {
3040
3047
  ids,
3041
3048
  with_context: context
3042
3049
  };
3043
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3044
- headers: { "Content-Type": "application/json" }
3045
- });
3050
+ return env.requests.post(
3051
+ "/call" /* CALL_PATH */,
3052
+ jsonData,
3053
+ {
3054
+ headers: { "Content-Type": "application/json" }
3055
+ },
3056
+ service
3057
+ );
3046
3058
  } catch (error) {
3047
3059
  console.error("Error when calling button action:", error);
3048
3060
  throw error;
@@ -3054,7 +3066,8 @@ function useActionService() {
3054
3066
  async ({
3055
3067
  model,
3056
3068
  ids,
3057
- context
3069
+ context,
3070
+ service
3058
3071
  }) => {
3059
3072
  const jsonData = {
3060
3073
  model,
@@ -3062,9 +3075,14 @@ function useActionService() {
3062
3075
  ids,
3063
3076
  with_context: context
3064
3077
  };
3065
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3066
- headers: { "Content-Type": "application/json" }
3067
- });
3078
+ return env.requests.post(
3079
+ "/call" /* CALL_PATH */,
3080
+ jsonData,
3081
+ {
3082
+ headers: { "Content-Type": "application/json" }
3083
+ },
3084
+ service
3085
+ );
3068
3086
  },
3069
3087
  [env]
3070
3088
  );
@@ -3072,7 +3090,8 @@ function useActionService() {
3072
3090
  async ({
3073
3091
  model,
3074
3092
  id,
3075
- context
3093
+ context,
3094
+ service
3076
3095
  }) => {
3077
3096
  const jsonData = {
3078
3097
  model,
@@ -3080,9 +3099,14 @@ function useActionService() {
3080
3099
  ids: id,
3081
3100
  with_context: context
3082
3101
  };
3083
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3084
- headers: { "Content-Type": "application/json" }
3085
- });
3102
+ return env.requests.post(
3103
+ "/call" /* CALL_PATH */,
3104
+ jsonData,
3105
+ {
3106
+ headers: { "Content-Type": "application/json" }
3107
+ },
3108
+ service
3109
+ );
3086
3110
  },
3087
3111
  [env]
3088
3112
  );
@@ -3125,15 +3149,21 @@ function useActionService() {
3125
3149
  const runAction = useCallback2(
3126
3150
  async ({
3127
3151
  idAction,
3128
- context
3152
+ context,
3153
+ service
3129
3154
  }) => {
3130
3155
  const jsonData = {
3131
3156
  action_id: idAction,
3132
3157
  with_context: { ...context }
3133
3158
  };
3134
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
3135
- headers: { "Content-Type": "application/json" }
3136
- });
3159
+ return env.requests.post(
3160
+ "/run_action" /* RUN_ACTION_PATH */,
3161
+ jsonData,
3162
+ {
3163
+ headers: { "Content-Type": "application/json" }
3164
+ },
3165
+ service
3166
+ );
3137
3167
  },
3138
3168
  [env]
3139
3169
  );
@@ -3414,11 +3444,7 @@ function useExcelService() {
3414
3444
  const { env } = useEnv();
3415
3445
  const uploadFile = useCallback5(
3416
3446
  async ({ formData }) => {
3417
- return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
3418
- headers: {
3419
- "Content-Type": "multipart/form-data"
3420
- }
3421
- });
3447
+ return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData);
3422
3448
  },
3423
3449
  [env]
3424
3450
  );
@@ -3662,12 +3688,8 @@ function useFormService() {
3662
3688
  [env]
3663
3689
  );
3664
3690
  const uploadImage = useCallback6(
3665
- async ({ data }) => {
3666
- return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3667
- headers: {
3668
- "Content-Type": "multipart/form-data"
3669
- }
3670
- });
3691
+ async ({ formData }) => {
3692
+ return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, formData);
3671
3693
  },
3672
3694
  [env]
3673
3695
  );
@@ -3856,7 +3878,7 @@ function useModelService() {
3856
3878
  });
3857
3879
  }, [env]);
3858
3880
  const getAll = useCallback8(
3859
- async ({ data }) => {
3881
+ async ({ data, service }) => {
3860
3882
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3861
3883
  fields: data.fields,
3862
3884
  groupby: data.groupby
@@ -3877,11 +3899,16 @@ function useModelService() {
3877
3899
  ...jsonReadGroup
3878
3900
  }
3879
3901
  };
3880
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3881
- headers: {
3882
- "Content-Type": "application/json"
3883
- }
3884
- });
3902
+ return env.requests.post(
3903
+ "/call" /* CALL_PATH */,
3904
+ jsonData,
3905
+ {
3906
+ headers: {
3907
+ "Content-Type": "application/json"
3908
+ }
3909
+ },
3910
+ service
3911
+ );
3885
3912
  },
3886
3913
  [env]
3887
3914
  );
@@ -3949,7 +3976,13 @@ function useModelService() {
3949
3976
  [env]
3950
3977
  );
3951
3978
  const getDetail = useCallback8(
3952
- async ({ ids = [], model, specification, context }) => {
3979
+ async ({
3980
+ ids = [],
3981
+ model,
3982
+ specification,
3983
+ context,
3984
+ service
3985
+ }) => {
3953
3986
  const jsonData = {
3954
3987
  model,
3955
3988
  method: "web_read" /* WEB_READ */,
@@ -3959,11 +3992,16 @@ function useModelService() {
3959
3992
  specification
3960
3993
  }
3961
3994
  };
3962
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3963
- headers: {
3964
- "Content-Type": "application/json"
3965
- }
3966
- });
3995
+ return env.requests.post(
3996
+ "/call" /* CALL_PATH */,
3997
+ jsonData,
3998
+ {
3999
+ headers: {
4000
+ "Content-Type": "application/json"
4001
+ }
4002
+ },
4003
+ service
4004
+ );
3967
4005
  },
3968
4006
  [env]
3969
4007
  );
@@ -3974,7 +4012,8 @@ function useModelService() {
3974
4012
  data = {},
3975
4013
  specification = {},
3976
4014
  context = {},
3977
- path
4015
+ path,
4016
+ service
3978
4017
  }) => {
3979
4018
  const jsonData = {
3980
4019
  model,
@@ -3986,26 +4025,36 @@ function useModelService() {
3986
4025
  specification
3987
4026
  }
3988
4027
  };
3989
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3990
- headers: {
3991
- "Content-Type": "application/json"
3992
- }
3993
- });
4028
+ return env.requests.post(
4029
+ path ?? "/call" /* CALL_PATH */,
4030
+ jsonData,
4031
+ {
4032
+ headers: {
4033
+ "Content-Type": "application/json"
4034
+ }
4035
+ },
4036
+ service
4037
+ );
3994
4038
  },
3995
4039
  [env]
3996
4040
  );
3997
4041
  const deleteApi = useCallback8(
3998
- async ({ ids = [], model }) => {
4042
+ async ({ ids = [], model, service }) => {
3999
4043
  const jsonData = {
4000
4044
  model,
4001
4045
  method: "unlink" /* UNLINK */,
4002
4046
  ids
4003
4047
  };
4004
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4005
- headers: {
4006
- "Content-Type": "application/json"
4007
- }
4008
- });
4048
+ return env.requests.post(
4049
+ "/call" /* CALL_PATH */,
4050
+ jsonData,
4051
+ {
4052
+ headers: {
4053
+ "Content-Type": "application/json"
4054
+ }
4055
+ },
4056
+ service
4057
+ );
4009
4058
  },
4010
4059
  [env]
4011
4060
  );
@@ -4016,7 +4065,8 @@ function useModelService() {
4016
4065
  object,
4017
4066
  specification,
4018
4067
  context,
4019
- fieldChange
4068
+ fieldChange,
4069
+ service
4020
4070
  }) => {
4021
4071
  const jsonData = {
4022
4072
  model,
@@ -4029,11 +4079,16 @@ function useModelService() {
4029
4079
  specification
4030
4080
  ]
4031
4081
  };
4032
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4033
- headers: {
4034
- "Content-Type": "application/json"
4035
- }
4036
- });
4082
+ return env.requests.post(
4083
+ "/call" /* CALL_PATH */,
4084
+ jsonData,
4085
+ {
4086
+ headers: {
4087
+ "Content-Type": "application/json"
4088
+ }
4089
+ },
4090
+ service
4091
+ );
4037
4092
  },
4038
4093
  [env]
4039
4094
  );
@@ -4207,7 +4262,8 @@ function useViewService() {
4207
4262
  views,
4208
4263
  context = {},
4209
4264
  options = {},
4210
- aid
4265
+ aid,
4266
+ service
4211
4267
  }) => {
4212
4268
  const defaultOptions = {
4213
4269
  load_filters: true,
@@ -4223,110 +4279,28 @@ function useViewService() {
4223
4279
  },
4224
4280
  with_context: context
4225
4281
  };
4226
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4227
- headers: {
4228
- "Content-Type": "application/json"
4229
- }
4230
- });
4282
+ return env?.requests?.post(
4283
+ "/call" /* CALL_PATH */,
4284
+ jsonDataView,
4285
+ {
4286
+ headers: {
4287
+ "Content-Type": "application/json"
4288
+ }
4289
+ },
4290
+ service
4291
+ );
4231
4292
  },
4232
4293
  [env]
4233
4294
  );
4234
4295
  const getMenu = useCallback10(
4235
- async (context) => {
4296
+ async (context, specification) => {
4236
4297
  const jsonData = {
4237
4298
  model: "ir.ui.menu" /* MENU */,
4238
4299
  method: "web_search_read" /* WEB_SEARCH_READ */,
4239
4300
  ids: [],
4240
4301
  with_context: context,
4241
4302
  kwargs: {
4242
- specification: {
4243
- active: {},
4244
- name: {},
4245
- is_display: {},
4246
- sequence: {},
4247
- complete_name: {},
4248
- action: {
4249
- fields: {
4250
- display_name: {},
4251
- type: {},
4252
- binding_view_types: {}
4253
- }
4254
- },
4255
- url_icon: {},
4256
- web_icon: {},
4257
- web_icon_data: {},
4258
- groups_id: {
4259
- fields: {
4260
- full_name: {}
4261
- },
4262
- limit: 40,
4263
- order: ""
4264
- },
4265
- display_name: {},
4266
- child_id: {
4267
- fields: {
4268
- active: {},
4269
- name: {},
4270
- is_display: {},
4271
- sequence: {},
4272
- complete_name: {},
4273
- action: {
4274
- fields: {
4275
- display_name: {},
4276
- type: {},
4277
- binding_view_types: {}
4278
- }
4279
- },
4280
- url_icon: {},
4281
- web_icon: {},
4282
- web_icon_data: {},
4283
- groups_id: {
4284
- fields: {
4285
- full_name: {}
4286
- },
4287
- limit: 40,
4288
- order: ""
4289
- },
4290
- display_name: {},
4291
- child_id: {
4292
- fields: {
4293
- active: {},
4294
- name: {},
4295
- is_display: {},
4296
- sequence: {},
4297
- complete_name: {},
4298
- action: {
4299
- fields: {
4300
- display_name: {},
4301
- type: {},
4302
- binding_view_types: {}
4303
- }
4304
- },
4305
- url_icon: {},
4306
- web_icon: {},
4307
- web_icon_data: {},
4308
- groups_id: {
4309
- fields: {
4310
- full_name: {}
4311
- },
4312
- limit: 40,
4313
- order: ""
4314
- },
4315
- display_name: {},
4316
- child_id: {
4317
- fields: {},
4318
- limit: 40,
4319
- order: ""
4320
- }
4321
- },
4322
- limit: 40,
4323
- order: ""
4324
- }
4325
- },
4326
- limit: 40,
4327
- order: ""
4328
- }
4329
- },
4303
+ specification,
4330
4304
  domain: [
4331
4305
  "&",
4332
4306
  ["is_display", "=", true],
@@ -4397,7 +4371,7 @@ function useViewService() {
4397
4371
  [env]
4398
4372
  );
4399
4373
  const getSelectionItem = useCallback10(
4400
- async ({ data }) => {
4374
+ async ({ data, service }) => {
4401
4375
  const jsonData = {
4402
4376
  model: data.model,
4403
4377
  ids: [],
@@ -4415,11 +4389,16 @@ function useViewService() {
4415
4389
  }
4416
4390
  }
4417
4391
  };
4418
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4419
- headers: {
4420
- "Content-Type": "application/json"
4421
- }
4422
- });
4392
+ return env?.requests.post(
4393
+ "/call" /* CALL_PATH */,
4394
+ jsonData,
4395
+ {
4396
+ headers: {
4397
+ "Content-Type": "application/json"
4398
+ }
4399
+ },
4400
+ service
4401
+ );
4423
4402
  },
4424
4403
  [env]
4425
4404
  );
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-BGJfDe73.mjs';
1
+ export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-p4JdAOsz.mjs';
2
2
 
3
3
  interface Config {
4
4
  baseUrl: string;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-BGJfDe73.js';
1
+ export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-p4JdAOsz.js';
2
2
 
3
3
  interface Config {
4
4
  baseUrl: string;
@@ -58,6 +58,7 @@ interface GetDetailParams {
58
58
  model?: string;
59
59
  specification?: Specification;
60
60
  context?: ContextApi;
61
+ service?: string;
61
62
  }
62
63
  interface SaveParams {
63
64
  model: string;
@@ -66,10 +67,12 @@ interface SaveParams {
66
67
  specification?: Specification;
67
68
  context?: ContextApi;
68
69
  path?: string;
70
+ service?: string;
69
71
  }
70
72
  interface DeleteParams {
71
73
  ids?: number[];
72
74
  model: string;
75
+ service?: string;
73
76
  }
74
77
  interface OnChangeParams {
75
78
  ids?: number[];
@@ -78,6 +81,7 @@ interface OnChangeParams {
78
81
  specification: Specification;
79
82
  context?: ContextApi;
80
83
  fieldChange?: string[];
84
+ service?: string;
81
85
  }
82
86
  interface ViewData {
83
87
  models?: {
@@ -108,6 +112,7 @@ interface GetViewParams {
108
112
  context?: Record<string, any>;
109
113
  options?: Option;
110
114
  aid?: number | string | null | boolean;
115
+ service?: string;
111
116
  }
112
117
 
113
118
  export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };
@@ -58,6 +58,7 @@ interface GetDetailParams {
58
58
  model?: string;
59
59
  specification?: Specification;
60
60
  context?: ContextApi;
61
+ service?: string;
61
62
  }
62
63
  interface SaveParams {
63
64
  model: string;
@@ -66,10 +67,12 @@ interface SaveParams {
66
67
  specification?: Specification;
67
68
  context?: ContextApi;
68
69
  path?: string;
70
+ service?: string;
69
71
  }
70
72
  interface DeleteParams {
71
73
  ids?: number[];
72
74
  model: string;
75
+ service?: string;
73
76
  }
74
77
  interface OnChangeParams {
75
78
  ids?: number[];
@@ -78,6 +81,7 @@ interface OnChangeParams {
78
81
  specification: Specification;
79
82
  context?: ContextApi;
80
83
  fieldChange?: string[];
84
+ service?: string;
81
85
  }
82
86
  interface ViewData {
83
87
  models?: {
@@ -108,6 +112,7 @@ interface GetViewParams {
108
112
  context?: Record<string, any>;
109
113
  options?: Option;
110
114
  aid?: number | string | null | boolean;
115
+ service?: string;
111
116
  }
112
117
 
113
118
  export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };