Merge lp:~dorian-kemps/unifield-server/US-5887 into lp:unifield-server

Proposed by jftempo on 2019-06-12
Status: Needs review
Proposed branch: lp:~dorian-kemps/unifield-server/US-5887
Merge into: lp:unifield-server
Diff against target: 432 lines (+223/-50)
8 files modified
bin/addons/kit/__openerp__.py (+1/-0)
bin/addons/kit/report/__init__.py (+1/-0)
bin/addons/kit/report/kit_mass_impor_export.py (+53/-0)
bin/addons/kit/report/kit_mass_import_export_view.xml (+16/-0)
bin/addons/kit/report/kit_mass_import_export_xls.mako (+124/-0)
bin/addons/kit/wizard/kit_mass_import.py (+6/-28)
bin/addons/kit/wizard/kit_mass_import_view.xml (+1/-4)
bin/addons/msf_profile/i18n/fr_MF.po (+21/-18)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5887
Reviewer Review Type Date Requested Status
UniField Reviewer Team 2019-06-12 Pending
Review via email: mp+368716@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

5399. By Dorian on 2019-06-12

US-5887 [FIX] Theoretical Kit Mass Import: fixed and simplified template export

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/kit/__openerp__.py'
2--- bin/addons/kit/__openerp__.py 2017-09-28 14:05:02 +0000
3+++ bin/addons/kit/__openerp__.py 2019-06-12 15:17:56 +0000
4@@ -46,6 +46,7 @@
5 'security/ir.model.access.csv',
6 'wizard/split_move_view.xml',
7 'wizard/kit_mass_import_view.xml',
8+ 'report/kit_mass_import_export_view.xml'
9 ],
10 "demo_xml": [],
11 'test': [
12
13=== modified file 'bin/addons/kit/report/__init__.py'
14--- bin/addons/kit/report/__init__.py 2013-09-13 09:16:03 +0000
15+++ bin/addons/kit/report/__init__.py 2019-06-12 15:17:56 +0000
16@@ -20,3 +20,4 @@
17 ##############################################################################
18
19 import kit_report
20+import kit_mass_impor_export
21
22=== added file 'bin/addons/kit/report/kit_mass_impor_export.py'
23--- bin/addons/kit/report/kit_mass_impor_export.py 1970-01-01 00:00:00 +0000
24+++ bin/addons/kit/report/kit_mass_impor_export.py 2019-06-12 15:17:56 +0000
25@@ -0,0 +1,53 @@
26+# -*- coding: utf-8 -*-
27+##############################################################################
28+#
29+# OpenERP, Open Source Management Solution
30+# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved
31+#
32+# This program is free software: you can redistribute it and/or modify
33+# it under the terms of the GNU Affero General Public License as
34+# published by the Free Software Foundation, either version 3 of the
35+# License, or (at your option) any later version.
36+#
37+# This program is distributed in the hope that it will be useful,
38+# but WITHOUT ANY WARRANTY; without even the implied warranty of
39+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+# GNU Affero General Public License for more details.
41+#
42+# You should have received a copy of the GNU Affero General Public License
43+# along with this program. If not, see <http://www.gnu.org/licenses/>.
44+#
45+##############################################################################
46+
47+
48+import time
49+
50+from report import report_sxw
51+from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport
52+
53+
54+class kit_mass_import_export(report_sxw.rml_parse):
55+ def __init__(self, cr, uid, name, context=None):
56+ super(kit_mass_import_export, self).__init__(cr, uid, name, context=context)
57+ self.cr = cr
58+ self.uid = uid
59+ self.localcontext.update({
60+ })
61+
62+
63+class kit_mass_import_export_xls(SpreadsheetReport):
64+ def __init__(self, name, table, rml=False, parser=report_sxw.rml_parse,
65+ header='external', store=False):
66+ super(kit_mass_import_export_xls, self).__init__(name, table, rml=rml, parser=parser, header=header, store=store)
67+
68+ def create(self, cr, uid, ids, data, context=None):
69+ a = super(kit_mass_import_export_xls, self).create(cr, uid, ids, data, context)
70+ return (a[0], 'xls')
71+
72+
73+kit_mass_import_export_xls(
74+ 'report.kit_mass_import_export',
75+ 'kit.mass.import',
76+ 'addons/kit/report/kit_mass_import_export_xls.mako',
77+ parser=kit_mass_import_export,
78+ header=False)
79
80=== added file 'bin/addons/kit/report/kit_mass_import_export_view.xml'
81--- bin/addons/kit/report/kit_mass_import_export_view.xml 1970-01-01 00:00:00 +0000
82+++ bin/addons/kit/report/kit_mass_import_export_view.xml 2019-06-12 15:17:56 +0000
83@@ -0,0 +1,16 @@
84+<?xml version="1.0" encoding="utf-8" ?>
85+<openerp>
86+ <data>
87+ <report
88+ id="kit_mass_import_export"
89+ string="Theoretical Kit Template"
90+ model="kit.mass.import"
91+ name="kit_mass_import_export"
92+ file="kit/report/kit_mass_import_export_xls.mako"
93+ report_type="webkit"
94+ header="False"
95+ auto="False"
96+ menu="False"
97+ />
98+ </data>
99+</openerp>
100\ No newline at end of file
101
102=== added file 'bin/addons/kit/report/kit_mass_import_export_xls.mako'
103--- bin/addons/kit/report/kit_mass_import_export_xls.mako 1970-01-01 00:00:00 +0000
104+++ bin/addons/kit/report/kit_mass_import_export_xls.mako 2019-06-12 15:17:56 +0000
105@@ -0,0 +1,124 @@
106+<?xml version="1.0"?>
107+<?mso-application progid="Excel.Sheet"?>
108+<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
109+ xmlns:o="urn:schemas-microsoft-com:office:office"
110+ xmlns:x="urn:schemas-microsoft-com:office:excel"
111+ xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
112+ xmlns:html="http://www.w3.org/TR/REC-html40">
113+ <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
114+ <Author>MSFUser</Author>
115+ <LastAuthor>MSFUser</LastAuthor>
116+ <Created>2012-06-18T15:46:09Z</Created>
117+ <Company>Medecins Sans Frontieres</Company>
118+ <Version>11.9999</Version>
119+ </DocumentProperties>
120+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
121+ <WindowHeight>13170</WindowHeight>
122+ <WindowWidth>19020</WindowWidth>
123+ <WindowTopX>120</WindowTopX>
124+ <WindowTopY>60</WindowTopY>
125+ <ProtectStructure>False</ProtectStructure>
126+ <ProtectWindows>False</ProtectWindows>
127+ </ExcelWorkbook>
128+<Styles>
129+ <Style ss:ID="big_header">
130+ <Font x:Family="Swiss" ss:Size="14" ss:Bold="1"/>
131+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
132+ </Style>
133+ <Style ss:ID="header">
134+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
135+ <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/>
136+ <Borders>
137+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
138+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
139+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
140+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
141+ </Borders>
142+ </Style>
143+ <Style ss:ID="line">
144+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
145+ <Borders>
146+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
147+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
148+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
149+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
150+ </Borders>
151+ </Style>
152+ <Style ss:ID="line_left">
153+ <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1"/>
154+ <Borders>
155+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
156+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
157+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
158+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
159+ </Borders>
160+ </Style>
161+ <Style ss:ID="line_bold">
162+ <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1"/>
163+ <Borders>
164+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
165+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
166+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
167+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
168+ </Borders>
169+ <Font ss:Bold="1" />
170+ </Style>
171+ <Style ss:ID="line_red">
172+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
173+ <Borders>
174+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
175+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
176+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
177+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
178+ </Borders>
179+ <Font ss:Color="#ff0000"/>
180+ </Style>
181+ <Style ss:ID="short_date">
182+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
183+ <Borders>
184+ <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
185+ <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
186+ <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
187+ <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
188+ </Borders>
189+ <NumberFormat ss:Format="Short Date"/>
190+ </Style>
191+</Styles>
192+
193+% for o in objects:
194+<ss:Worksheet ss:Name="${_('Theoretical Kit Template')|x}">
195+<Table x:FullColumns="1" x:FullRows="1">
196+ ## Kit Code
197+ <Column ss:AutoFitWidth="1" ss:Width="85.75" />
198+ ## Kit Description
199+ <Column ss:AutoFitWidth="1" ss:Width="250.75" />
200+ ## Kit Version
201+ <Column ss:AutoFitWidth="1" ss:Width="50.75" />
202+ ## Active
203+ <Column ss:AutoFitWidth="1" ss:Width="50.75" />
204+ ## Module
205+ <Column ss:AutoFitWidth="1" ss:Width="80.0" />
206+ ## Product Code
207+ <Column ss:AutoFitWidth="1" ss:Width="85.75" />
208+ ## Product Description
209+ <Column ss:AutoFitWidth="1" ss:Width="200.75" />
210+ ## Product Qty
211+ <Column ss:AutoFitWidth="1" ss:Width="75.0" />
212+ ## Product UoM
213+ <Column ss:AutoFitWidth="1" ss:Width="50.75" />
214+
215+ <Row>
216+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Kit Code')}</Data></Cell>
217+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Kit Description')}</Data></Cell>
218+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Kit Version')}</Data></Cell>
219+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Active')}</Data></Cell>
220+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Module')}</Data></Cell>
221+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Code')}</Data></Cell>
222+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Description')}</Data></Cell>
223+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Qty')}</Data></Cell>
224+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product UoM')}</Data></Cell>
225+ </Row>
226+</Table>
227+</ss:Worksheet>
228+% endfor
229+</Workbook>
230
231=== modified file 'bin/addons/kit/wizard/kit_mass_import.py'
232--- bin/addons/kit/wizard/kit_mass_import.py 2015-04-02 14:03:07 +0000
233+++ bin/addons/kit/wizard/kit_mass_import.py 2019-06-12 15:17:56 +0000
234@@ -67,9 +67,6 @@
235 size=128,
236 string='Template filename',
237 ),
238- 'show_template': fields.boolean(
239- string='Show template',
240- ),
241 'state': fields.selection(
242 selection=[
243 ('draft', 'Not started'),
244@@ -122,31 +119,12 @@
245 if context is None:
246 context = {}
247
248- columns_header = [
249- (_('Kit Code'), 'string'),
250- (_('Kit Description'), 'string'),
251- (_('Kit Version'), 'string'),
252- (_('Active'), 'string'),
253- (_('Module'), 'string'),
254- (_('Product Code'), 'string'),
255- (_('Product Description'), 'string'),
256- (_('Product Qty'), 'string'),
257- (_('Product UoM'), 'string'),
258- ]
259- default_template = SpreadsheetCreator(
260- 'Template of import',
261- columns_header,
262- [],)
263- template = base64.encodestring(default_template.get_xml(
264- default_filters=['decode.utf8']))
265-
266- self.write(cr, uid, ids, {
267- 'template_file': template,
268- 'template_filename': 'template.xls',
269- 'show_template': True,
270- }, context=context)
271-
272- return {}
273+ return {
274+ 'type': 'ir.actions.report.xml',
275+ 'report_name': 'kit_mass_import_export',
276+ 'datas': {'target_filename': _('Theoretical Kit Template')},
277+ 'context': context,
278+ }
279
280 def get_value_from_excel(self, cr, uid, file_to_import, context=None):
281 """
282
283=== modified file 'bin/addons/kit/wizard/kit_mass_import_view.xml'
284--- bin/addons/kit/wizard/kit_mass_import_view.xml 2015-03-24 15:47:52 +0000
285+++ bin/addons/kit/wizard/kit_mass_import_view.xml 2019-06-12 15:17:56 +0000
286@@ -10,16 +10,13 @@
287 <form string="Theoretical Kit mass import">
288 <field name="display_warning_message" invisible="1" />
289 <field name="display_error_message" invisible="1" />
290- <field name="show_template" invisible="1" />
291 <separator colspan="4" string="Information" />
292 <field name="name" readonly="1" />
293 <newline />
294 <field name="file_to_import" filename="filename" accept="application/vnd.ms-excel,application/xml"/>
295 <field name="filename" invisible="1" />
296 <group colspan="2" col="2" attrs="{'invisible': [('state', '!=', 'draft')]}">
297- <field name="template_file" filename="template_filename" attrs="{'invisible': [('show_template', '=', False)]}" />
298- <field name="template_filename" invisible="1" />
299- <button name="get_template" string="Get template" colspan="2" type="object" attrs="{'invisible': [('show_template', '=', True)]}" />
300+ <button name="get_template" string="Get template" colspan="2" type="object" />
301 </group>
302 <group colspan="4" col="4" name="check_messages" attrs="{'invisible': [('state', '!=', 'check_error')]}">
303 <html>
304
305=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
306--- bin/addons/msf_profile/i18n/fr_MF.po 2019-06-04 19:13:17 +0000
307+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-06-12 15:17:56 +0000
308@@ -17748,7 +17748,7 @@
309
310 #. modules: threshold_value, procurement_auto, supplier_catalogue, consumption_calculation, kit, stock_forecast, procurement, msf_supply_doc_export, msf_doc_import
311 #: code:addons/consumption_calculation/consumption_calculation.py:482
312-#: code:addons/kit/wizard/kit_mass_import.py:134
313+#: report:addons/kit/report/kit_mass_import_export_xls.mako:119
314 #: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:43
315 #: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:69
316 #: report:addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako:177
317@@ -19397,7 +19397,7 @@
318 msgstr "ID de l'enregistrement parent"
319
320 #. module: kit
321-#: code:addons/kit/wizard/kit_mass_import.py:128
322+#: report:addons/kit/report/kit_mass_import_export_xls.mako:113
323 #: field:composition.item,item_kit_version:0
324 #, python-format
325 msgid "Kit Version"
326@@ -23275,10 +23275,10 @@
327 msgstr "Le fuseau horaire de l'utilisateur, utilisé pour calculer les conversions horaires entre le serveur et le client"
328
329 #. module: kit
330-#: code:addons/kit/wizard/kit_mass_import.py:127
331+#: report:addons/kit/report/kit_mass_import_export_xls.mako:112
332 #, python-format
333 msgid "Kit Description"
334-msgstr "Kit Description"
335+msgstr "Description du Kit"
336
337 #. module: msf_profile
338 #: field:res.groups,is_an_admin_profile:0
339@@ -38064,12 +38064,13 @@
340 msgstr "Transport type"
341
342 #. modules: msf_doc_import, kit
343-#: code:addons/kit/wizard/kit_mass_import.py:133
344+#: report:addons/kit/report/kit_mass_import_export_xls.mako:118
345+#: code:addons/kit/wizard/kit_mass_import.py:130
346 #: code:addons/msf_doc_import/wizard/__init__.py:100
347-#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:68
348+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:62
349 #, python-format
350 msgid "Product Qty"
351-msgstr "Product Qty"
352+msgstr "Qté du Produit"
353
354 #. module: purchase_double_validation
355 #: view:purchase.double.validation.installer:0
356@@ -44193,7 +44194,7 @@
357 #: report:addons/consumption_calculation/report/report_incoming_consumption_xls.mako:69
358 #: code:addons/consumption_calculation/wizard/wizard_export_fmc_rac.py:38
359 #: report:product.likely.expire.report_pdf:0
360-#: code:addons/kit/wizard/kit_mass_import.py:131
361+#: report:addons/kit/report/kit_mass_import_export_xls.mako:116
362 #: report:addons/msf_supply_doc_export/report/report_internal_move_xls.mako:68
363 #: report:addons/msf_supply_doc_export/report/report_real_composition_kit_xls.mako:65
364 #: report:addons/msf_supply_doc_export/report/stock_inventory_xls.mako:59
365@@ -55469,11 +55470,6 @@
366 msgid "Manufacturer Ref."
367 msgstr "Manufacturer Ref."
368
369-#. module: kit
370-#: field:kit.mass.import,show_template:0
371-msgid "Show template"
372-msgstr "Montrer le modèle"
373-
374 #. modules: msf_doc_import, msf_outgoing
375 #: report:addons/msf_doc_import/report/in_simulation_screen_xls_report.mako:151
376 #: field:wizard.import.in.line.simulation.screen,move_uom_id:0
377@@ -60257,7 +60253,7 @@
378 #. module: kit
379 #: view:kit.mass.import:0
380 msgid "Get template"
381-msgstr "Get template"
382+msgstr "Obtenir le modèle"
383
384 #. module: product
385 #: field:product.template,rental:0
386@@ -65077,7 +65073,7 @@
387 #: field:ir.module.module.dependency,module_id:0
388 #: report:ir.module.reference:0
389 #: field:ir.translation,module:0
390-#: code:addons/kit/wizard/kit_mass_import.py:130
391+#: report:addons/kit/report/kit_mass_import_export_xls.mako:115
392 #: field:assign.to.kit,module_assign_to_kit:0
393 #: view:composition.item:0
394 #: field:composition.item,item_module:0
395@@ -73032,7 +73028,7 @@
396 #: field:sync.client.sync_server_connection,active:0
397 #: field:threshold.value,active:0
398 #: field:account.period,active:0
399-#: code:addons/kit/wizard/kit_mass_import.py:129
400+#: report:addons/kit/report/kit_mass_import_export_xls.mako:114
401 #: view:msf.instance:0
402 #: field:automated.export,active:0
403 #: field:product.heat_sensitive,active:0
404@@ -75763,7 +75759,7 @@
405 msgstr "Approvisionnement- Méthode"
406
407 #. module: kit
408-#: code:addons/kit/wizard/kit_mass_import.py:126
409+#: report:addons/kit/report/kit_mass_import_export_xls.mako:111
410 #, python-format
411 msgid "Kit Code"
412 msgstr "Code Kit"
413@@ -77002,7 +76998,7 @@
414 #: report:addons/consumption_calculation/report/report_incoming_consumption_xls.mako:70
415 #: report:addons/consumption_calculation/report/report_real_consumption_xls.mako:70
416 #: report:product.likely.expire.report_pdf:0
417-#: code:addons/kit/wizard/kit_mass_import.py:132
418+#: report:addons/kit/report/kit_mass_import_export_xls.mako:117
419 #: code:addons/msf_doc_import/wizard/__init__.py:30
420 #: code:addons/msf_doc_import/wizard/__init__.py:57
421 #: code:addons/msf_doc_import/wizard/__init__.py:67
422@@ -106827,3 +106823,10 @@
423 msgid "Stop report"
424 msgstr "Arrêter le rapport"
425
426+#. module: kit
427+#: report:addons/kit/report/kit_mass_import_export_xls.mako:89
428+#: code:addons/kit/wizard/kit_mass_import.py:149
429+#: model:ir.actions.report.xml,name:kit.kit_mass_import_export
430+#, python-format
431+msgid "Theoretical Kit Template"
432+msgstr "Modèle du Kit Théorique"

Subscribers

People subscribed via source and target branches