oneCInteraction 1.2.4__tar.gz → 1.2.5__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.4/src/oneCInteraction.egg-info → onecinteraction-1.2.5}/PKG-INFO +26 -2
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/README.md +25 -1
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/__init__.py +2 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/connection.py +2 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/nomenclature.py +73 -4
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/structures.py +11 -1
- {onecinteraction-1.2.4 → onecinteraction-1.2.5/src/oneCInteraction.egg-info}/PKG-INFO +26 -2
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/scm_file_list.json +11 -11
- onecinteraction-1.2.5/src/oneCInteraction.egg-info/scm_version.json +8 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/tests/test_lib.py +20 -3
- onecinteraction-1.2.4/src/oneCInteraction.egg-info/scm_version.json +0 -8
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/.github/workflows/publish.yml +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/.gitignore +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/LICENSE +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/pyproject.toml +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/setup.cfg +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/categories.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/characteristics.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/customers.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/discounts.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/groups.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/log.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction/orders.py +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/SOURCES.txt +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/dependency_links.txt +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/requires.txt +0 -0
- {onecinteraction-1.2.4 → onecinteraction-1.2.5}/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.5
|
|
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
|
|
@@ -21,6 +21,7 @@ A modular Python library for interacting with «1C:Enterprise» databases via a
|
|
|
21
21
|
- **Full COM Connection Support** via `win32com`.
|
|
22
22
|
- **Nomenclature and Categories Management**: retrieve group trees, batch load products, prices, and stock balances across warehouses.
|
|
23
23
|
- **Product Characteristics**: read variant properties from information registers or parse text descriptions.
|
|
24
|
+
- **Product Properties (Metadata)**: read and write general metadata (properties) of Nomenclature items to/from information registers.
|
|
24
25
|
- **Images**: download product images directly from the 1C database to the local disk.
|
|
25
26
|
- **Order Management**: create customer orders, track statuses, and update document comments with customer contact details.
|
|
26
27
|
- **Smart Logging**: automatically creates log files in the directory of the host project importing the library.
|
|
@@ -48,6 +49,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
48
49
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
49
50
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
50
51
|
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
52
|
+
- `Connection.properties` (`PropertiesManager`) — manages reading and writing general product properties.
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|
|
@@ -93,6 +95,7 @@ Represents a product.
|
|
|
93
95
|
- `s_code` (str): 1C product code.
|
|
94
96
|
- `l_images` (list): List of image UUIDs associated with the product in 1C.
|
|
95
97
|
- `dt_last_arrival` (datetime): Date of the last physical arrival of the product to the warehouse from 1C.
|
|
98
|
+
- `l_properties` (list of `Property`): List of general properties (metadata) of the product.
|
|
96
99
|
|
|
97
100
|
#### `Price`
|
|
98
101
|
Represents a price with its value, assignment date, and type.
|
|
@@ -113,6 +116,11 @@ A key-value pair for a variant property.
|
|
|
113
116
|
- `s_name` (str): Property name (e.g., `"Color"`).
|
|
114
117
|
- `s_value` (str): Property value (e.g., `"Red"`).
|
|
115
118
|
|
|
119
|
+
#### `Property`
|
|
120
|
+
A key-value pair for a product property (metadata).
|
|
121
|
+
- `s_name` (str): Property name (e.g., `"Material"`).
|
|
122
|
+
- `s_value` (str): Property value (e.g., `"Cotton"`).
|
|
123
|
+
|
|
116
124
|
#### `Group`
|
|
117
125
|
A product group (category).
|
|
118
126
|
- `s_name` (str): Group name.
|
|
@@ -264,7 +272,23 @@ Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
264
272
|
|
|
265
273
|
---
|
|
266
274
|
|
|
267
|
-
### 10.
|
|
275
|
+
### 10. Properties Manager `PropertiesManager` (`Connection.properties`)
|
|
276
|
+
Defined in [properties.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/properties.py).
|
|
277
|
+
|
|
278
|
+
- `write(self, c_productIn, s_propertyNameOrCodeIn: str, s_propertyValueIn: str) -> bool`
|
|
279
|
+
Writes or updates a single property value for a product (Nomenclature item).
|
|
280
|
+
- `write_batch(self, c_productIn, l_propertiesIn: list, b_forceIn: bool = False) -> list`
|
|
281
|
+
Writes/updates multiple properties for a product using a single 1C RecordSet. `l_propertiesIn` can be a list of `Property` objects or dicts `{"name": "...", "value": "..."}`.
|
|
282
|
+
- `get_assigned_properties(self, c_productIn) -> list`
|
|
283
|
+
Returns a list of `Property` objects assigned to the specified product.
|
|
284
|
+
- `delete(self, c_productIn, s_propertyNameOrCodeIn: str) -> bool`
|
|
285
|
+
Removes a specific property from a product in 1C register.
|
|
286
|
+
- `get_all_definitions(self) -> list`
|
|
287
|
+
Retrieves definitions of all active properties in 1C.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### 11. Logging (`log.py`)
|
|
268
292
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
269
293
|
|
|
270
294
|
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`.
|
|
@@ -6,6 +6,7 @@ A modular Python library for interacting with «1C:Enterprise» databases via a
|
|
|
6
6
|
- **Full COM Connection Support** via `win32com`.
|
|
7
7
|
- **Nomenclature and Categories Management**: retrieve group trees, batch load products, prices, and stock balances across warehouses.
|
|
8
8
|
- **Product Characteristics**: read variant properties from information registers or parse text descriptions.
|
|
9
|
+
- **Product Properties (Metadata)**: read and write general metadata (properties) of Nomenclature items to/from information registers.
|
|
9
10
|
- **Images**: download product images directly from the 1C database to the local disk.
|
|
10
11
|
- **Order Management**: create customer orders, track statuses, and update document comments with customer contact details.
|
|
11
12
|
- **Smart Logging**: automatically creates log files in the directory of the host project importing the library.
|
|
@@ -33,6 +34,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
33
34
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
34
35
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
35
36
|
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
37
|
+
- `Connection.properties` (`PropertiesManager`) — manages reading and writing general product properties.
|
|
36
38
|
|
|
37
39
|
---
|
|
38
40
|
|
|
@@ -78,6 +80,7 @@ Represents a product.
|
|
|
78
80
|
- `s_code` (str): 1C product code.
|
|
79
81
|
- `l_images` (list): List of image UUIDs associated with the product in 1C.
|
|
80
82
|
- `dt_last_arrival` (datetime): Date of the last physical arrival of the product to the warehouse from 1C.
|
|
83
|
+
- `l_properties` (list of `Property`): List of general properties (metadata) of the product.
|
|
81
84
|
|
|
82
85
|
#### `Price`
|
|
83
86
|
Represents a price with its value, assignment date, and type.
|
|
@@ -98,6 +101,11 @@ A key-value pair for a variant property.
|
|
|
98
101
|
- `s_name` (str): Property name (e.g., `"Color"`).
|
|
99
102
|
- `s_value` (str): Property value (e.g., `"Red"`).
|
|
100
103
|
|
|
104
|
+
#### `Property`
|
|
105
|
+
A key-value pair for a product property (metadata).
|
|
106
|
+
- `s_name` (str): Property name (e.g., `"Material"`).
|
|
107
|
+
- `s_value` (str): Property value (e.g., `"Cotton"`).
|
|
108
|
+
|
|
101
109
|
#### `Group`
|
|
102
110
|
A product group (category).
|
|
103
111
|
- `s_name` (str): Group name.
|
|
@@ -249,7 +257,23 @@ Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
249
257
|
|
|
250
258
|
---
|
|
251
259
|
|
|
252
|
-
### 10.
|
|
260
|
+
### 10. Properties Manager `PropertiesManager` (`Connection.properties`)
|
|
261
|
+
Defined in [properties.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/properties.py).
|
|
262
|
+
|
|
263
|
+
- `write(self, c_productIn, s_propertyNameOrCodeIn: str, s_propertyValueIn: str) -> bool`
|
|
264
|
+
Writes or updates a single property value for a product (Nomenclature item).
|
|
265
|
+
- `write_batch(self, c_productIn, l_propertiesIn: list, b_forceIn: bool = False) -> list`
|
|
266
|
+
Writes/updates multiple properties for a product using a single 1C RecordSet. `l_propertiesIn` can be a list of `Property` objects or dicts `{"name": "...", "value": "..."}`.
|
|
267
|
+
- `get_assigned_properties(self, c_productIn) -> list`
|
|
268
|
+
Returns a list of `Property` objects assigned to the specified product.
|
|
269
|
+
- `delete(self, c_productIn, s_propertyNameOrCodeIn: str) -> bool`
|
|
270
|
+
Removes a specific property from a product in 1C register.
|
|
271
|
+
- `get_all_definitions(self) -> list`
|
|
272
|
+
Retrieves definitions of all active properties in 1C.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### 11. Logging (`log.py`)
|
|
253
277
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
254
278
|
|
|
255
279
|
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`.
|
|
@@ -9,6 +9,7 @@ from .characteristics import CharacteristicsManager
|
|
|
9
9
|
from .categories import CategoriesManager
|
|
10
10
|
from .customers import CustomersManager
|
|
11
11
|
from .discounts import DiscountsManager
|
|
12
|
+
from .properties import PropertiesManager
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class Connection:
|
|
@@ -41,6 +42,7 @@ class Connection:
|
|
|
41
42
|
self.categories = CategoriesManager(self)
|
|
42
43
|
self.customers = CustomersManager(self)
|
|
43
44
|
self.discounts = DiscountsManager(self)
|
|
45
|
+
self.properties = PropertiesManager(self)
|
|
44
46
|
|
|
45
47
|
def initiate_connection(self) -> None:
|
|
46
48
|
"""Establishes COM connection to 1C and caches price type references."""
|
|
@@ -167,6 +167,7 @@ class NomenclatureManager:
|
|
|
167
167
|
|
|
168
168
|
d_batchDetails = self._fetch_batch_details(l_productRefs)
|
|
169
169
|
d_batchArrivals = self._fetch_batch_last_arrivals(l_productRefs)
|
|
170
|
+
d_batchProperties = self._fetch_batch_properties(l_productRefs)
|
|
170
171
|
|
|
171
172
|
l_allCharRefs = []
|
|
172
173
|
for s_productUuid in d_batchDetails:
|
|
@@ -222,7 +223,8 @@ class NomenclatureManager:
|
|
|
222
223
|
s_uuidIn=s_productUuid,
|
|
223
224
|
s_codeIn=self.c_v8.String(d_item["code"]),
|
|
224
225
|
l_imagesIn=d_batchImages.get(s_productUuid, []),
|
|
225
|
-
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid)
|
|
226
|
+
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid),
|
|
227
|
+
l_propertiesIn=d_batchProperties.get(s_productUuid, [])
|
|
226
228
|
))
|
|
227
229
|
|
|
228
230
|
log_sys(f"Successfully processed {len(l_nomenclatures)} items in search mode.")
|
|
@@ -231,6 +233,47 @@ class NomenclatureManager:
|
|
|
231
233
|
log_sys(f"Error in NomenclatureManager.search (batch): {e}", 1)
|
|
232
234
|
return []
|
|
233
235
|
|
|
236
|
+
def _fetch_batch_properties(self, l_productRefsIn: list) -> dict:
|
|
237
|
+
"""Batch fetches properties and values for a list of product references."""
|
|
238
|
+
if not self.c_v8 or not l_productRefsIn:
|
|
239
|
+
return {}
|
|
240
|
+
|
|
241
|
+
log_sys(f"Batch fetching properties for {len(l_productRefsIn)} products...")
|
|
242
|
+
|
|
243
|
+
c_productRefsV8 = self.c_v8.NewObject("ValueList")
|
|
244
|
+
for c_ref in l_productRefsIn:
|
|
245
|
+
if c_ref and not c_ref.IsEmpty():
|
|
246
|
+
c_productRefsV8.Add(c_ref)
|
|
247
|
+
|
|
248
|
+
d_productProps = {} # {product_uuid: [Property]}
|
|
249
|
+
|
|
250
|
+
if c_productRefsV8.Count() > 0:
|
|
251
|
+
try:
|
|
252
|
+
c_propQuery = self.c_v8.NewObject("Query")
|
|
253
|
+
c_propQuery.Text = """
|
|
254
|
+
SELECT
|
|
255
|
+
Properties.Объект AS ProductRef,
|
|
256
|
+
Properties.Свойство.Наименование AS PropName,
|
|
257
|
+
Properties.Значение.Наименование AS ValName
|
|
258
|
+
FROM
|
|
259
|
+
РегистрСведений.ЗначенияСвойствОбъектов AS Properties
|
|
260
|
+
WHERE
|
|
261
|
+
Properties.Объект В (&ProductRefs)
|
|
262
|
+
"""
|
|
263
|
+
c_propQuery.SetParameter("ProductRefs", c_productRefsV8)
|
|
264
|
+
c_propRes = c_propQuery.Execute()
|
|
265
|
+
if c_propRes is not None and not c_propRes.IsEmpty():
|
|
266
|
+
c_sel = c_propRes.Select()
|
|
267
|
+
while c_sel.Next():
|
|
268
|
+
s_uuid = self.c_v8.String(c_sel.ProductRef.UUID())
|
|
269
|
+
if s_uuid not in d_productProps:
|
|
270
|
+
d_productProps[s_uuid] = []
|
|
271
|
+
d_productProps[s_uuid].append(structures.Property(c_sel.PropName, c_sel.ValName))
|
|
272
|
+
except Exception as e:
|
|
273
|
+
log_sys(f"Error batch fetching properties: {e}", 1)
|
|
274
|
+
|
|
275
|
+
return d_productProps
|
|
276
|
+
|
|
234
277
|
def _fetch_batch_details(self, l_productRefsIn: list) -> dict:
|
|
235
278
|
"""Batch fetches prices and stock quantities for a list of product references."""
|
|
236
279
|
if not self.c_v8 or not l_productRefsIn:
|
|
@@ -596,6 +639,27 @@ class NomenclatureManager:
|
|
|
596
639
|
dt_last_arrival = _parse_1c_date(c_arrivalSel.LastArrivalDate)
|
|
597
640
|
except Exception as e:
|
|
598
641
|
log_sys(f"Error fetching last arrival date for {s_articleIn}: {e}", 1)
|
|
642
|
+
# Fetch product properties
|
|
643
|
+
l_properties = []
|
|
644
|
+
try:
|
|
645
|
+
c_propQuery = self.c_v8.NewObject("Query")
|
|
646
|
+
c_propQuery.Text = """
|
|
647
|
+
SELECT
|
|
648
|
+
Properties.Свойство.Наименование AS PropName,
|
|
649
|
+
Properties.Значение.Наименование AS ValName
|
|
650
|
+
FROM
|
|
651
|
+
РегистрСведений.ЗначенияСвойствОбъектов AS Properties
|
|
652
|
+
WHERE
|
|
653
|
+
Properties.Объект = &ProductRef
|
|
654
|
+
"""
|
|
655
|
+
c_propQuery.SetParameter("ProductRef", c_productRefIn)
|
|
656
|
+
c_propRes = c_propQuery.Execute()
|
|
657
|
+
if c_propRes is not None and not c_propRes.IsEmpty():
|
|
658
|
+
c_sel = c_propRes.Select()
|
|
659
|
+
while c_sel.Next():
|
|
660
|
+
l_properties.append(structures.Property(c_sel.PropName, c_sel.ValName))
|
|
661
|
+
except Exception as e:
|
|
662
|
+
log_sys(f"Error fetching properties for {s_articleIn}: {e}", 1)
|
|
599
663
|
|
|
600
664
|
return structures.Nomenclature(
|
|
601
665
|
s_nameIn=s_nameIn,
|
|
@@ -606,7 +670,8 @@ class NomenclatureManager:
|
|
|
606
670
|
s_uuidIn=s_uuidIn,
|
|
607
671
|
s_codeIn=s_codeIn,
|
|
608
672
|
s_parent_uuidIn=s_parent_uuidIn,
|
|
609
|
-
dt_last_arrivalIn=dt_last_arrival
|
|
673
|
+
dt_last_arrivalIn=dt_last_arrival,
|
|
674
|
+
l_propertiesIn=l_properties
|
|
610
675
|
)
|
|
611
676
|
|
|
612
677
|
def get_images(self, c_productObjIn, s_imageDirIn: str = None) -> list:
|
|
@@ -738,6 +803,7 @@ class NomenclatureManager:
|
|
|
738
803
|
|
|
739
804
|
d_batchDetails = self._fetch_batch_details(l_productRefs)
|
|
740
805
|
d_batchArrivals = self._fetch_batch_last_arrivals(l_productRefs)
|
|
806
|
+
d_batchProperties = self._fetch_batch_properties(l_productRefs)
|
|
741
807
|
|
|
742
808
|
|
|
743
809
|
l_allCharRefs = []
|
|
@@ -797,7 +863,8 @@ class NomenclatureManager:
|
|
|
797
863
|
s_uuidIn=s_productUuid,
|
|
798
864
|
s_codeIn=self.c_v8.String(d_item["code"]),
|
|
799
865
|
l_imagesIn=d_batchImages.get(s_productUuid, []),
|
|
800
|
-
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid)
|
|
866
|
+
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid),
|
|
867
|
+
l_propertiesIn=d_batchProperties.get(s_productUuid, [])
|
|
801
868
|
))
|
|
802
869
|
|
|
803
870
|
log_sys(f"Successfully processed {len(l_nomenclatures)} items in batch mode.")
|
|
@@ -894,6 +961,7 @@ class NomenclatureManager:
|
|
|
894
961
|
|
|
895
962
|
d_batchDetails = self._fetch_batch_details(l_productRefs)
|
|
896
963
|
d_batchArrivals = self._fetch_batch_last_arrivals(l_productRefs)
|
|
964
|
+
d_batchProperties = self._fetch_batch_properties(l_productRefs)
|
|
897
965
|
|
|
898
966
|
|
|
899
967
|
l_allCharRefs = []
|
|
@@ -953,7 +1021,8 @@ class NomenclatureManager:
|
|
|
953
1021
|
s_uuidIn=s_productUuid,
|
|
954
1022
|
s_codeIn=self.c_v8.String(d_item["code"]),
|
|
955
1023
|
l_imagesIn=d_batchImages.get(s_productUuid, []),
|
|
956
|
-
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid)
|
|
1024
|
+
dt_last_arrivalIn=d_batchArrivals.get(s_productUuid),
|
|
1025
|
+
l_propertiesIn=d_batchProperties.get(s_productUuid, [])
|
|
957
1026
|
))
|
|
958
1027
|
|
|
959
1028
|
log_sys(f"Successfully processed {len(l_nomenclatures)} items in batch mode.")
|
|
@@ -12,7 +12,8 @@ class Nomenclature:
|
|
|
12
12
|
s_uuidIn: str = "",
|
|
13
13
|
s_codeIn: str = "",
|
|
14
14
|
l_imagesIn: list = None,
|
|
15
|
-
dt_last_arrivalIn: datetime = None
|
|
15
|
+
dt_last_arrivalIn: datetime = None,
|
|
16
|
+
l_propertiesIn: list = None
|
|
16
17
|
):
|
|
17
18
|
self.s_name = s_nameIn
|
|
18
19
|
self.s_article = s_articleIn
|
|
@@ -24,6 +25,7 @@ class Nomenclature:
|
|
|
24
25
|
self.s_code = s_codeIn
|
|
25
26
|
self.l_images = l_imagesIn if l_imagesIn is not None else []
|
|
26
27
|
self.dt_last_arrival = dt_last_arrivalIn
|
|
28
|
+
self.l_properties = l_propertiesIn if l_propertiesIn is not None else []
|
|
27
29
|
|
|
28
30
|
class Price:
|
|
29
31
|
def __init__(self, n_value: float, dt_assigned: datetime = None, s_type: str = ""):
|
|
@@ -55,6 +57,14 @@ class Characteristic:
|
|
|
55
57
|
self.s_name = s_nameIn
|
|
56
58
|
self.s_value = s_valueIn
|
|
57
59
|
|
|
60
|
+
class Property:
|
|
61
|
+
def __init__(self, s_nameIn: str, s_valueIn: str):
|
|
62
|
+
self.s_name = s_nameIn
|
|
63
|
+
self.s_value = s_valueIn
|
|
64
|
+
|
|
65
|
+
def __repr__(self):
|
|
66
|
+
return f"Property(name='{self.s_name}', value='{self.s_value}')"
|
|
67
|
+
|
|
58
68
|
class Group:
|
|
59
69
|
def __init__(
|
|
60
70
|
self,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oneCInteraction
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
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
|
|
@@ -21,6 +21,7 @@ A modular Python library for interacting with «1C:Enterprise» databases via a
|
|
|
21
21
|
- **Full COM Connection Support** via `win32com`.
|
|
22
22
|
- **Nomenclature and Categories Management**: retrieve group trees, batch load products, prices, and stock balances across warehouses.
|
|
23
23
|
- **Product Characteristics**: read variant properties from information registers or parse text descriptions.
|
|
24
|
+
- **Product Properties (Metadata)**: read and write general metadata (properties) of Nomenclature items to/from information registers.
|
|
24
25
|
- **Images**: download product images directly from the 1C database to the local disk.
|
|
25
26
|
- **Order Management**: create customer orders, track statuses, and update document comments with customer contact details.
|
|
26
27
|
- **Smart Logging**: automatically creates log files in the directory of the host project importing the library.
|
|
@@ -48,6 +49,7 @@ The library is built on the principle of composition: the main `Connection` clas
|
|
|
48
49
|
- `Connection.orders` (`OrdersManager`) — handles creation and updates of customer orders.
|
|
49
50
|
- `Connection.customers` (`CustomersManager`) — manages customers/counterparties.
|
|
50
51
|
- `Connection.discounts` (`DiscountsManager`) — manages discount groups and active nomenclature discounts.
|
|
52
|
+
- `Connection.properties` (`PropertiesManager`) — manages reading and writing general product properties.
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|
|
@@ -93,6 +95,7 @@ Represents a product.
|
|
|
93
95
|
- `s_code` (str): 1C product code.
|
|
94
96
|
- `l_images` (list): List of image UUIDs associated with the product in 1C.
|
|
95
97
|
- `dt_last_arrival` (datetime): Date of the last physical arrival of the product to the warehouse from 1C.
|
|
98
|
+
- `l_properties` (list of `Property`): List of general properties (metadata) of the product.
|
|
96
99
|
|
|
97
100
|
#### `Price`
|
|
98
101
|
Represents a price with its value, assignment date, and type.
|
|
@@ -113,6 +116,11 @@ A key-value pair for a variant property.
|
|
|
113
116
|
- `s_name` (str): Property name (e.g., `"Color"`).
|
|
114
117
|
- `s_value` (str): Property value (e.g., `"Red"`).
|
|
115
118
|
|
|
119
|
+
#### `Property`
|
|
120
|
+
A key-value pair for a product property (metadata).
|
|
121
|
+
- `s_name` (str): Property name (e.g., `"Material"`).
|
|
122
|
+
- `s_value` (str): Property value (e.g., `"Cotton"`).
|
|
123
|
+
|
|
116
124
|
#### `Group`
|
|
117
125
|
A product group (category).
|
|
118
126
|
- `s_name` (str): Group name.
|
|
@@ -264,7 +272,23 @@ Defined in [discounts.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionL
|
|
|
264
272
|
|
|
265
273
|
---
|
|
266
274
|
|
|
267
|
-
### 10.
|
|
275
|
+
### 10. Properties Manager `PropertiesManager` (`Connection.properties`)
|
|
276
|
+
Defined in [properties.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/properties.py).
|
|
277
|
+
|
|
278
|
+
- `write(self, c_productIn, s_propertyNameOrCodeIn: str, s_propertyValueIn: str) -> bool`
|
|
279
|
+
Writes or updates a single property value for a product (Nomenclature item).
|
|
280
|
+
- `write_batch(self, c_productIn, l_propertiesIn: list, b_forceIn: bool = False) -> list`
|
|
281
|
+
Writes/updates multiple properties for a product using a single 1C RecordSet. `l_propertiesIn` can be a list of `Property` objects or dicts `{"name": "...", "value": "..."}`.
|
|
282
|
+
- `get_assigned_properties(self, c_productIn) -> list`
|
|
283
|
+
Returns a list of `Property` objects assigned to the specified product.
|
|
284
|
+
- `delete(self, c_productIn, s_propertyNameOrCodeIn: str) -> bool`
|
|
285
|
+
Removes a specific property from a product in 1C register.
|
|
286
|
+
- `get_all_definitions(self) -> list`
|
|
287
|
+
Retrieves definitions of all active properties in 1C.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### 11. Logging (`log.py`)
|
|
268
292
|
Defined in [log.py](file:///c:/Users/agcl/PycharmProjects/oneCInteractionLib/src/oneCInteraction/log.py).
|
|
269
293
|
|
|
270
294
|
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`.
|
{onecinteraction-1.2.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/scm_file_list.json
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [
|
|
3
|
+
".gitignore",
|
|
3
4
|
"README.md",
|
|
4
|
-
"LICENSE",
|
|
5
5
|
"pyproject.toml",
|
|
6
|
-
"
|
|
7
|
-
"src/oneCInteraction/groups.py",
|
|
8
|
-
"src/oneCInteraction/__init__.py",
|
|
9
|
-
"src/oneCInteraction/orders.py",
|
|
6
|
+
"LICENSE",
|
|
10
7
|
"src/oneCInteraction/discounts.py",
|
|
11
|
-
"src/oneCInteraction/structures.py",
|
|
12
|
-
"src/oneCInteraction/log.py",
|
|
13
|
-
"src/oneCInteraction/customers.py",
|
|
14
|
-
"src/oneCInteraction/connection.py",
|
|
15
8
|
"src/oneCInteraction/categories.py",
|
|
16
9
|
"src/oneCInteraction/nomenclature.py",
|
|
10
|
+
"src/oneCInteraction/log.py",
|
|
11
|
+
"src/oneCInteraction/connection.py",
|
|
12
|
+
"src/oneCInteraction/structures.py",
|
|
13
|
+
"src/oneCInteraction/orders.py",
|
|
14
|
+
"src/oneCInteraction/groups.py",
|
|
17
15
|
"src/oneCInteraction/characteristics.py",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
16
|
+
"src/oneCInteraction/customers.py",
|
|
17
|
+
"src/oneCInteraction/__init__.py",
|
|
18
|
+
".github/workflows/publish.yml",
|
|
19
|
+
"tests/test_lib.py"
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -10,11 +10,17 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
from datetime import datetime
|
|
13
|
-
from oneCInteraction import Connection, Customer, Order, OrderItem, Nomenclature, Variety, Price, Characteristic, Group, Category, DiscountGroup
|
|
13
|
+
from oneCInteraction import Connection, Customer, Order, OrderItem, Nomenclature, Variety, Price, Characteristic, Property, Group, Category, DiscountGroup
|
|
14
14
|
from oneCInteraction.log import log_sys, LOGS_DIR
|
|
15
15
|
|
|
16
16
|
print("Success: Imported Connection and all structures successfully from oneCInteraction!")
|
|
17
17
|
|
|
18
|
+
# Test Property structure
|
|
19
|
+
c_prop = Property("Колір", "Зелений")
|
|
20
|
+
assert c_prop.s_name == "Колір"
|
|
21
|
+
assert c_prop.s_value == "Зелений"
|
|
22
|
+
print("Success: Property instantiated.")
|
|
23
|
+
|
|
18
24
|
# Test instantiation of structures
|
|
19
25
|
c_cust = Customer(s_customerIdIn="123456789", s_customerNameIn="Ivan", s_customerSurnameIn="Ivanov", s_customerPhoneIn="+380991112233")
|
|
20
26
|
print("Success: Customer instantiated.")
|
|
@@ -80,8 +86,10 @@ try:
|
|
|
80
86
|
|
|
81
87
|
c_var = c_var_no_char
|
|
82
88
|
|
|
83
|
-
c_nom = Nomenclature(s_nameIn="Product 1", s_articleIn="ART001", l_varietyIn=[c_var])
|
|
89
|
+
c_nom = Nomenclature(s_nameIn="Product 1", s_articleIn="ART001", l_varietyIn=[c_var], l_propertiesIn=[c_prop])
|
|
84
90
|
assert c_nom.dt_last_arrival is None
|
|
91
|
+
assert len(c_nom.l_properties) == 1
|
|
92
|
+
assert c_nom.l_properties[0].s_name == "Колір"
|
|
85
93
|
|
|
86
94
|
dt_now = datetime.now()
|
|
87
95
|
c_nom_with_arrival = Nomenclature(
|
|
@@ -121,7 +129,16 @@ try:
|
|
|
121
129
|
assert c_conn.categories is not None
|
|
122
130
|
assert c_conn.customers is not None
|
|
123
131
|
assert c_conn.discounts is not None
|
|
124
|
-
|
|
132
|
+
assert c_conn.properties is not None
|
|
133
|
+
print("Success: Checked all composition managers exist (including properties).")
|
|
134
|
+
|
|
135
|
+
# Test PropertiesManager when connection is not active
|
|
136
|
+
assert c_conn.properties.get_assigned_properties("ART001") == []
|
|
137
|
+
assert c_conn.properties.write("ART001", "Колір", "Зелений") is False
|
|
138
|
+
assert c_conn.properties.write_batch("ART001", [{"name": "Колір", "value": "Зелений"}]) == []
|
|
139
|
+
assert c_conn.properties.delete("ART001", "Колір") is False
|
|
140
|
+
assert c_conn.properties.get_all_definitions() == []
|
|
141
|
+
print("Success: PropertiesManager tested with no active connection.")
|
|
125
142
|
|
|
126
143
|
# Test DiscountsManager when connection is not active
|
|
127
144
|
discounts_res = c_conn.discounts.get_active_groups()
|
|
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.4 → onecinteraction-1.2.5}/src/oneCInteraction.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|