proteus 7.8.0__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.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: proteus
3
+ Version: 7.8.0
4
+ Summary: Library to access Tryton server as a client
5
+ Home-page: http://www.tryton.org/
6
+ Download-URL: http://downloads.tryton.org/7.8/
7
+ Author: Tryton
8
+ Author-email: foundation@tryton.org
9
+ License: LGPL-3
10
+ Project-URL: Bug Tracker, https://bugs.tryton.org/
11
+ Project-URL: Documentation, https://docs.tryton.org/latest/client-library/
12
+ Project-URL: Forum, https://www.tryton.org/forum
13
+ Project-URL: Source Code, https://code.tryton.org/tryton
14
+ Keywords: tryton library cli
15
+ Platform: any
16
+ Classifier: Development Status :: 5 - Production/Stable
17
+ Classifier: Environment :: Plugins
18
+ Classifier: Framework :: Tryton
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Intended Audience :: Financial and Insurance Industry
21
+ Classifier: Intended Audience :: Legal Industry
22
+ Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
23
+ Classifier: Operating System :: OS Independent
24
+ Classifier: Programming Language :: Python :: 3
25
+ Classifier: Programming Language :: Python :: 3.9
26
+ Classifier: Programming Language :: Python :: 3.10
27
+ Classifier: Programming Language :: Python :: 3.11
28
+ Classifier: Programming Language :: Python :: 3.12
29
+ Classifier: Programming Language :: Python :: 3.13
30
+ Classifier: Programming Language :: Python :: Implementation :: CPython
31
+ Classifier: Topic :: Office/Business
32
+ Requires-Python: >=3.9
33
+ License-File: LICENSE
34
+ Requires-Dist: defusedxml
35
+ Requires-Dist: python-dateutil
36
+ Provides-Extra: trytond
37
+ Requires-Dist: trytond<7.9,>=7.8; extra == "trytond"
38
+ Provides-Extra: test
39
+ Requires-Dist: trytond<7.9,>=7.8; extra == "test"
40
+ Requires-Dist: trytond_party<7.9,>=7.8; extra == "test"
41
+ Dynamic: author
42
+ Dynamic: author-email
43
+ Dynamic: classifier
44
+ Dynamic: description
45
+ Dynamic: download-url
46
+ Dynamic: home-page
47
+ Dynamic: keywords
48
+ Dynamic: license
49
+ Dynamic: license-file
50
+ Dynamic: platform
51
+ Dynamic: project-url
52
+ Dynamic: provides-extra
53
+ Dynamic: requires-dist
54
+ Dynamic: requires-python
55
+ Dynamic: summary
56
+
57
+ =======================
58
+ Tryton Scripting Client
59
+ =======================
60
+
61
+ A library to access Tryton's models like a client.
62
+
63
+ Example of usage
64
+ ----------------
65
+
66
+ >>> from proteus import config, Model, Wizard, Report
67
+
68
+ Configuration
69
+ ~~~~~~~~~~~~~
70
+
71
+ Configuration to connect to a sqlite memory database using trytond as module.
72
+
73
+ >>> config = config.set_trytond('sqlite:///:memory:')
74
+
75
+ There is also the ``config.set_xmlrpc`` method which can be used to connect
76
+ using a URL, and the ``config.set_xmlrpc_session`` method (when used as a
77
+ context manager) which connects for a session.
78
+
79
+ Activating a module
80
+ ~~~~~~~~~~~~~~~~~~~
81
+
82
+ Find the module, call the activate button and run the upgrade wizard.
83
+
84
+ >>> Module = Model.get('ir.module')
85
+ >>> party_module, = Module.find([('name', '=', 'party')])
86
+ >>> party_module.click('activate')
87
+ >>> Wizard('ir.module.activate_upgrade').execute('upgrade')
88
+
89
+ Creating a party
90
+ ~~~~~~~~~~~~~~~~
91
+
92
+ First instantiate a new Party:
93
+
94
+ >>> Party = Model.get('party.party')
95
+ >>> party = Party()
96
+ >>> party.id < 0
97
+ True
98
+
99
+ Fill the fields:
100
+
101
+ >>> party.name = 'ham'
102
+
103
+ Save the instance into the server:
104
+
105
+ >>> party.save()
106
+ >>> party.name
107
+ 'ham'
108
+ >>> party.id > 0
109
+ True
110
+
111
+ Setting the language of the party
112
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
+
114
+ The language on party is a ``Many2One`` relation field. So it requires to get a
115
+ ``Model`` instance as value.
116
+
117
+ >>> Lang = Model.get('ir.lang')
118
+ >>> en, = Lang.find([('code', '=', 'en')])
119
+ >>> party.lang = en
120
+ >>> party.save()
121
+ >>> party.lang.code
122
+ 'en'
123
+
124
+ Creating an address for the party
125
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126
+
127
+ Addresses are store on party with a ``One2Many`` field.
128
+ So the new address just needs to be appended to the list ``addresses``.
129
+
130
+ >>> address = party.addresses.new(postal_code='42')
131
+ >>> party.save()
132
+ >>> party.addresses #doctest: +ELLIPSIS
133
+ [proteus.Model.get('party.address')(...)]
134
+
135
+ Adding category to the party
136
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137
+
138
+ Categories are linked to party with a ``Many2Many`` field.
139
+
140
+ So first create a category
141
+
142
+ >>> Category = Model.get('party.category')
143
+ >>> category = Category()
144
+ >>> category.name = 'spam'
145
+ >>> category.save()
146
+
147
+ Append it to categories of the party
148
+
149
+ >>> party.categories.append(category)
150
+ >>> party.save()
151
+ >>> party.categories #doctest: +ELLIPSIS
152
+ [proteus.Model.get('party.category')(...)]
153
+
154
+ Print party label
155
+ ~~~~~~~~~~~~~~~~~
156
+
157
+ There is a label report on ``Party``.
158
+
159
+ >>> label = Report('party.label')
160
+
161
+ The report is executed with a list of records and some extra data.
162
+
163
+ >>> type_, data, print_, name = label.execute([party], {})
164
+
165
+ Sorting addresses and register order
166
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
+
168
+ Addresses are ordered by sequence which means they can be stored following a
169
+ specific order.
170
+ The ``set_sequence`` method stores the current order.
171
+
172
+ >>> address = party.addresses.new(postal_code='69')
173
+ >>> party.save()
174
+ >>> address = party.addresses.new(postal_code='23')
175
+ >>> party.save()
176
+
177
+ Now changing the order.
178
+
179
+ >>> reversed_addresses = list(reversed(party.addresses))
180
+ >>> while party.addresses:
181
+ ... _ = party.addresses.pop()
182
+ >>> party.addresses.extend(reversed_addresses)
183
+ >>> party.addresses.set_sequence()
184
+ >>> party.save()
185
+ >>> party.addresses == reversed_addresses
186
+ True
187
+
188
+ Setting context
189
+ ~~~~~~~~~~~~~~~
190
+
191
+ Make French translatable:
192
+
193
+ >>> Language = Model.get('ir.lang')
194
+ >>> french, = Language.find([('code', '=', 'fr')])
195
+ >>> french.translatable = True
196
+ >>> french.save()
197
+
198
+ Create a category in English:
199
+
200
+ >>> Category = Model.get('party.category')
201
+ >>> with config.set_context(language='en'):
202
+ ... category = Category(name="Category")
203
+ ... category.save()
204
+
205
+ Translate in French:
206
+
207
+ >>> with config.set_context(language='fr'):
208
+ ... category_fr = Category(category.id)
209
+ ... category_fr.name = "Categorie"
210
+ ... category_fr.save()
211
+
212
+ Read in English:
213
+
214
+ >>> category.reload()
215
+ >>> category.name
216
+ 'Category'
217
+
218
+ Read in French:
219
+
220
+ >>> category_fr.reload()
221
+ >>> category_fr.name
222
+ 'Categorie'
223
+
@@ -0,0 +1,18 @@
1
+ proteus/__init__.py,sha256=QEbwU3J6w7NlPTkkNwtMMTxbjDZEc-Uz2Iqm5R71lwU,50003
2
+ proteus/config.py,sha256=eLzSnnsbXPLuNJhxOgiEkVlJuU2UmRhZnTX9UEaysAg,13407
3
+ proteus/pyson.py,sha256=cfzzT0NIg2_X04_3WqhpJZVwPg9px6vylNA-_SaNxQM,21935
4
+ proteus/tests/__init__.py,sha256=ntQJf_2grlorGbYPXySORFaXIlMhvSGhJ9rB2rrhE7g,366
5
+ proteus/tests/common.py,sha256=rrNCNEyXHLP1Qevs7dkHRkro931hQkMFmk012K-jzIo,454
6
+ proteus/tests/test_action.py,sha256=5CwLsXUKymvK6xpEwGevy-CQa_Jqo1JpXNKm9hjHhEI,1588
7
+ proteus/tests/test_config.py,sha256=0c97M4kSP6YEcDunFn-4BAqRTTk077-Ee0dHSbTY4Rg,1484
8
+ proteus/tests/test_context.py,sha256=cDN-v7PgkYegYFNEJ9XfIc4T0eVFjOX-rgDWNV1SAlI,564
9
+ proteus/tests/test_model.py,sha256=PpNiq61WVAyAnMG4ZmnpTJaLlehyNaR7utxtyghuz20,12850
10
+ proteus/tests/test_readme.py,sha256=Uhm7QhQiia00qWGhQUqri7_-SYAyNSQfNv74sNb6ReQ,817
11
+ proteus/tests/test_report.py,sha256=OaDSNQIAyiDM_26glyZPSq2t7xzMDUto6h0EVXmAoZ0,793
12
+ proteus/tests/test_wizard.py,sha256=vxEhnE578KBxu5ls-rcMA_m8lRUZF8A-vItxWiGsa_I,2150
13
+ proteus-7.8.0.dist-info/licenses/LICENSE,sha256=LVyRoc66HRMBoJdRqIQRlJtpzzrgb4eBWrlJwhcC9fc,42788
14
+ proteus-7.8.0.dist-info/METADATA,sha256=OXlqIxuwELwAP_ujodNiE1sjONPcBWLy9Tl0QKyFxVY,6105
15
+ proteus-7.8.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ proteus-7.8.0.dist-info/top_level.txt,sha256=7LjMNpvlVFgsEJnTt9d28ZE5oRrsViu9ZyORIWB9QeQ,8
17
+ proteus-7.8.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
18
+ proteus-7.8.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+