Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_dumb_wizard_export_csv-dev-fernando into lp:addons-vauxoo
- addons-vauxoo-stock_dumb_wizard_export_csv-dev-fernando
- Merge into 6.0-trunk
Status: | Merged |
---|---|
Merge reported by: | Ulises Lopez |
Merged at revision: | not available |
Proposed branch: | lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_dumb_wizard_export_csv-dev-fernando |
Merge into: | lp:addons-vauxoo |
Diff against target: |
492 lines (+449/-0) 7 files modified
__init__.py (+27/-0) __openerp__.py (+45/-0) i18n/es_MX.po (+93/-0) stock.py (+122/-0) stock_view.xml (+75/-0) wizard/__init__.py (+26/-0) wizard/wizard.py (+61/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_dumb_wizard_export_csv-dev-fernando |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Moisés López - http://www.vauxoo.com | Needs Fixing | ||
Ulises Lopez | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2012-09-24.
Commit message
Description of the change
Se modificó el manejo del diccionario ya que se estaban sobre escribiendo los datos y por eso repetía las líneas.
Se movió la columna name de la columna 3 a la 4.
La columna 3 se le asignó al campo 'reference'
El nombre del csv por default se cambio a "PT OpenERP - PWST.csv"
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Fernando Lopez (kyon) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ulises Lopez (ulcalderon) wrote : Posted in a previous version of this proposal | # |
- Cuando selecciono varios pickings solo toma los datos del último picking seleccionado, envío evidencia:
"2012-09-25 19:01:05"
"2012-09-25 19:01:05"
"2012-09-25 19:01:05"
- El formato de la columna 1, que es la fecha del movimiento aparece "2012-09-25 19:01:05", debe de ser con el siguiente formato "DD/MM/AAAA" sin hora.
- En la columna 3, debe de contener la referencia del documento ejemplo "OUT/00001"
- Colocar el nombre del producto en la columna 4 ejemplo "[09878] Producto terminado 4"
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ulises Lopez (ulcalderon) wrote : Posted in a previous version of this proposal | # |
- Colocar el siguiente nombre de archivo al momento de exportar: "PT OpenERP - PWST AAMMDD HH:MM.csv"
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Moisés López - http://www.vauxoo.com (moylop260) wrote : Posted in a previous version of this proposal | # |
Equipo,
En la solicitud:
- En la columna 3, debe de contener la referencia del documento ejemplo "OUT/00001"
Creo que lo vamos a dejar tal cual está ahora + lo que pide Ulises, debido a que va a haber exportaciones de stock.move que no tengan stock.picking y esto podría causar error.
Es decir,
stock_move.
¿Me explico?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Moisés López - http://www.vauxoo.com (moylop260) wrote : | # |
Acorde a las guidelines
2.5 Factor out the code
Del documento
http://
Se detecta que la función de stock_picking llamada "create_
Dejar esta funcionalidad en stock_move (tal cual como está ahora), pero en la función del picking, hacer un ciclo para acumular move_ids donde al final, mande a llamar a stock_move.
Y cuando termines esto, no darle en "Resubmit proposal merge", más bien darle en en comentario
Review: resumit y escribir tu comentario largo (que faltó en este nuevo feature)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ulises Lopez (ulcalderon) wrote : | # |
Se cambio al branch lp:vauxoo-private/sabersabor6.1
Preview Diff
1 | === added file '__init__.py' | |||
2 | --- __init__.py 1970-01-01 00:00:00 +0000 | |||
3 | +++ __init__.py 2012-09-25 23:32:22 +0000 | |||
4 | @@ -0,0 +1,27 @@ | |||
5 | 1 | # -*- encoding: utf-8 -*- | ||
6 | 2 | ########################################################################### | ||
7 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
8 | 4 | # | ||
9 | 5 | # Copyright (c) 2012 Vauxoo - http://www.vauxoo.com | ||
10 | 6 | # All Rights Reserved. | ||
11 | 7 | # info@vauxoo.com | ||
12 | 8 | ############################################################################ | ||
13 | 9 | # Coded by: fernandoL (fernando_ld@vauxoo.com) | ||
14 | 10 | ############################################################################ | ||
15 | 11 | # | ||
16 | 12 | # This program is free software: you can redistribute it and/or modify | ||
17 | 13 | # it under the terms of the GNU Affero General Public License as | ||
18 | 14 | # published by the Free Software Foundation, either version 3 of the | ||
19 | 15 | # License, or (at your option) any later version. | ||
20 | 16 | # | ||
21 | 17 | # This program is distributed in the hope that it will be useful, | ||
22 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
24 | 20 | # GNU Affero General Public License for more details. | ||
25 | 21 | # | ||
26 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
27 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
28 | 24 | # | ||
29 | 25 | ############################################################################## | ||
30 | 26 | import wizard | ||
31 | 27 | import stock | ||
32 | 0 | \ No newline at end of file | 28 | \ No newline at end of file |
33 | 1 | 29 | ||
34 | === added file '__openerp__.py' | |||
35 | --- __openerp__.py 1970-01-01 00:00:00 +0000 | |||
36 | +++ __openerp__.py 2012-09-25 23:32:22 +0000 | |||
37 | @@ -0,0 +1,45 @@ | |||
38 | 1 | # -*- encoding: utf-8 -*- | ||
39 | 2 | ########################################################################### | ||
40 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
41 | 4 | # | ||
42 | 5 | # Copyright (c) 2012 Vauxoo - http://www.vauxoo.com | ||
43 | 6 | # All Rights Reserved. | ||
44 | 7 | # info@vauxoo.com | ||
45 | 8 | ############################################################################ | ||
46 | 9 | # Coded by: fernandoL (fernando_ld@vauxoo.com) | ||
47 | 10 | ############################################################################ | ||
48 | 11 | # | ||
49 | 12 | # This program is free software: you can redistribute it and/or modify | ||
50 | 13 | # it under the terms of the GNU Affero General Public License as | ||
51 | 14 | # published by the Free Software Foundation, either version 3 of the | ||
52 | 15 | # License, or (at your option) any later version. | ||
53 | 16 | # | ||
54 | 17 | # This program is distributed in the hope that it will be useful, | ||
55 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
56 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
57 | 20 | # GNU Affero General Public License for more details. | ||
58 | 21 | # | ||
59 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
60 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
61 | 24 | # | ||
62 | 25 | ############################################################################## | ||
63 | 26 | |||
64 | 27 | { | ||
65 | 28 | "name": "Stock dumb wizard export csv", | ||
66 | 29 | "version": "1.0", | ||
67 | 30 | "author" : "Vauxoo", | ||
68 | 31 | "category": "Generic Modules/Production", | ||
69 | 32 | "website" : "http://www.vauxoo.com/", | ||
70 | 33 | "description": """ Add wizard to export to a csv the stock_move lines | ||
71 | 34 | from the stock_picking model | ||
72 | 35 | """, | ||
73 | 36 | 'depends': ['stock'], | ||
74 | 37 | 'init_xml': [], | ||
75 | 38 | 'update_xml': [ | ||
76 | 39 | 'stock_view.xml', | ||
77 | 40 | ], | ||
78 | 41 | 'demo_xml': [], | ||
79 | 42 | 'test': [], | ||
80 | 43 | 'installable': True, | ||
81 | 44 | 'active': False, | ||
82 | 45 | } | ||
83 | 0 | \ No newline at end of file | 46 | \ No newline at end of file |
84 | 1 | 47 | ||
85 | === added directory 'i18n' | |||
86 | === added file 'i18n/es_MX.mo' | |||
87 | 2 | Binary files i18n/es_MX.mo 1970-01-01 00:00:00 +0000 and i18n/es_MX.mo 2012-09-25 23:32:22 +0000 differ | 48 | Binary files i18n/es_MX.mo 1970-01-01 00:00:00 +0000 and i18n/es_MX.mo 2012-09-25 23:32:22 +0000 differ |
88 | === added file 'i18n/es_MX.po' | |||
89 | --- i18n/es_MX.po 1970-01-01 00:00:00 +0000 | |||
90 | +++ i18n/es_MX.po 2012-09-25 23:32:22 +0000 | |||
91 | @@ -0,0 +1,93 @@ | |||
92 | 1 | # Translation of OpenERP Server. | ||
93 | 2 | # This file contains the translation of the following modules: | ||
94 | 3 | # * stock_dumb_wizard_export_csv | ||
95 | 4 | # | ||
96 | 5 | msgid "" | ||
97 | 6 | msgstr "" | ||
98 | 7 | "Project-Id-Version: OpenERP Server 6.1\n" | ||
99 | 8 | "Report-Msgid-Bugs-To: \n" | ||
100 | 9 | "POT-Creation-Date: 2012-09-24 23:15+0000\n" | ||
101 | 10 | "PO-Revision-Date: 2012-09-24 18:23-0600\n" | ||
102 | 11 | "Last-Translator: Kyon <fernando_ld@vauxoo.com>\n" | ||
103 | 12 | "Language-Team: \n" | ||
104 | 13 | "MIME-Version: 1.0\n" | ||
105 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
106 | 15 | "Content-Transfer-Encoding: 8bit\n" | ||
107 | 16 | "Plural-Forms: \n" | ||
108 | 17 | |||
109 | 18 | #. module: stock_dumb_wizard_export_csv | ||
110 | 19 | #: model:ir.model,name:stock_dumb_wizard_export_csv.model_stock_dumb_wizard_export_csv | ||
111 | 20 | msgid "stock.dumb.wizard.export.csv" | ||
112 | 21 | msgstr "stock.dumb.wizard.export.csv" | ||
113 | 22 | |||
114 | 23 | #. module: stock_dumb_wizard_export_csv | ||
115 | 24 | #: view:stock.dumb.wizard.export.csv:0 | ||
116 | 25 | #: view:stock.dumb.wizard.export.stk.move:0 | ||
117 | 26 | msgid "Exportar to CSV" | ||
118 | 27 | msgstr "Exportar a csv" | ||
119 | 28 | |||
120 | 29 | #. module: stock_dumb_wizard_export_csv | ||
121 | 30 | #: model:ir.model,name:stock_dumb_wizard_export_csv.model_stock_dumb_wizard_export_stk_move | ||
122 | 31 | msgid "stock.dumb.wizard.export.stk.move" | ||
123 | 32 | msgstr "stock.dumb.wizard.export.stk.move" | ||
124 | 33 | |||
125 | 34 | #. module: stock_dumb_wizard_export_csv | ||
126 | 35 | #: model:ir.model,name:stock_dumb_wizard_export_csv.model_stock_move | ||
127 | 36 | msgid "Stock Move" | ||
128 | 37 | msgstr "Stock Move" | ||
129 | 38 | |||
130 | 39 | #. module: stock_dumb_wizard_export_csv | ||
131 | 40 | #: model:ir.actions.act_window,name:stock_dumb_wizard_export_csv.stock_dumb_wizard_stock_move | ||
132 | 41 | #: model:ir.actions.act_window,name:stock_dumb_wizard_export_csv.stock_dumb_wizard_stock_picking | ||
133 | 42 | msgid "Export to csv" | ||
134 | 43 | msgstr "Exportar a csv" | ||
135 | 44 | |||
136 | 45 | #. module: stock_dumb_wizard_export_csv | ||
137 | 46 | #: constraint:stock.move:0 | ||
138 | 47 | msgid "You can not move products from or to a location of the type view." | ||
139 | 48 | msgstr "No puedes mover productos desde o a una locación del tipo vista" | ||
140 | 49 | |||
141 | 50 | #. module: stock_dumb_wizard_export_csv | ||
142 | 51 | #: model:ir.actions.act_window,name:stock_dumb_wizard_export_csv.stock_dumb_wizard_export_csv_action | ||
143 | 52 | #: model:ir.actions.act_window,name:stock_dumb_wizard_export_csv.stock_dumb_wizard_stock_move_action | ||
144 | 53 | msgid "Wizard" | ||
145 | 54 | msgstr "Asistente" | ||
146 | 55 | |||
147 | 56 | #. module: stock_dumb_wizard_export_csv | ||
148 | 57 | #: constraint:stock.move:0 | ||
149 | 58 | msgid "You must assign a production lot for this product" | ||
150 | 59 | msgstr "Debe asignar un lote de producción para este producto" | ||
151 | 60 | |||
152 | 61 | #. module: stock_dumb_wizard_export_csv | ||
153 | 62 | #: field:stock.dumb.wizard.export.csv,file.csv:0 | ||
154 | 63 | #: field:stock.dumb.wizard.export.stk.move,file.csv:0 | ||
155 | 64 | msgid "File CSV" | ||
156 | 65 | msgstr "Archivo CSV" | ||
157 | 66 | |||
158 | 67 | #. module: stock_dumb_wizard_export_csv | ||
159 | 68 | #: constraint:stock.move:0 | ||
160 | 69 | msgid "You try to assign a lot which is not from the same product" | ||
161 | 70 | msgstr "Está intentando asignar un lote que no es del mismo producto" | ||
162 | 71 | |||
163 | 72 | #. module: stock_dumb_wizard_export_csv | ||
164 | 73 | #: view:stock.dumb.wizard.export.csv:0 | ||
165 | 74 | #: view:stock.dumb.wizard.export.stk.move:0 | ||
166 | 75 | msgid "Get data to export" | ||
167 | 76 | msgstr "Obtener datos a exportar" | ||
168 | 77 | |||
169 | 78 | #. module: stock_dumb_wizard_export_csv | ||
170 | 79 | #: sql_constraint:stock.picking:0 | ||
171 | 80 | msgid "Reference must be unique per Company!" | ||
172 | 81 | msgstr "¡La referencia debe ser única por compañía!" | ||
173 | 82 | |||
174 | 83 | #. module: stock_dumb_wizard_export_csv | ||
175 | 84 | #: model:ir.model,name:stock_dumb_wizard_export_csv.model_stock_picking | ||
176 | 85 | msgid "Picking List" | ||
177 | 86 | msgstr "Albarán (lista de remisiones)" | ||
178 | 87 | |||
179 | 88 | #. module: stock_dumb_wizard_export_csv | ||
180 | 89 | #: view:stock.dumb.wizard.export.csv:0 | ||
181 | 90 | #: view:stock.dumb.wizard.export.stk.move:0 | ||
182 | 91 | msgid "Cancel" | ||
183 | 92 | msgstr "Cancelar" | ||
184 | 93 | |||
185 | 0 | 94 | ||
186 | === added file 'stock.py' | |||
187 | --- stock.py 1970-01-01 00:00:00 +0000 | |||
188 | +++ stock.py 2012-09-25 23:32:22 +0000 | |||
189 | @@ -0,0 +1,122 @@ | |||
190 | 1 | # -*- encoding: utf-8 -*- | ||
191 | 2 | ########################################################################### | ||
192 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
193 | 4 | # | ||
194 | 5 | # Copyright (c) 2012 Vauxoo - http://www.vauxoo.com | ||
195 | 6 | # All Rights Reserved. | ||
196 | 7 | # info@vauxoo.com | ||
197 | 8 | ############################################################################ | ||
198 | 9 | # Coded by: fernandoL (fernando_ld@vauxoo.com) | ||
199 | 10 | ############################################################################ | ||
200 | 11 | # | ||
201 | 12 | # This program is free software: you can redistribute it and/or modify | ||
202 | 13 | # it under the terms of the GNU Affero General Public License as | ||
203 | 14 | # published by the Free Software Foundation, either version 3 of the | ||
204 | 15 | # License, or (at your option) any later version. | ||
205 | 16 | # | ||
206 | 17 | # This program is distributed in the hope that it will be useful, | ||
207 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
208 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
209 | 20 | # GNU Affero General Public License for more details. | ||
210 | 21 | # | ||
211 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
212 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
213 | 24 | # | ||
214 | 25 | ############################################################################## | ||
215 | 26 | |||
216 | 27 | import pooler | ||
217 | 28 | import wizard | ||
218 | 29 | import base64 | ||
219 | 30 | import cStringIO | ||
220 | 31 | import netsvc | ||
221 | 32 | from tools.translate import _ | ||
222 | 33 | import tools | ||
223 | 34 | import os | ||
224 | 35 | from osv import osv, fields | ||
225 | 36 | import base64 | ||
226 | 37 | import csv | ||
227 | 38 | import StringIO | ||
228 | 39 | import time | ||
229 | 40 | |||
230 | 41 | class stock_picking(osv.osv): | ||
231 | 42 | _inherit = "stock.picking" | ||
232 | 43 | |||
233 | 44 | """equivalent query to this export --- | ||
234 | 45 | select sm.date, sm.name, sm.product_qty, pp.default_code | ||
235 | 46 | from stock_move as sm, product_product as pp | ||
236 | 47 | where sm.product_id=pp.id | ||
237 | 48 | """ | ||
238 | 49 | |||
239 | 50 | def create_export_stk_moves(self,cr,uid,picking_ids,context=None): | ||
240 | 51 | if not context: | ||
241 | 52 | context={} | ||
242 | 53 | |||
243 | 54 | stock_picking = self.browse(cr, uid, picking_ids, context=context) | ||
244 | 55 | val=[] | ||
245 | 56 | diction={} | ||
246 | 57 | |||
247 | 58 | for picking in stock_picking: | ||
248 | 59 | for line in picking.move_lines: | ||
249 | 60 | my_date = time.strptime(line.date, "%Y-%m-%d %H:%M:%S") | ||
250 | 61 | diction['date'] = time.strftime("%d/%m/%Y", my_date) | ||
251 | 62 | diction['1'] = "" | ||
252 | 63 | diction['reference'] = picking.name | ||
253 | 64 | diction['name'] = line.name | ||
254 | 65 | diction['product_qty'] = line.product_qty | ||
255 | 66 | diction['default_code'] = line.product_id.default_code | ||
256 | 67 | val.append(diction.copy()) | ||
257 | 68 | |||
258 | 69 | buf = StringIO.StringIO() | ||
259 | 70 | |||
260 | 71 | csv.register_dialect('dialect_1', lineterminator = '\n', delimiter=',', quoting=csv.QUOTE_ALL) | ||
261 | 72 | |||
262 | 73 | writer = csv.DictWriter(buf, ['date','1','reference','name','product_qty','default_code',], dialect='dialect_1') | ||
263 | 74 | |||
264 | 75 | writer.writerows(val) | ||
265 | 76 | values = base64.encodestring( buf.getvalue() ) | ||
266 | 77 | buf.close() | ||
267 | 78 | return values | ||
268 | 79 | |||
269 | 80 | stock_picking() | ||
270 | 81 | |||
271 | 82 | class stock_move(osv.osv): | ||
272 | 83 | _inherit = "stock.move" | ||
273 | 84 | |||
274 | 85 | """equivalent query to this export --- | ||
275 | 86 | select sm.date, sm.name, sm.product_qty, pp.default_code | ||
276 | 87 | from stock_move as sm, product_product as pp | ||
277 | 88 | where sm.product_id=pp.id | ||
278 | 89 | """ | ||
279 | 90 | |||
280 | 91 | def create_export_stk_moves(self,cr,uid,move_ids,context=None): | ||
281 | 92 | if not context: | ||
282 | 93 | context={} | ||
283 | 94 | |||
284 | 95 | stock_move = self.browse(cr, uid, move_ids, context=context) | ||
285 | 96 | val=[] | ||
286 | 97 | diction={} | ||
287 | 98 | |||
288 | 99 | for move in stock_move: | ||
289 | 100 | my_date = time.strptime(move.date, "%Y-%m-%d %H:%M:%S") | ||
290 | 101 | diction['date'] = time.strftime("%d/%m/%Y", my_date) | ||
291 | 102 | diction['1'] = "" | ||
292 | 103 | diction['reference'] = move.picking_id.name | ||
293 | 104 | diction['name'] = move.name | ||
294 | 105 | diction['product_qty'] = move.product_qty | ||
295 | 106 | diction['default_code'] = move.product_id.default_code | ||
296 | 107 | val.append(diction.copy()) | ||
297 | 108 | |||
298 | 109 | contx=context.copy() | ||
299 | 110 | |||
300 | 111 | buf = StringIO.StringIO() | ||
301 | 112 | |||
302 | 113 | csv.register_dialect('dialect_1', lineterminator = '\n', delimiter=',', quoting=csv.QUOTE_ALL) | ||
303 | 114 | |||
304 | 115 | writer = csv.DictWriter(buf, ['date','1','reference','name','product_qty','default_code',], dialect='dialect_1') | ||
305 | 116 | |||
306 | 117 | writer.writerows(val) | ||
307 | 118 | values = base64.encodestring( buf.getvalue() ) | ||
308 | 119 | buf.close() | ||
309 | 120 | return values | ||
310 | 121 | |||
311 | 122 | stock_move() | ||
312 | 0 | \ No newline at end of file | 123 | \ No newline at end of file |
313 | 1 | 124 | ||
314 | === added file 'stock_view.xml' | |||
315 | --- stock_view.xml 1970-01-01 00:00:00 +0000 | |||
316 | +++ stock_view.xml 2012-09-25 23:32:22 +0000 | |||
317 | @@ -0,0 +1,75 @@ | |||
318 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
319 | 2 | <openerp> | ||
320 | 3 | <data> | ||
321 | 4 | <!-- | ||
322 | 5 | View of wizard on stock.picking | ||
323 | 6 | --> | ||
324 | 7 | <record id="stock_dumb_wizard_export_csv_form" model="ir.ui.view"> | ||
325 | 8 | <field name="name">stock.dumb.wizard.export.csv.form</field> | ||
326 | 9 | <field name="model">stock.dumb.wizard.export.csv</field> | ||
327 | 10 | <field name="type">form</field> | ||
328 | 11 | <field name="arch" type="xml"> | ||
329 | 12 | <form string="Exportar to CSV"> | ||
330 | 13 | <field name="file.csv" colspan="4" nolabel="1" filename="PT OpenERP - PWST.csv"/> | ||
331 | 14 | <group colspan="4"> | ||
332 | 15 | <button string="Cancel" icon="gtk-cancel" type="object" special="cancel"/> | ||
333 | 16 | <button string="Get data to export" icon="gtk-ok" name="action_export2" type="object"/> | ||
334 | 17 | </group> | ||
335 | 18 | </form> | ||
336 | 19 | </field> | ||
337 | 20 | </record> | ||
338 | 21 | |||
339 | 22 | <act_window id="stock_dumb_wizard_stock_picking" | ||
340 | 23 | name="Export to csv" | ||
341 | 24 | src_model="stock.picking" | ||
342 | 25 | res_model="stock.dumb.wizard.export.csv" | ||
343 | 26 | view_mode="form" | ||
344 | 27 | target="new" | ||
345 | 28 | key2="client_action_multi" | ||
346 | 29 | /> | ||
347 | 30 | |||
348 | 31 | <record id="stock_dumb_wizard_export_csv_action" model="ir.actions.act_window"> | ||
349 | 32 | <field name="name">Wizard</field> | ||
350 | 33 | <field name="res_model">stock.dumb.wizard.export.csv</field> | ||
351 | 34 | <field name="view_type">form</field> | ||
352 | 35 | <field name="view_mode">form</field> | ||
353 | 36 | <field name="target">new</field> | ||
354 | 37 | </record> | ||
355 | 38 | <!-- | ||
356 | 39 | View of wizard on stock.picking | ||
357 | 40 | --> | ||
358 | 41 | <record id="stock_dumb_wizard_export_stk_move_form" model="ir.ui.view"> | ||
359 | 42 | <field name="name">stock.dumb.wizard.export.stk.move.form</field> | ||
360 | 43 | <field name="model">stock.dumb.wizard.export.stk.move</field> | ||
361 | 44 | <field name="type">form</field> | ||
362 | 45 | <field name="arch" type="xml"> | ||
363 | 46 | <form string="Exportar to CSV"> | ||
364 | 47 | <field name="file.csv" colspan="4" nolabel="1" filename="PT OpenERP - PWST.csv"/> | ||
365 | 48 | <group colspan="4"> | ||
366 | 49 | <button string="Cancel" icon="gtk-cancel" type="object" special="cancel"/> | ||
367 | 50 | <button string="Get data to export" icon="gtk-ok" name="action_export3" type="object"/> | ||
368 | 51 | </group> | ||
369 | 52 | </form> | ||
370 | 53 | </field> | ||
371 | 54 | </record> | ||
372 | 55 | |||
373 | 56 | <act_window id="stock_dumb_wizard_stock_move" | ||
374 | 57 | name="Export to csv" | ||
375 | 58 | src_model="stock.move" | ||
376 | 59 | res_model="stock.dumb.wizard.export.stk.move" | ||
377 | 60 | view_mode="form" | ||
378 | 61 | target="new" | ||
379 | 62 | key2="client_action_multi" | ||
380 | 63 | /> | ||
381 | 64 | |||
382 | 65 | |||
383 | 66 | <record id="stock_dumb_wizard_stock_move_action" model="ir.actions.act_window"> | ||
384 | 67 | <field name="name">Wizard</field> | ||
385 | 68 | <field name="res_model">stock.dumb.wizard.export.stk.move</field> | ||
386 | 69 | <field name="view_type">form</field> | ||
387 | 70 | <field name="view_mode">form</field> | ||
388 | 71 | <field name="target">new</field> | ||
389 | 72 | </record> | ||
390 | 73 | |||
391 | 74 | </data> | ||
392 | 75 | </openerp> | ||
393 | 0 | 76 | ||
394 | === added directory 'wizard' | |||
395 | === added file 'wizard/__init__.py' | |||
396 | --- wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
397 | +++ wizard/__init__.py 2012-09-25 23:32:22 +0000 | |||
398 | @@ -0,0 +1,26 @@ | |||
399 | 1 | # -*- encoding: utf-8 -*- | ||
400 | 2 | ########################################################################### | ||
401 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
402 | 4 | # | ||
403 | 5 | # Copyright (c) 2012 Vauxoo - http://www.vauxoo.com | ||
404 | 6 | # All Rights Reserved. | ||
405 | 7 | # info@vauxoo.com | ||
406 | 8 | ############################################################################ | ||
407 | 9 | # Coded by: fernandoL (fernando_ld@vauxoo.com) | ||
408 | 10 | ############################################################################ | ||
409 | 11 | # | ||
410 | 12 | # This program is free software: you can redistribute it and/or modify | ||
411 | 13 | # it under the terms of the GNU Affero General Public License as | ||
412 | 14 | # published by the Free Software Foundation, either version 3 of the | ||
413 | 15 | # License, or (at your option) any later version. | ||
414 | 16 | # | ||
415 | 17 | # This program is distributed in the hope that it will be useful, | ||
416 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
417 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
418 | 20 | # GNU Affero General Public License for more details. | ||
419 | 21 | # | ||
420 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
421 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
422 | 24 | # | ||
423 | 25 | ############################################################################## | ||
424 | 26 | import wizard | ||
425 | 0 | \ No newline at end of file | 27 | \ No newline at end of file |
426 | 1 | 28 | ||
427 | === added file 'wizard/wizard.py' | |||
428 | --- wizard/wizard.py 1970-01-01 00:00:00 +0000 | |||
429 | +++ wizard/wizard.py 2012-09-25 23:32:22 +0000 | |||
430 | @@ -0,0 +1,61 @@ | |||
431 | 1 | # -*- encoding: utf-8 -*- | ||
432 | 2 | ########################################################################### | ||
433 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
434 | 4 | # | ||
435 | 5 | # Copyright (c) 2012 Vauxoo - http://www.vauxoo.com | ||
436 | 6 | # All Rights Reserved. | ||
437 | 7 | # info@vauxoo.com | ||
438 | 8 | ############################################################################ | ||
439 | 9 | # Coded by: fernandoL (fernando_ld@vauxoo.com) | ||
440 | 10 | ############################################################################ | ||
441 | 11 | # | ||
442 | 12 | # This program is free software: you can redistribute it and/or modify | ||
443 | 13 | # it under the terms of the GNU Affero General Public License as | ||
444 | 14 | # published by the Free Software Foundation, either version 3 of the | ||
445 | 15 | # License, or (at your option) any later version. | ||
446 | 16 | # | ||
447 | 17 | # This program is distributed in the hope that it will be useful, | ||
448 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
449 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
450 | 20 | # GNU Affero General Public License for more details. | ||
451 | 21 | # | ||
452 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
453 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
454 | 24 | # | ||
455 | 25 | ############################################################################## | ||
456 | 26 | import time | ||
457 | 27 | from osv import osv, fields | ||
458 | 28 | import decimal_precision as dp | ||
459 | 29 | from tools.translate import _ | ||
460 | 30 | |||
461 | 31 | class stock_dumb_wizard_export_csv(osv.osv_memory): | ||
462 | 32 | _name='stock.dumb.wizard.export.csv' | ||
463 | 33 | _columns={ | ||
464 | 34 | 'file.csv' : fields.binary('File CSV'), | ||
465 | 35 | } | ||
466 | 36 | |||
467 | 37 | def action_export2(self,cr,uid,ids,context={}): | ||
468 | 38 | if not context: | ||
469 | 39 | context={} | ||
470 | 40 | picking_ids = context.get('active_ids', []) | ||
471 | 41 | stock_picking_obj = self.pool.get('stock.picking') | ||
472 | 42 | val = stock_picking_obj.create_export_stk_moves(cr,uid,picking_ids,context=context) | ||
473 | 43 | self.write(cr,uid,ids,{'file.csv' : val}) | ||
474 | 44 | return True | ||
475 | 45 | stock_dumb_wizard_export_csv() | ||
476 | 46 | |||
477 | 47 | class stock_dumb_wizard_export_stk_move(osv.osv_memory): | ||
478 | 48 | _name='stock.dumb.wizard.export.stk.move' | ||
479 | 49 | _columns={ | ||
480 | 50 | 'file.csv' : fields.binary('File CSV'), | ||
481 | 51 | } | ||
482 | 52 | |||
483 | 53 | def action_export3(self,cr,uid,ids,context={}): | ||
484 | 54 | if not context: | ||
485 | 55 | context={} | ||
486 | 56 | move_ids = context.get('active_ids', []) | ||
487 | 57 | stock_move_obj = self.pool.get('stock.move') | ||
488 | 58 | val = stock_move_obj.create_export_stk_moves(cr,uid,move_ids,context=context) | ||
489 | 59 | self.write(cr,uid,ids,{'file.csv' : val}) | ||
490 | 60 | return True | ||
491 | 61 | stock_dumb_wizard_export_stk_move() | ||
492 | 0 | \ No newline at end of file | 62 | \ No newline at end of file |
Funcionalidad migrada a stock.move