oneCInteraction 1.2.1__tar.gz → 1.2.2__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.2}/PKG-INFO +1 -1
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/discounts.py +17 -4
- {onecinteraction-1.2.1 → onecinteraction-1.2.2/src/oneCInteraction.egg-info}/PKG-INFO +1 -1
- onecinteraction-1.2.2/src/oneCInteraction.egg-info/scm_version.json +8 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/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.2}/.github/workflows/publish.yml +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/.gitignore +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/LICENSE +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/README.md +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/pyproject.toml +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/setup.cfg +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/__init__.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/categories.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/characteristics.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/connection.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/customers.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/groups.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/log.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/nomenclature.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/orders.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction/structures.py +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/SOURCES.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/dependency_links.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/requires.txt +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/scm_file_list.json +0 -0
- {onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/top_level.txt +0 -0
|
@@ -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,
|
|
@@ -36,8 +42,15 @@ class DiscountsManager:
|
|
|
36
42
|
Скидки.ПроцентСкидкиНаценки > 0
|
|
37
43
|
"""
|
|
38
44
|
|
|
45
|
+
if s_discount_type_codeIn is not None:
|
|
46
|
+
query_text += "\n AND Скидки.Регистратор.ТипСкидкиНаценки.Код = &DiscountTypeCode"
|
|
47
|
+
|
|
48
|
+
query.Text = query_text
|
|
49
|
+
|
|
39
50
|
c_currDate = datetime.now(self.c_connection.tz_kiev).replace(tzinfo=None)
|
|
40
51
|
query.SetParameter("CurrentDate", c_currDate)
|
|
52
|
+
if s_discount_type_codeIn is not None:
|
|
53
|
+
query.SetParameter("DiscountTypeCode", s_discount_type_codeIn)
|
|
41
54
|
|
|
42
55
|
c_result = query.Execute()
|
|
43
56
|
if c_result is None or c_result.IsEmpty():
|
|
@@ -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
|
|
File without changes
|
{onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{onecinteraction-1.2.1 → onecinteraction-1.2.2}/src/oneCInteraction.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
|
File without changes
|