oneCInteraction 1.2.1__tar.gz → 1.2.3__tar.gz
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.
- {onecinteraction-1.2.1/src/oneCInteraction.egg-info → onecinteraction-1.2.3}/PKG-INFO +22 -2
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/README.md +21 -1
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/discounts.py +18 -4
- {onecinteraction-1.2.1 → onecinteraction-1.2.3/src/oneCInteraction.egg-info}/PKG-INFO +22 -2
- onecinteraction-1.2.3/src/oneCInteraction.egg-info/scm_version.json +8 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/tests/test_lib.py +5 -1
- onecinteraction-1.2.1/src/oneCInteraction.egg-info/scm_version.json +0 -8
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/.github/workflows/publish.yml +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/.gitignore +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/LICENSE +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/pyproject.toml +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/setup.cfg +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/__init__.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/categories.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/characteristics.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/connection.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/customers.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/groups.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/log.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/nomenclature.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/orders.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction/structures.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/SOURCES.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/dependency_links.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/requires.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/scm_file_list.json +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oneCInteraction
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: A Python library for interacting with 1C:Enterprise databases via COM connection.
|
|
5
5
|
Author: agcl
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -47,6 +47,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
47
47
|
- `Connection.characteristics` (`CharacteristicsManager`) — reads properties of product variants.
|
|
48
48
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
49
49
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
50
|
+
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
@@ -155,6 +156,14 @@ A buyer's order.
|
|
|
155
156
|
|
|
156
157
|
Calling `str(order_obj)` returns a nicely formatted HTML string suitable for sending to a Telegram bot.
|
|
157
158
|
|
|
159
|
+
#### `DiscountGroup`
|
|
160
|
+
Represents a group of nomenclature discounts.
|
|
161
|
+
- `s_name` (str): Discount group name or comment.
|
|
162
|
+
- `s_document_number` (str): Number of the document that set the discount in 1C.
|
|
163
|
+
- `s_discount_type_code` (str): Discount type code (e.g. `"B2B"`).
|
|
164
|
+
- `n_discount_percent` (float): Discount percentage.
|
|
165
|
+
- `l_nomenclatures` (list of dict): List of products in the discount group (each product is a dict with keys `"code"`, `"name"`, `"uuid"`, and `"char_name"`).
|
|
166
|
+
|
|
158
167
|
---
|
|
159
168
|
|
|
160
169
|
### 3. Nomenclature Manager `NomenclatureManager` (`Connection.nomenclature`)
|
|
@@ -239,7 +248,18 @@ Defined in [customers.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
239
248
|
|
|
240
249
|
---
|
|
241
250
|
|
|
242
|
-
### 9.
|
|
251
|
+
### 9. Discounts Manager `DiscountsManager` (`Connection.discounts`)
|
|
252
|
+
Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/discounts.py).
|
|
253
|
+
|
|
254
|
+
- `get_active_groups(s_discount_type_codeIn: str = None) -> list`
|
|
255
|
+
Retrieves active discount groups and returns them as a list of `DiscountGroup` objects.
|
|
256
|
+
- If `s_discount_type_codeIn` is specified, only returns groups matching that discount type code.
|
|
257
|
+
- Queries active discounts from the `СкидкиНаценкиНоменклатуры` information register.
|
|
258
|
+
- Only retrieves discounts where the percentage is greater than zero and the registrar document's end date (`ДатаОкончания`) is either not set or is greater than or equal to the current date.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### 10. Logging (`log.py`)
|
|
243
263
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
244
264
|
|
|
245
265
|
All actions are logged automatically. The library resolves the root directory of the project that imported it and stores log files in the relative path `log/system/[calling_module_name].log`.
|
|
@@ -32,6 +32,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
32
32
|
- `Connection.characteristics` (`CharacteristicsManager`) — reads properties of product variants.
|
|
33
33
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
34
34
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
35
|
+
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
@@ -140,6 +141,14 @@ A buyer's order.
|
|
|
140
141
|
|
|
141
142
|
Calling `str(order_obj)` returns a nicely formatted HTML string suitable for sending to a Telegram bot.
|
|
142
143
|
|
|
144
|
+
#### `DiscountGroup`
|
|
145
|
+
Represents a group of nomenclature discounts.
|
|
146
|
+
- `s_name` (str): Discount group name or comment.
|
|
147
|
+
- `s_document_number` (str): Number of the document that set the discount in 1C.
|
|
148
|
+
- `s_discount_type_code` (str): Discount type code (e.g. `"B2B"`).
|
|
149
|
+
- `n_discount_percent` (float): Discount percentage.
|
|
150
|
+
- `l_nomenclatures` (list of dict): List of products in the discount group (each product is a dict with keys `"code"`, `"name"`, `"uuid"`, and `"char_name"`).
|
|
151
|
+
|
|
143
152
|
---
|
|
144
153
|
|
|
145
154
|
### 3. Nomenclature Manager `NomenclatureManager` (`Connection.nomenclature`)
|
|
@@ -224,7 +233,18 @@ Defined in [customers.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
224
233
|
|
|
225
234
|
---
|
|
226
235
|
|
|
227
|
-
### 9.
|
|
236
|
+
### 9. Discounts Manager `DiscountsManager` (`Connection.discounts`)
|
|
237
|
+
Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/discounts.py).
|
|
238
|
+
|
|
239
|
+
- `get_active_groups(s_discount_type_codeIn: str = None) -> list`
|
|
240
|
+
Retrieves active discount groups and returns them as a list of `DiscountGroup` objects.
|
|
241
|
+
- If `s_discount_type_codeIn` is specified, only returns groups matching that discount type code.
|
|
242
|
+
- Queries active discounts from the `СкидкиНаценкиНоменклатуры` information register.
|
|
243
|
+
- Only retrieves discounts where the percentage is greater than zero and the registrar document's end date (`ДатаОкончания`) is either not set or is greater than or equal to the current date.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
### 10. Logging (`log.py`)
|
|
228
248
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
229
249
|
|
|
230
250
|
All actions are logged automatically. The library resolves the root directory of the project that imported it and stores log files in the relative path `log/system/[calling_module_name].log`.
|
|
@@ -10,16 +10,22 @@ class DiscountsManager:
|
|
|
10
10
|
def c_v8(self):
|
|
11
11
|
return self.c_connection.c_v8
|
|
12
12
|
|
|
13
|
-
def get_active_groups(self) -> list:
|
|
14
|
-
"""Retrieves and groups
|
|
13
|
+
def get_active_groups(self, s_discount_type_codeIn: str = None) -> list:
|
|
14
|
+
"""Retrieves and groups active nomenclature discounts into DiscountGroup structures.
|
|
15
|
+
If s_discount_type_codeIn is specified, only returns groups matching that discount type code.
|
|
16
|
+
"""
|
|
15
17
|
if not self.c_v8:
|
|
16
18
|
log_sys("Failed to get active discount groups: No connection to 1C.", 1)
|
|
17
19
|
return []
|
|
18
20
|
|
|
19
21
|
try:
|
|
20
|
-
|
|
22
|
+
if s_discount_type_codeIn is not None:
|
|
23
|
+
log_sys(f"Fetching active nomenclature discounts from 1C filtered by type code: '{s_discount_type_codeIn}'...")
|
|
24
|
+
else:
|
|
25
|
+
log_sys("Fetching active nomenclature discounts from 1C...")
|
|
21
26
|
query = self.c_v8.NewObject("Query")
|
|
22
|
-
|
|
27
|
+
|
|
28
|
+
query_text = """
|
|
23
29
|
SELECT
|
|
24
30
|
Скидки.Регистратор.Номер КАК DocNumber,
|
|
25
31
|
ISNULL(Скидки.Регистратор.ТипСкидкиНаценки.Наименование, "Знижка") КАК DiscountName,
|
|
@@ -34,10 +40,18 @@ class DiscountsManager:
|
|
|
34
40
|
РегистрСведений.СкидкиНаценкиНоменклатуры.СрезПоследних(&CurrentDate, ) КАК Скидки
|
|
35
41
|
WHERE
|
|
36
42
|
Скидки.ПроцентСкидкиНаценки > 0
|
|
43
|
+
AND (Скидки.Регистратор.ДатаОкончания = DATETIME(1, 1, 1) OR Скидки.Регистратор.ДатаОкончания >= &CurrentDate)
|
|
37
44
|
"""
|
|
38
45
|
|
|
46
|
+
if s_discount_type_codeIn is not None:
|
|
47
|
+
query_text += "\n AND Скидки.Регистратор.ТипСкидкиНаценки.Код = &DiscountTypeCode"
|
|
48
|
+
|
|
49
|
+
query.Text = query_text
|
|
50
|
+
|
|
39
51
|
c_currDate = datetime.now(self.c_connection.tz_kiev).replace(tzinfo=None)
|
|
40
52
|
query.SetParameter("CurrentDate", c_currDate)
|
|
53
|
+
if s_discount_type_codeIn is not None:
|
|
54
|
+
query.SetParameter("DiscountTypeCode", s_discount_type_codeIn)
|
|
41
55
|
|
|
42
56
|
c_result = query.Execute()
|
|
43
57
|
if c_result is None or c_result.IsEmpty():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oneCInteraction
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: A Python library for interacting with 1C:Enterprise databases via COM connection.
|
|
5
5
|
Author: agcl
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -47,6 +47,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
47
47
|
- `Connection.characteristics` (`CharacteristicsManager`) — reads properties of product variants.
|
|
48
48
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
49
49
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
50
|
+
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
@@ -155,6 +156,14 @@ A buyer's order.
|
|
|
155
156
|
|
|
156
157
|
Calling `str(order_obj)` returns a nicely formatted HTML string suitable for sending to a Telegram bot.
|
|
157
158
|
|
|
159
|
+
#### `DiscountGroup`
|
|
160
|
+
Represents a group of nomenclature discounts.
|
|
161
|
+
- `s_name` (str): Discount group name or comment.
|
|
162
|
+
- `s_document_number` (str): Number of the document that set the discount in 1C.
|
|
163
|
+
- `s_discount_type_code` (str): Discount type code (e.g. `"B2B"`).
|
|
164
|
+
- `n_discount_percent` (float): Discount percentage.
|
|
165
|
+
- `l_nomenclatures` (list of dict): List of products in the discount group (each product is a dict with keys `"code"`, `"name"`, `"uuid"`, and `"char_name"`).
|
|
166
|
+
|
|
158
167
|
---
|
|
159
168
|
|
|
160
169
|
### 3. Nomenclature Manager `NomenclatureManager` (`Connection.nomenclature`)
|
|
@@ -239,7 +248,18 @@ Defined in [customers.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
239
248
|
|
|
240
249
|
---
|
|
241
250
|
|
|
242
|
-
### 9.
|
|
251
|
+
### 9. Discounts Manager `DiscountsManager` (`Connection.discounts`)
|
|
252
|
+
Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/discounts.py).
|
|
253
|
+
|
|
254
|
+
- `get_active_groups(s_discount_type_codeIn: str = None) -> list`
|
|
255
|
+
Retrieves active discount groups and returns them as a list of `DiscountGroup` objects.
|
|
256
|
+
- If `s_discount_type_codeIn` is specified, only returns groups matching that discount type code.
|
|
257
|
+
- Queries active discounts from the `СкидкиНаценкиНоменклатуры` information register.
|
|
258
|
+
- Only retrieves discounts where the percentage is greater than zero and the registrar document's end date (`ДатаОкончания`) is either not set or is greater than or equal to the current date.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### 10. Logging (`log.py`)
|
|
243
263
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
244
264
|
|
|
245
265
|
All actions are logged automatically. The library resolves the root directory of the project that imported it and stores log files in the relative path `log/system/[calling_module_name].log`.
|
|
@@ -116,7 +116,11 @@ try:
|
|
|
116
116
|
# Test DiscountsManager when connection is not active
|
|
117
117
|
discounts_res = c_conn.discounts.get_active_groups()
|
|
118
118
|
assert isinstance(discounts_res, list) and len(discounts_res) == 0, f"Expected empty list since connection is not active, got {discounts_res}"
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
discounts_res_filtered = c_conn.discounts.get_active_groups("B2B")
|
|
121
|
+
assert isinstance(discounts_res_filtered, list) and len(discounts_res_filtered) == 0, f"Expected empty list since connection is not active, got {discounts_res_filtered}"
|
|
122
|
+
|
|
123
|
+
print("Success: DiscountsManager.get_active_groups tested with no active connection (with and without s_discount_type_codeIn parameter).")
|
|
120
124
|
|
|
121
125
|
# Test CustomersManager when connection is not active
|
|
122
126
|
cust_res = c_conn.customers.get("CUST001")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{onecinteraction-1.2.1 → onecinteraction-1.2.3}/src/oneCInteraction.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
|
File without changes
|