mangono-addon-export_json 18.0.1.0.4__py3-none-any.whl → 19.0.1.0.1__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.
Files changed (43) hide show
  1. {mangono_addon_export_json-18.0.1.0.4.dist-info → mangono_addon_export_json-19.0.1.0.1.dist-info}/METADATA +2 -3
  2. mangono_addon_export_json-19.0.1.0.1.dist-info/RECORD +52 -0
  3. odoo/addons/export_json/README.rst +2 -2
  4. odoo/addons/export_json/__init__.py +4 -0
  5. odoo/addons/export_json/__manifest__.py +10 -3
  6. odoo/addons/export_json/controller/main.py +1 -1
  7. odoo/addons/export_json/demo/export_demo.xml +7 -0
  8. odoo/addons/export_json/demo/ir.exports.line.csv +16 -0
  9. odoo/addons/export_json/demo/resolver_demo.xml +12 -0
  10. odoo/addons/export_json/jsonifier/README.rst +284 -0
  11. odoo/addons/export_json/jsonifier/__init__.py +1 -0
  12. odoo/addons/export_json/jsonifier/__manifest__.old +27 -0
  13. odoo/addons/export_json/jsonifier/demo/export_demo.xml +7 -0
  14. odoo/addons/export_json/jsonifier/demo/ir.exports.line.csv +16 -0
  15. odoo/addons/export_json/jsonifier/demo/resolver_demo.xml +12 -0
  16. odoo/addons/export_json/jsonifier/exceptions.py +7 -0
  17. odoo/addons/export_json/jsonifier/i18n/ca.po +234 -0
  18. odoo/addons/export_json/jsonifier/i18n/es.po +266 -0
  19. odoo/addons/export_json/jsonifier/i18n/it.po +277 -0
  20. odoo/addons/export_json/jsonifier/i18n/zh_CN.po +260 -0
  21. odoo/addons/export_json/jsonifier/models/__init__.py +5 -0
  22. odoo/addons/export_json/jsonifier/models/ir_exports.py +124 -0
  23. odoo/addons/export_json/jsonifier/models/ir_exports_line.py +55 -0
  24. odoo/addons/export_json/jsonifier/models/ir_exports_resolver.py +58 -0
  25. odoo/addons/export_json/jsonifier/models/models.py +263 -0
  26. odoo/addons/export_json/jsonifier/models/utils.py +35 -0
  27. odoo/addons/export_json/jsonifier/pyproject.toml +3 -0
  28. odoo/addons/export_json/jsonifier/readme/CONTRIBUTORS.md +8 -0
  29. odoo/addons/export_json/jsonifier/readme/CREDITS.md +1 -0
  30. odoo/addons/export_json/jsonifier/readme/DESCRIPTION.md +163 -0
  31. odoo/addons/export_json/jsonifier/readme/USAGE.md +26 -0
  32. odoo/addons/export_json/jsonifier/security/ir.model.access.csv +2 -0
  33. odoo/addons/export_json/jsonifier/tests/__init__.py +3 -0
  34. odoo/addons/export_json/jsonifier/tests/test_get_parser.py +436 -0
  35. odoo/addons/export_json/jsonifier/tests/test_helpers.py +45 -0
  36. odoo/addons/export_json/jsonifier/tests/test_ir_exports_line.py +66 -0
  37. odoo/addons/export_json/jsonifier/views/ir_exports_resolver_view.xml +26 -0
  38. odoo/addons/export_json/jsonifier/views/ir_exports_view.xml +38 -0
  39. odoo/addons/export_json/models/file_json.py +1 -2
  40. odoo/addons/export_json/tests/test_export_json.py +14 -11
  41. mangono_addon_export_json-18.0.1.0.4.dist-info/RECORD +0 -20
  42. {mangono_addon_export_json-18.0.1.0.4.dist-info → mangono_addon_export_json-19.0.1.0.1.dist-info}/WHEEL +0 -0
  43. {mangono_addon_export_json-18.0.1.0.4.dist-info → mangono_addon_export_json-19.0.1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,277 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * jsonifier
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 17.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "PO-Revision-Date: 2025-03-18 10:38+0000\n"
10
+ "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11
+ "Language-Team: none\n"
12
+ "Language: it\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: \n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Weblate 5.10.2\n"
18
+
19
+ #. module: jsonifier
20
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__instance_method_name
21
+ msgid "A method defined on the model that takes a record and a field_name"
22
+ msgstr "Un metdo definito nel modello che usa un record e un field_name"
23
+
24
+ #. module: jsonifier
25
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__active
26
+ msgid "Active"
27
+ msgstr "Attiva"
28
+
29
+ #. module: jsonifier
30
+ #: model:ir.model,name:jsonifier.model_base
31
+ msgid "Base"
32
+ msgstr "Base"
33
+
34
+ #. module: jsonifier
35
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_resolver__python_code
36
+ msgid ""
37
+ "Compute the result from 'value' by setting the variable 'result'.\n"
38
+ "\n"
39
+ "For fields resolvers:\n"
40
+ ":param record: the record\n"
41
+ ":param name: name of the field\n"
42
+ ":param value: value of the field\n"
43
+ ":param field_type: type of the field\n"
44
+ "\n"
45
+ "For global resolvers:\n"
46
+ ":param value: JSON dict\n"
47
+ ":param record: the record\n"
48
+ "\n"
49
+ "In both types, you can override the final json key.\n"
50
+ "To achieve this, simply return a dict like: \n"
51
+ "{'result': {'_value': $value, '_json_key': $new_json_key}}"
52
+ msgstr ""
53
+ "Calcola il risultato dal 'value' impostando la variabile 'result'.\n"
54
+ "\n"
55
+ "Per risolutori campi:\n"
56
+ ":param record: il record\n"
57
+ ":param name: nome del campo\n"
58
+ ":param value: valore del campo\n"
59
+ ":param field_type: tipo del campo\n"
60
+ "\n"
61
+ "Per risolutori globali:\n"
62
+ ":param value: dizionario JSON \n"
63
+ ":param record: il record\n"
64
+ "\n"
65
+ "In entrambi i tipi, si può forzare la chiave JSON finale.\n"
66
+ "Per farlo, restituire un dizionario come: \n"
67
+ "{'result': {'_value': $value, '_json_key': $new_json_key}}"
68
+
69
+ #. module: jsonifier
70
+ #: model_terms:ir.ui.view,arch_db:jsonifier.view_ir_exports
71
+ msgid "Configuration"
72
+ msgstr "Configurazione"
73
+
74
+ #. module: jsonifier
75
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__create_uid
76
+ msgid "Created by"
77
+ msgstr "Creato da"
78
+
79
+ #. module: jsonifier
80
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__create_date
81
+ msgid "Created on"
82
+ msgstr "Creato il"
83
+
84
+ #. module: jsonifier
85
+ #: model:ir.actions.act_window,name:jsonifier.act_ui_exports_resolver_view
86
+ #: model:ir.ui.menu,name:jsonifier.ui_exports_resolvers
87
+ msgid "Custom Export Resolvers"
88
+ msgstr "Identificatori esportazione personalizzati"
89
+
90
+ #. module: jsonifier
91
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__global_resolver_id
92
+ msgid "Custom global resolver"
93
+ msgstr "identificatore globale personalizzato"
94
+
95
+ #. module: jsonifier
96
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__resolver_id
97
+ msgid "Custom resolver"
98
+ msgstr "Identificatore personalizzato"
99
+
100
+ #. module: jsonifier
101
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__display_name
102
+ msgid "Display Name"
103
+ msgstr "Nome visualizzato"
104
+
105
+ #. module: jsonifier
106
+ #. odoo-python
107
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
108
+ msgid "Either set a function or a resolver, not both."
109
+ msgstr "Impostare una funzione o un identificatore, non entrambi."
110
+
111
+ #. module: jsonifier
112
+ #: model:ir.actions.act_window,name:jsonifier.act_ui_exports_view
113
+ #: model:ir.ui.menu,name:jsonifier.ui_exports
114
+ msgid "Export Fields"
115
+ msgstr "Esporta campi"
116
+
117
+ #. module: jsonifier
118
+ #: model:ir.model,name:jsonifier.model_ir_exports_resolver
119
+ msgid "Export Resolver"
120
+ msgstr "Identificatore esportazione"
121
+
122
+ #. module: jsonifier
123
+ #: model:ir.model,name:jsonifier.model_ir_exports
124
+ msgid "Exports"
125
+ msgstr "Esportazioni"
126
+
127
+ #. module: jsonifier
128
+ #: model:ir.model,name:jsonifier.model_ir_exports_line
129
+ msgid "Exports Line"
130
+ msgstr "Riga esportazioni"
131
+
132
+ #. module: jsonifier
133
+ #: model:ir.model.fields.selection,name:jsonifier.selection__ir_exports_resolver__type__field
134
+ msgid "Field"
135
+ msgstr "Campo"
136
+
137
+ #. module: jsonifier
138
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__instance_method_name
139
+ msgid "Function"
140
+ msgstr "Funzione"
141
+
142
+ #. module: jsonifier
143
+ #: model:ir.model.fields.selection,name:jsonifier.selection__ir_exports_resolver__type__global
144
+ msgid "Global"
145
+ msgstr "Globale"
146
+
147
+ #. module: jsonifier
148
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__id
149
+ msgid "ID"
150
+ msgstr "ID"
151
+
152
+ #. module: jsonifier
153
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__lang_id
154
+ msgid "If set, the language in which the field is exported"
155
+ msgstr "Se impostato, la lingua in cui è esportato il campo"
156
+
157
+ #. module: jsonifier
158
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports__global_resolver_id
159
+ msgid "If set, will apply the global resolver to the result"
160
+ msgstr "Se impostata, applicherà il riferimento globale al risultato"
161
+
162
+ #. module: jsonifier
163
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__resolver_id
164
+ msgid "If set, will apply the resolver on the field value"
165
+ msgstr "Se impostata, applicherà il riferimento al valore del campo"
166
+
167
+ #. module: jsonifier
168
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports__language_agnostic
169
+ msgid ""
170
+ "If set, will set the lang to False when exporting lines without lang, "
171
+ "otherwise it uses the lang in the given context to export these fields"
172
+ msgstr ""
173
+ "Se impostata, imposterà il linuaggio a False nell'esportazione di righe "
174
+ "senza linguaggio, altrimenti utilizzerà il linguaggio nel dato contesto per "
175
+ "esportare questi campi"
176
+
177
+ #. module: jsonifier
178
+ #: model_terms:ir.ui.view,arch_db:jsonifier.view_ir_exports
179
+ msgid "Index"
180
+ msgstr "Indice"
181
+
182
+ #. module: jsonifier
183
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__lang_id
184
+ msgid "Language"
185
+ msgstr "Lingua"
186
+
187
+ #. module: jsonifier
188
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__language_agnostic
189
+ msgid "Language Agnostic"
190
+ msgstr "Agnostico alla lingua"
191
+
192
+ #. module: jsonifier
193
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__write_uid
194
+ msgid "Last Updated by"
195
+ msgstr "Ultimo aggiornamento di"
196
+
197
+ #. module: jsonifier
198
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__write_date
199
+ msgid "Last Updated on"
200
+ msgstr "Ultimo aggiornamento il"
201
+
202
+ #. module: jsonifier
203
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__name
204
+ msgid "Name"
205
+ msgstr "Nome"
206
+
207
+ #. module: jsonifier
208
+ #. odoo-python
209
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
210
+ msgid "Name and Target must have the same hierarchy depth"
211
+ msgstr "Nome e obiettivo devno avere la stessa profondità gerarchica"
212
+
213
+ #. module: jsonifier
214
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__python_code
215
+ msgid "Python Code"
216
+ msgstr "Codice Python"
217
+
218
+ #. module: jsonifier
219
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__smart_search
220
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__smart_search
221
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__smart_search
222
+ msgid "Smart Search"
223
+ msgstr "Ricerca intelligente"
224
+
225
+ #. module: jsonifier
226
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__target
227
+ msgid "Target"
228
+ msgstr "Obiettivo"
229
+
230
+ #. module: jsonifier
231
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__target
232
+ msgid ""
233
+ "The complete path to the field where you can specify a target on the step as "
234
+ "field:target"
235
+ msgstr ""
236
+ "Il percorso completo al campo dove si può indicare un obiettivo sul "
237
+ "passaggio come field:target"
238
+
239
+ #. module: jsonifier
240
+ #. odoo-python
241
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
242
+ msgid ""
243
+ "The target must reference the same field as in name '%(name)s' not in "
244
+ "'%(name_with_target)s'"
245
+ msgstr ""
246
+ "L'obiettivo deve far riferimento allo stesso campo come nel nome '%(name)s' "
247
+ "non in '%(name_with_target)s'"
248
+
249
+ #. module: jsonifier
250
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__type
251
+ msgid "Type"
252
+ msgstr "Tipo"
253
+
254
+ #. module: jsonifier
255
+ #. odoo-python
256
+ #: code:addons/jsonifier/models/models.py:0
257
+ msgid "Wrong parser configuration for field: `%s`"
258
+ msgstr "Errata configurazione parser per il campo: `%s`"
259
+
260
+ #~ msgid ""
261
+ #~ "Compute the result from 'value' by setting the variable 'result'.\n"
262
+ #~ "For fields resolvers:\n"
263
+ #~ ":param name: name of the field\n"
264
+ #~ ":param value: value of the field\n"
265
+ #~ ":param field_type: type of the field\n"
266
+ #~ "For global resolvers:\n"
267
+ #~ ":param value: JSON dict\n"
268
+ #~ ":param record: the record"
269
+ #~ msgstr ""
270
+ #~ "Calcola il risultato da 'value'impostando la variabile 'result'.\n"
271
+ #~ "Identificatri campi:\n"
272
+ #~ ":param name: nome del campo\n"
273
+ #~ ":param value: valore del cmapo\n"
274
+ #~ ":param field_type: tipo del campo\n"
275
+ #~ "Identificatori globali:\n"
276
+ #~ ":param value: dizionario JSON\n"
277
+ #~ ":param record: il record"
@@ -0,0 +1,260 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * jsonifier
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 12.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "PO-Revision-Date: 2024-06-16 11:07+0000\n"
10
+ "Last-Translator: xtanuiha <feihu.zhang@live.com>\n"
11
+ "Language-Team: none\n"
12
+ "Language: zh_CN\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: \n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "X-Generator: Weblate 4.17\n"
18
+
19
+ #. module: jsonifier
20
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__instance_method_name
21
+ msgid "A method defined on the model that takes a record and a field_name"
22
+ msgstr "在模型上定义的一个方法,该方法接受一条记录和一个字段名作为参数"
23
+
24
+ #. module: jsonifier
25
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__active
26
+ msgid "Active"
27
+ msgstr "激活"
28
+
29
+ #. module: jsonifier
30
+ #: model:ir.model,name:jsonifier.model_base
31
+ msgid "Base"
32
+ msgstr "基础"
33
+
34
+ #. module: jsonifier
35
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_resolver__python_code
36
+ msgid ""
37
+ "Compute the result from 'value' by setting the variable 'result'.\n"
38
+ "\n"
39
+ "For fields resolvers:\n"
40
+ ":param record: the record\n"
41
+ ":param name: name of the field\n"
42
+ ":param value: value of the field\n"
43
+ ":param field_type: type of the field\n"
44
+ "\n"
45
+ "For global resolvers:\n"
46
+ ":param value: JSON dict\n"
47
+ ":param record: the record\n"
48
+ "\n"
49
+ "In both types, you can override the final json key.\n"
50
+ "To achieve this, simply return a dict like: \n"
51
+ "{'result': {'_value': $value, '_json_key': $new_json_key}}"
52
+ msgstr ""
53
+
54
+ #. module: jsonifier
55
+ #: model_terms:ir.ui.view,arch_db:jsonifier.view_ir_exports
56
+ msgid "Configuration"
57
+ msgstr "配置"
58
+
59
+ #. module: jsonifier
60
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__create_uid
61
+ msgid "Created by"
62
+ msgstr "创建者"
63
+
64
+ #. module: jsonifier
65
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__create_date
66
+ msgid "Created on"
67
+ msgstr "创建于"
68
+
69
+ #. module: jsonifier
70
+ #: model:ir.actions.act_window,name:jsonifier.act_ui_exports_resolver_view
71
+ #: model:ir.ui.menu,name:jsonifier.ui_exports_resolvers
72
+ msgid "Custom Export Resolvers"
73
+ msgstr "自定义导出解析器"
74
+
75
+ #. module: jsonifier
76
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__global_resolver_id
77
+ msgid "Custom global resolver"
78
+ msgstr "自定义全局解析器"
79
+
80
+ #. module: jsonifier
81
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__resolver_id
82
+ msgid "Custom resolver"
83
+ msgstr "自定义解析器"
84
+
85
+ #. module: jsonifier
86
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__display_name
87
+ msgid "Display Name"
88
+ msgstr "显示名称"
89
+
90
+ #. module: jsonifier
91
+ #. odoo-python
92
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
93
+ msgid "Either set a function or a resolver, not both."
94
+ msgstr "只能设置函数或解析器中的一个,不能同时设置。"
95
+
96
+ #. module: jsonifier
97
+ #: model:ir.actions.act_window,name:jsonifier.act_ui_exports_view
98
+ #: model:ir.ui.menu,name:jsonifier.ui_exports
99
+ msgid "Export Fields"
100
+ msgstr "导出字段"
101
+
102
+ #. module: jsonifier
103
+ #: model:ir.model,name:jsonifier.model_ir_exports_resolver
104
+ msgid "Export Resolver"
105
+ msgstr "导出解析器"
106
+
107
+ #. module: jsonifier
108
+ #: model:ir.model,name:jsonifier.model_ir_exports
109
+ msgid "Exports"
110
+ msgstr "导出"
111
+
112
+ #. module: jsonifier
113
+ #: model:ir.model,name:jsonifier.model_ir_exports_line
114
+ msgid "Exports Line"
115
+ msgstr "导出行"
116
+
117
+ #. module: jsonifier
118
+ #: model:ir.model.fields.selection,name:jsonifier.selection__ir_exports_resolver__type__field
119
+ msgid "Field"
120
+ msgstr "字段"
121
+
122
+ #. module: jsonifier
123
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__instance_method_name
124
+ msgid "Function"
125
+ msgstr "函数"
126
+
127
+ #. module: jsonifier
128
+ #: model:ir.model.fields.selection,name:jsonifier.selection__ir_exports_resolver__type__global
129
+ msgid "Global"
130
+ msgstr "全局"
131
+
132
+ #. module: jsonifier
133
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__id
134
+ msgid "ID"
135
+ msgstr "ID"
136
+
137
+ #. module: jsonifier
138
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__lang_id
139
+ msgid "If set, the language in which the field is exported"
140
+ msgstr "如果设置,表示字段将以哪种语言导出"
141
+
142
+ #. module: jsonifier
143
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports__global_resolver_id
144
+ msgid "If set, will apply the global resolver to the result"
145
+ msgstr "如果设置,将对结果应用全局解析器"
146
+
147
+ #. module: jsonifier
148
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__resolver_id
149
+ msgid "If set, will apply the resolver on the field value"
150
+ msgstr "如果设置,将对字段值应用特定解析器"
151
+
152
+ #. module: jsonifier
153
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports__language_agnostic
154
+ msgid ""
155
+ "If set, will set the lang to False when exporting lines without lang, "
156
+ "otherwise it uses the lang in the given context to export these fields"
157
+ msgstr ""
158
+ "如果设置,在导出不包含语言信息的行时,会将语言(lang)设置为False;否则,它会使"
159
+ "用给定上下文中的语言来导出这些字段"
160
+
161
+ #. module: jsonifier
162
+ #: model_terms:ir.ui.view,arch_db:jsonifier.view_ir_exports
163
+ msgid "Index"
164
+ msgstr "索引"
165
+
166
+ #. module: jsonifier
167
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__lang_id
168
+ msgid "Language"
169
+ msgstr "语言"
170
+
171
+ #. module: jsonifier
172
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__language_agnostic
173
+ msgid "Language Agnostic"
174
+ msgstr "语言无关"
175
+
176
+ #. module: jsonifier
177
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__write_uid
178
+ msgid "Last Updated by"
179
+ msgstr "最后更新者"
180
+
181
+ #. module: jsonifier
182
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__write_date
183
+ msgid "Last Updated on"
184
+ msgstr "最后更新于"
185
+
186
+ #. module: jsonifier
187
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__name
188
+ msgid "Name"
189
+ msgstr "名称"
190
+
191
+ #. module: jsonifier
192
+ #. odoo-python
193
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
194
+ msgid "Name and Target must have the same hierarchy depth"
195
+ msgstr "名称和别名必须具有相同的层次结构深度"
196
+
197
+ #. module: jsonifier
198
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__python_code
199
+ msgid "Python Code"
200
+ msgstr "Python代码"
201
+
202
+ #. module: jsonifier
203
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports__smart_search
204
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__smart_search
205
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__smart_search
206
+ msgid "Smart Search"
207
+ msgstr ""
208
+
209
+ #. module: jsonifier
210
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_line__target
211
+ msgid "Target"
212
+ msgstr "别名"
213
+
214
+ #. module: jsonifier
215
+ #: model:ir.model.fields,help:jsonifier.field_ir_exports_line__target
216
+ msgid ""
217
+ "The complete path to the field where you can specify a target on the step as "
218
+ "field:target"
219
+ msgstr "字段的完整路径,您可以在其中指定步骤作为字段的别名:别名"
220
+
221
+ #. module: jsonifier
222
+ #. odoo-python
223
+ #: code:addons/jsonifier/models/ir_exports_line.py:0
224
+ msgid ""
225
+ "The target must reference the same field as in name '%(name)s' not in "
226
+ "'%(name_with_target)s'"
227
+ msgstr "目标必须引用与名称 '%(name)s' 相同的字段,而非 '%(name_with_target)s'"
228
+
229
+ #. module: jsonifier
230
+ #: model:ir.model.fields,field_description:jsonifier.field_ir_exports_resolver__type
231
+ msgid "Type"
232
+ msgstr "类型"
233
+
234
+ #. module: jsonifier
235
+ #. odoo-python
236
+ #: code:addons/jsonifier/models/models.py:0
237
+ msgid "Wrong parser configuration for field: `%s`"
238
+ msgstr "字段`%s`的解析器配置有误"
239
+
240
+ #~ msgid ""
241
+ #~ "Compute the result from 'value' by setting the variable 'result'.\n"
242
+ #~ "For fields resolvers:\n"
243
+ #~ ":param name: name of the field\n"
244
+ #~ ":param value: value of the field\n"
245
+ #~ ":param field_type: type of the field\n"
246
+ #~ "For global resolvers:\n"
247
+ #~ ":param value: JSON dict\n"
248
+ #~ ":param record: the record"
249
+ #~ msgstr ""
250
+ #~ "通过设置变量 'result' 来计算来自 'value' 的结果。\n"
251
+ #~ "对于字段解析器:\n"
252
+ #~ ":param name: 字段名\n"
253
+ #~ ":param value: 字段值\n"
254
+ #~ ":param field_type: 对于全局解析器的字段类型\n"
255
+ #~ ":param value: JSON 字典\n"
256
+ #~ ":param record: 记录对象"
257
+
258
+ #, python-format
259
+ #~ msgid "The target must reference the same field as in name '%s' not in '%s'"
260
+ #~ msgstr "别名必须引用与名称相同的字段'%s'不在'%s'"
@@ -0,0 +1,5 @@
1
+ from . import utils
2
+ from . import models
3
+ from . import ir_exports
4
+ from . import ir_exports_line
5
+ from . import ir_exports_resolver
@@ -0,0 +1,124 @@
1
+ # © 2017 Akretion (http://www.akretion.com)
2
+ # Sébastien BEAU <sebastien.beau@akretion.com>
3
+ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
4
+
5
+ from collections import OrderedDict
6
+
7
+ from odoo import fields, models
8
+ from odoo.tools import ormcache
9
+
10
+
11
+ def partition(line, accessor):
12
+ """Partition a recordset according to an accessor (e.g. a lambda).
13
+ Returns a dictionary whose keys are the values obtained from accessor,
14
+ and values are the items that have this value.
15
+ Example: partition([{"name": "ax"}, {"name": "by"}], lambda x: "x" in x["name"])
16
+ => {True: [{"name": "ax"}], False: [{"name": "by"}]}
17
+ """
18
+ result = {}
19
+ for item in line:
20
+ key = accessor(item)
21
+ if key not in result:
22
+ result[key] = []
23
+ result[key].append(item)
24
+ return result
25
+
26
+
27
+ def update_dict(data, fields, options):
28
+ """Contruct a tree of fields.
29
+
30
+ Example:
31
+
32
+ {
33
+ "name": True,
34
+ "resource": True,
35
+ }
36
+
37
+ Order of keys is important.
38
+ """
39
+ field = fields[0]
40
+ if len(fields) == 1:
41
+ if field == ".id":
42
+ field = "id"
43
+ data[field] = (True, options)
44
+ else:
45
+ if field not in data:
46
+ data[field] = (False, OrderedDict())
47
+ update_dict(data[field][1], fields[1:], options)
48
+
49
+
50
+ def convert_dict(dict_parser):
51
+ """Convert dict returned by update_dict to list consistent w/ Odoo API.
52
+
53
+ The list is composed of strings (field names or targets) or tuples.
54
+ """
55
+ parser = []
56
+ for field, value in dict_parser.items():
57
+ if value[0] is True: # is a leaf
58
+ parser.append(field_dict(field, value[1]))
59
+ else:
60
+ parser.append((field_dict(field), convert_dict(value[1])))
61
+ return parser
62
+
63
+
64
+ def field_dict(field, options=None):
65
+ """Create a parser dict for the field field."""
66
+ result = {"name": field.split(":")[0]}
67
+ if len(field.split(":")) > 1:
68
+ result["target"] = field.split(":")[1]
69
+ for option in options or {}:
70
+ if options[option]:
71
+ result[option] = options[option]
72
+ return result
73
+
74
+
75
+ class IrExports(models.Model):
76
+ _inherit = "ir.exports"
77
+
78
+ language_agnostic = fields.Boolean(
79
+ default=False,
80
+ help="If set, will set the lang to False when exporting lines without lang,"
81
+ " otherwise it uses the lang in the given context to export these fields",
82
+ )
83
+
84
+ global_resolver_id = fields.Many2one(
85
+ comodel_name="ir.exports.resolver",
86
+ string="Custom global resolver",
87
+ domain="[('type', '=', 'global')]",
88
+ help="If set, will apply the global resolver to the result",
89
+ )
90
+
91
+ @ormcache(
92
+ "self.language_agnostic",
93
+ "self.global_resolver_id.id",
94
+ "tuple(self.export_fields.mapped('write_date'))",
95
+ )
96
+ def get_json_parser(self):
97
+ """Creates a parser from ir.exports record and return it.
98
+
99
+ The final parser can be used to "jsonify" records of ir.export's model.
100
+ """
101
+ self.ensure_one()
102
+ parser = {}
103
+ lang_to_lines = partition(self.export_fields, lambda _l: _l.lang_id.code)
104
+ lang_parsers = {}
105
+ for lang in lang_to_lines:
106
+ dict_parser = OrderedDict()
107
+ for line in lang_to_lines[lang]:
108
+ names = line.name.split("/")
109
+ if line.target:
110
+ names = line.target.split("/")
111
+ function = line.instance_method_name
112
+ # resolver must be passed as ID to avoid cache issues
113
+ options = {"resolver": line.resolver_id.id, "function": function}
114
+ update_dict(dict_parser, names, options)
115
+ lang_parsers[lang] = convert_dict(dict_parser)
116
+ if list(lang_parsers.keys()) == [False]:
117
+ parser["fields"] = lang_parsers[False]
118
+ else:
119
+ parser["langs"] = lang_parsers
120
+ if self.global_resolver_id:
121
+ parser["resolver"] = self.global_resolver_id.id
122
+ if self.language_agnostic:
123
+ parser["language_agnostic"] = self.language_agnostic
124
+ return parser