channel-app 0.0.157a10__py3-none-any.whl → 0.0.157a12__py3-none-any.whl
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.
- channel_app/app/order/service.py +598 -364
- channel_app/app/product/service.py +392 -238
- channel_app/app/product_image/service.py +214 -134
- channel_app/app/product_price/service.py +390 -240
- channel_app/app/product_stock/service.py +285 -203
- channel_app/app/setup/service.py +133 -79
- channel_app/logs/services.py +1 -1
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/METADATA +1 -1
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/RECORD +11 -11
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/WHEEL +0 -0
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,7 @@ from omnisdk.omnitron.models import ProductStock, BatchRequest
|
|
5
5
|
from channel_app.core import settings
|
6
6
|
from channel_app.core.data import BatchRequestResponseDto, ErrorReportDto
|
7
7
|
from channel_app.core.settings import OmnitronIntegration, ChannelIntegration
|
8
|
+
from channel_app.logs.services import LogService
|
8
9
|
from channel_app.omnitron.batch_request import ClientBatchRequest
|
9
10
|
from channel_app.omnitron.constants import ContentType
|
10
11
|
|
@@ -14,97 +15,45 @@ class StockService(object):
|
|
14
15
|
|
15
16
|
def update_product_stocks(self, is_sync=True, is_success_log=True,
|
16
17
|
add_product_objects=False, add_price=False):
|
17
|
-
|
18
|
-
|
19
|
-
product_stocks = omnitron_integration.do_action(
|
20
|
-
key='get_updated_stocks')
|
21
|
-
first_product_stock_count = len(product_stocks)
|
22
|
-
if add_product_objects:
|
23
|
-
product_stocks = product_stocks and omnitron_integration.do_action(
|
24
|
-
key='get_product_objects', objects=product_stocks)
|
25
|
-
|
26
|
-
if add_price:
|
27
|
-
product_stocks = product_stocks and omnitron_integration.do_action(
|
28
|
-
key='get_prices_from_product_stocks',
|
29
|
-
objects=product_stocks,
|
30
|
-
stock_list=omnitron_integration.catalog.price_list)
|
31
|
-
|
32
|
-
if not product_stocks:
|
33
|
-
# TODO: Move this part under batch service
|
34
|
-
if first_product_stock_count:
|
35
|
-
omnitron_integration.batch_request.objects = None
|
36
|
-
self.batch_service(omnitron_integration.channel_id).to_fail(
|
37
|
-
omnitron_integration.batch_request
|
38
|
-
)
|
39
|
-
return
|
40
|
-
|
41
|
-
product_stocks: List[ProductStock]
|
42
|
-
response_data, reports, data = ChannelIntegration().do_action(
|
43
|
-
key='send_updated_stocks',
|
44
|
-
objects=product_stocks,
|
45
|
-
batch_request=omnitron_integration.batch_request,
|
46
|
-
is_sync=is_sync)
|
47
|
-
|
48
|
-
# tips
|
49
|
-
response_data: List[BatchRequestResponseDto]
|
50
|
-
reports: List[ErrorReportDto]
|
51
|
-
data: List[ProductStock]
|
52
|
-
|
53
|
-
if not is_sync:
|
54
|
-
if reports[0].is_ok:
|
55
|
-
self.batch_service(
|
56
|
-
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
57
|
-
batch_request=omnitron_integration.batch_request)
|
58
|
-
else:
|
59
|
-
is_sync = True
|
60
|
-
|
61
|
-
if reports and (is_success_log or not reports[0].is_ok):
|
62
|
-
for report in reports:
|
63
|
-
omnitron_integration.do_action(
|
64
|
-
key='create_error_report',
|
65
|
-
objects=report)
|
66
|
-
|
67
|
-
if is_sync:
|
68
|
-
omnitron_integration.do_action(
|
69
|
-
key='process_stock_batch_requests',
|
70
|
-
objects=response_data)
|
18
|
+
log_service = LogService()
|
19
|
+
log_service.create_flow(name="Update Product Stocks")
|
71
20
|
|
72
|
-
|
73
|
-
is_success_log=True,
|
74
|
-
add_price=False,
|
75
|
-
add_product_objects=False):
|
76
|
-
warehouse_mappings = self.get_warehouse_mappings()
|
77
|
-
for stock_list_id, country_code in warehouse_mappings.items():
|
21
|
+
try:
|
78
22
|
with OmnitronIntegration(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
23
|
+
content_type=ContentType.product_stock.value) as omnitron_integration:
|
24
|
+
with log_service.step("get_updated_stocks"):
|
25
|
+
product_stocks = omnitron_integration.do_action(
|
26
|
+
key='get_updated_stocks')
|
83
27
|
first_product_stock_count = len(product_stocks)
|
84
28
|
if add_product_objects:
|
85
|
-
|
86
|
-
|
29
|
+
with log_service.step("get_product_objects"):
|
30
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
31
|
+
key='get_product_objects', objects=product_stocks)
|
87
32
|
|
88
33
|
if add_price:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
34
|
+
with log_service.step("get_prices_from_product_stocks"):
|
35
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
36
|
+
key='get_prices_from_product_stocks',
|
37
|
+
objects=product_stocks,
|
38
|
+
stock_list=omnitron_integration.catalog.price_list)
|
93
39
|
|
94
40
|
if not product_stocks:
|
41
|
+
# TODO: Move this part under batch service
|
95
42
|
if first_product_stock_count:
|
96
43
|
omnitron_integration.batch_request.objects = None
|
97
|
-
|
98
|
-
omnitron_integration.
|
99
|
-
|
44
|
+
with log_service.step("batch_to_fail"):
|
45
|
+
self.batch_service(omnitron_integration.channel_id).to_fail(
|
46
|
+
omnitron_integration.batch_request
|
47
|
+
)
|
100
48
|
return
|
101
49
|
|
102
50
|
product_stocks: List[ProductStock]
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
51
|
+
with log_service.step("send_updated_stocks"):
|
52
|
+
response_data, reports, data = ChannelIntegration().do_action(
|
53
|
+
key='send_updated_stocks',
|
54
|
+
objects=product_stocks,
|
55
|
+
batch_request=omnitron_integration.batch_request,
|
56
|
+
is_sync=is_sync)
|
108
57
|
|
109
58
|
# tips
|
110
59
|
response_data: List[BatchRequestResponseDto]
|
@@ -113,60 +62,228 @@ class StockService(object):
|
|
113
62
|
|
114
63
|
if not is_sync:
|
115
64
|
if reports[0].is_ok:
|
116
|
-
|
117
|
-
|
118
|
-
|
65
|
+
with log_service.step("batch_send_to_remote"):
|
66
|
+
self.batch_service(
|
67
|
+
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
68
|
+
batch_request=omnitron_integration.batch_request)
|
119
69
|
else:
|
120
70
|
is_sync = True
|
121
71
|
|
122
72
|
if reports and (is_success_log or not reports[0].is_ok):
|
123
73
|
for report in reports:
|
124
|
-
|
125
|
-
|
126
|
-
|
74
|
+
with log_service.step("create_error_report"):
|
75
|
+
omnitron_integration.do_action(
|
76
|
+
key='create_error_report',
|
77
|
+
objects=report)
|
127
78
|
|
128
79
|
if is_sync:
|
129
|
-
|
130
|
-
|
131
|
-
|
80
|
+
with log_service.step("process_stock_batch_requests"):
|
81
|
+
omnitron_integration.do_action(
|
82
|
+
key='process_stock_batch_requests',
|
83
|
+
objects=response_data)
|
84
|
+
except Exception as fatal:
|
85
|
+
log_service.add_exception(fatal)
|
86
|
+
finally:
|
87
|
+
log_service.save()
|
88
|
+
|
89
|
+
def update_product_stocks_from_extra_stock_list(self, is_sync=True,
|
90
|
+
is_success_log=True,
|
91
|
+
add_price=False,
|
92
|
+
add_product_objects=False):
|
93
|
+
log_service = LogService()
|
94
|
+
log_service.create_flow(name="Update Product Stocks from Extra Stock List")
|
95
|
+
|
96
|
+
try:
|
97
|
+
warehouse_mappings = self.get_warehouse_mappings()
|
98
|
+
for stock_list_id, country_code in warehouse_mappings.items():
|
99
|
+
with OmnitronIntegration(
|
100
|
+
content_type=ContentType.product_stock.value) as omnitron_integration:
|
101
|
+
with log_service.step("get_updated_stocks_from_extra_stock_list"):
|
102
|
+
product_stocks = omnitron_integration.do_action(
|
103
|
+
key='get_updated_stocks_from_extra_stock_list',
|
104
|
+
objects=stock_list_id)
|
105
|
+
first_product_stock_count = len(product_stocks)
|
106
|
+
if add_product_objects:
|
107
|
+
with log_service.step("get_product_objects"):
|
108
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
109
|
+
key='get_product_objects', objects=product_stocks)
|
110
|
+
|
111
|
+
if add_price:
|
112
|
+
with log_service.step("get_prices_from_product_stocks"):
|
113
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
114
|
+
key='get_prices_from_product_stocks',
|
115
|
+
objects=product_stocks,
|
116
|
+
stock_list=omnitron_integration.catalog.price_list)
|
117
|
+
|
118
|
+
if not product_stocks:
|
119
|
+
if first_product_stock_count:
|
120
|
+
omnitron_integration.batch_request.objects = None
|
121
|
+
with log_service.step("batch_to_fail"):
|
122
|
+
self.batch_service(omnitron_integration.channel_id).to_fail(
|
123
|
+
omnitron_integration.batch_request
|
124
|
+
)
|
125
|
+
return
|
126
|
+
|
127
|
+
product_stocks: List[ProductStock]
|
128
|
+
with log_service.step("send_updated_stocks"):
|
129
|
+
response_data, reports, data = ChannelIntegration().do_action(
|
130
|
+
key='send_updated_stocks',
|
131
|
+
objects=(product_stocks, country_code),
|
132
|
+
batch_request=omnitron_integration.batch_request,
|
133
|
+
is_sync=is_sync)
|
134
|
+
|
135
|
+
# tips
|
136
|
+
response_data: List[BatchRequestResponseDto]
|
137
|
+
reports: List[ErrorReportDto]
|
138
|
+
data: List[ProductStock]
|
139
|
+
|
140
|
+
if not is_sync:
|
141
|
+
if reports[0].is_ok:
|
142
|
+
with log_service.step("batch_send_to_remote"):
|
143
|
+
self.batch_service(
|
144
|
+
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
145
|
+
batch_request=omnitron_integration.batch_request)
|
146
|
+
else:
|
147
|
+
is_sync = True
|
148
|
+
|
149
|
+
if reports and (is_success_log or not reports[0].is_ok):
|
150
|
+
for report in reports:
|
151
|
+
with log_service.step("create_error_report"):
|
152
|
+
omnitron_integration.do_action(
|
153
|
+
key='create_error_report',
|
154
|
+
objects=report)
|
155
|
+
|
156
|
+
if is_sync:
|
157
|
+
with log_service.step("process_stock_batch_requests"):
|
158
|
+
omnitron_integration.do_action(
|
159
|
+
key='process_stock_batch_requests',
|
160
|
+
objects=response_data)
|
161
|
+
except Exception as fatal:
|
162
|
+
log_service.add_exception(fatal)
|
163
|
+
raise
|
164
|
+
finally:
|
165
|
+
log_service.save()
|
132
166
|
|
133
167
|
def insert_product_stocks_from_extra_stock_list(self, is_sync=True,
|
134
168
|
is_success_log=True,
|
135
169
|
add_price=False,
|
136
170
|
add_product_objects=False):
|
137
|
-
|
138
|
-
|
171
|
+
log_service = LogService()
|
172
|
+
log_service.create_flow(name="Insert Product Stocks from Extra Stock List")
|
173
|
+
|
174
|
+
try:
|
175
|
+
warehouse_mappings = self.get_warehouse_mappings()
|
176
|
+
for stock_list_id, country_code in warehouse_mappings.items():
|
177
|
+
with OmnitronIntegration(
|
178
|
+
content_type=ContentType.product_stock.value) as omnitron_integration:
|
179
|
+
with log_service.step("get_inserted_stocks_from_extra_stock_list"):
|
180
|
+
product_stocks = omnitron_integration.do_action(
|
181
|
+
key='get_inserted_stocks_from_extra_stock_list',
|
182
|
+
objects=stock_list_id)
|
183
|
+
first_product_stock_count = len(product_stocks)
|
184
|
+
if add_product_objects:
|
185
|
+
with log_service.step("get_product_objects"):
|
186
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
187
|
+
key='get_product_objects', objects=product_stocks)
|
188
|
+
|
189
|
+
if add_price:
|
190
|
+
with log_service.step("get_prices_from_product_stocks"):
|
191
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
192
|
+
key='get_prices_from_product_stocks',
|
193
|
+
objects=product_stocks,
|
194
|
+
stock_list=omnitron_integration.catalog.price_list)
|
195
|
+
|
196
|
+
if not product_stocks:
|
197
|
+
if first_product_stock_count:
|
198
|
+
omnitron_integration.batch_request.objects = None
|
199
|
+
with log_service.step("batch_to_fail"):
|
200
|
+
self.batch_service(omnitron_integration.channel_id).to_fail(
|
201
|
+
omnitron_integration.batch_request
|
202
|
+
)
|
203
|
+
return
|
204
|
+
|
205
|
+
product_stocks: List[ProductStock]
|
206
|
+
with log_service.step("send_inserted_stocks"):
|
207
|
+
response_data, reports, data = ChannelIntegration().do_action(
|
208
|
+
key='send_inserted_stocks',
|
209
|
+
objects=(product_stocks, country_code),
|
210
|
+
batch_request=omnitron_integration.batch_request,
|
211
|
+
is_sync=is_sync)
|
212
|
+
|
213
|
+
# tips
|
214
|
+
response_data: List[BatchRequestResponseDto]
|
215
|
+
reports: List[ErrorReportDto]
|
216
|
+
data: List[ProductStock]
|
217
|
+
|
218
|
+
if not is_sync:
|
219
|
+
if reports[0].is_ok:
|
220
|
+
with log_service.step("batch_end_to_remote"):
|
221
|
+
self.batch_service(
|
222
|
+
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
223
|
+
batch_request=omnitron_integration.batch_request)
|
224
|
+
else:
|
225
|
+
is_sync = True
|
226
|
+
|
227
|
+
if reports and (is_success_log or not reports[0].is_ok):
|
228
|
+
for report in reports:
|
229
|
+
with log_service.step("create_error_report"):
|
230
|
+
omnitron_integration.do_action(
|
231
|
+
key='create_error_report',
|
232
|
+
objects=report)
|
233
|
+
|
234
|
+
if is_sync:
|
235
|
+
with log_service.step("process_stock_batch_requests"):
|
236
|
+
omnitron_integration.do_action(
|
237
|
+
key='process_stock_batch_requests',
|
238
|
+
objects=response_data)
|
239
|
+
except Exception as fatal:
|
240
|
+
log_service.add_exception(fatal)
|
241
|
+
raise
|
242
|
+
finally:
|
243
|
+
log_service.save()
|
244
|
+
|
245
|
+
def insert_product_stocks(self, is_sync=True, is_success_log=True,
|
246
|
+
add_product_objects=False, add_price=False):
|
247
|
+
log_service = LogService()
|
248
|
+
log_service.create_flow(name="Insert Product Stocks")
|
249
|
+
|
250
|
+
try:
|
139
251
|
with OmnitronIntegration(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
252
|
+
content_type=ContentType.product_stock.value) as omnitron_integration:
|
253
|
+
with log_service.step("get_inserted_stocks"):
|
254
|
+
product_stocks = omnitron_integration.do_action(
|
255
|
+
key='get_inserted_stocks')
|
256
|
+
|
144
257
|
first_product_stock_count = len(product_stocks)
|
258
|
+
|
145
259
|
if add_product_objects:
|
146
|
-
|
147
|
-
|
260
|
+
with log_service.step("get_product_objects"):
|
261
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
262
|
+
key='get_product_objects', objects=product_stocks)
|
148
263
|
|
149
264
|
if add_price:
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
265
|
+
with log_service.step("get_prices_from_product_stocks"):
|
266
|
+
product_stocks = product_stocks and omnitron_integration.do_action(
|
267
|
+
key='get_prices_from_product_stocks',
|
268
|
+
objects=product_stocks,
|
269
|
+
stock_list=omnitron_integration.catalog.price_list)
|
154
270
|
|
155
271
|
if not product_stocks:
|
156
272
|
if first_product_stock_count:
|
157
273
|
omnitron_integration.batch_request.objects = None
|
158
|
-
|
159
|
-
omnitron_integration.
|
160
|
-
|
274
|
+
with log_service.step("batch_to_fail"):
|
275
|
+
self.batch_service(omnitron_integration.channel_id).to_fail(
|
276
|
+
omnitron_integration.batch_request
|
277
|
+
)
|
161
278
|
return
|
162
279
|
|
163
280
|
product_stocks: List[ProductStock]
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
281
|
+
with log_service.step("send_inserted_stocks"):
|
282
|
+
response_data, reports, data = ChannelIntegration().do_action(
|
283
|
+
key='send_inserted_stocks',
|
284
|
+
objects=product_stocks,
|
285
|
+
batch_request=omnitron_integration.batch_request,
|
286
|
+
is_sync=is_sync)
|
170
287
|
# tips
|
171
288
|
response_data: List[BatchRequestResponseDto]
|
172
289
|
reports: List[ErrorReportDto]
|
@@ -174,112 +291,77 @@ class StockService(object):
|
|
174
291
|
|
175
292
|
if not is_sync:
|
176
293
|
if reports[0].is_ok:
|
177
|
-
|
178
|
-
|
179
|
-
|
294
|
+
with log_service.step("batch_send_to_remote"):
|
295
|
+
self.batch_service(
|
296
|
+
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
297
|
+
batch_request=omnitron_integration.batch_request)
|
180
298
|
else:
|
181
299
|
is_sync = True
|
182
300
|
|
183
301
|
if reports and (is_success_log or not reports[0].is_ok):
|
184
302
|
for report in reports:
|
185
|
-
|
186
|
-
|
187
|
-
|
303
|
+
with log_service.step("create_error_report"):
|
304
|
+
omnitron_integration.do_action(
|
305
|
+
key='create_error_report',
|
306
|
+
objects=report)
|
188
307
|
|
189
308
|
if is_sync:
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
key='get_inserted_stocks')
|
200
|
-
first_product_stock_count = len(product_stocks)
|
201
|
-
|
202
|
-
if add_product_objects:
|
203
|
-
product_stocks = product_stocks and omnitron_integration.do_action(
|
204
|
-
key='get_product_objects', objects=product_stocks)
|
205
|
-
|
206
|
-
if add_price:
|
207
|
-
product_stocks = product_stocks and omnitron_integration.do_action(
|
208
|
-
key='get_prices_from_product_stocks',
|
209
|
-
objects=product_stocks,
|
210
|
-
stock_list=omnitron_integration.catalog.price_list)
|
211
|
-
|
212
|
-
if not product_stocks:
|
213
|
-
if first_product_stock_count:
|
214
|
-
omnitron_integration.batch_request.objects = None
|
215
|
-
self.batch_service(omnitron_integration.channel_id).to_fail(
|
216
|
-
omnitron_integration.batch_request
|
217
|
-
)
|
218
|
-
return
|
219
|
-
|
220
|
-
product_stocks: List[ProductStock]
|
221
|
-
response_data, reports, data = ChannelIntegration().do_action(
|
222
|
-
key='send_inserted_stocks',
|
223
|
-
objects=product_stocks,
|
224
|
-
batch_request=omnitron_integration.batch_request,
|
225
|
-
is_sync=is_sync)
|
226
|
-
# tips
|
227
|
-
response_data: List[BatchRequestResponseDto]
|
228
|
-
reports: List[ErrorReportDto]
|
229
|
-
data: List[ProductStock]
|
230
|
-
|
231
|
-
if not is_sync:
|
232
|
-
if reports[0].is_ok:
|
233
|
-
self.batch_service(
|
234
|
-
settings.OMNITRON_CHANNEL_ID).to_sent_to_remote(
|
235
|
-
batch_request=omnitron_integration.batch_request)
|
236
|
-
else:
|
237
|
-
is_sync = True
|
238
|
-
|
239
|
-
if reports and (is_success_log or not reports[0].is_ok):
|
240
|
-
for report in reports:
|
241
|
-
omnitron_integration.do_action(
|
242
|
-
key='create_error_report',
|
243
|
-
objects=report)
|
244
|
-
|
245
|
-
if is_sync:
|
246
|
-
omnitron_integration.do_action(
|
247
|
-
key='process_stock_batch_requests',
|
248
|
-
objects=response_data)
|
309
|
+
with log_service.step("process_stock_batch_requests"):
|
310
|
+
omnitron_integration.do_action(
|
311
|
+
key='process_stock_batch_requests',
|
312
|
+
objects=response_data)
|
313
|
+
except Exception as fatal:
|
314
|
+
log_service.add_exception(fatal)
|
315
|
+
raise
|
316
|
+
finally:
|
317
|
+
log_service.save()
|
249
318
|
|
250
319
|
def get_stock_batch_requests(self, is_success_log=True):
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
key='check_stocks',
|
263
|
-
objects=batch_request,
|
264
|
-
batch_request=batch_request
|
265
|
-
)
|
266
|
-
|
320
|
+
log_service = LogService()
|
321
|
+
log_service.create_flow(name="Get Stock Batch Requests")
|
322
|
+
|
323
|
+
try:
|
324
|
+
with OmnitronIntegration(create_batch=False) as omnitron_integration:
|
325
|
+
with log_service.step("get_batch_requests"):
|
326
|
+
batch_request_data = omnitron_integration.do_action(
|
327
|
+
'get_batch_requests',
|
328
|
+
params={
|
329
|
+
"status": ["sent_to_remote", "ongoing"],
|
330
|
+
"content_type": ContentType.product_stock.value})
|
267
331
|
# tips
|
268
|
-
|
269
|
-
|
270
|
-
|
332
|
+
batch_request_data: List[BatchRequest]
|
333
|
+
|
334
|
+
for batch_request in batch_request_data:
|
335
|
+
with log_service.step("check_stocks"):
|
336
|
+
response_data, reports, data = ChannelIntegration().do_action(
|
337
|
+
key='check_stocks',
|
338
|
+
objects=batch_request,
|
339
|
+
batch_request=batch_request
|
340
|
+
)
|
271
341
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
342
|
+
# tips
|
343
|
+
response_data: List[BatchRequestResponseDto]
|
344
|
+
reports: List[ErrorReportDto]
|
345
|
+
data: BatchRequest
|
346
|
+
|
347
|
+
if reports and (is_success_log or not reports[0].is_ok):
|
348
|
+
for report in reports:
|
349
|
+
with log_service.step("create_error_report"):
|
350
|
+
omnitron_integration.do_action(
|
351
|
+
key='create_error_report',
|
352
|
+
objects=report)
|
353
|
+
|
354
|
+
if response_data:
|
355
|
+
omnitron_integration.batch_request = batch_request
|
356
|
+
with log_service.step("process_stock_batch_requests"):
|
357
|
+
omnitron_integration.do_action(
|
358
|
+
key='process_stock_batch_requests',
|
359
|
+
objects=response_data)
|
360
|
+
except Exception as fatal:
|
361
|
+
log_service.add_exception(fatal)
|
362
|
+
raise
|
363
|
+
finally:
|
364
|
+
log_service.save()
|
283
365
|
|
284
366
|
def get_warehouse_mappings(self):
|
285
367
|
"""
|