Merge lp:~vauxoo/addons-vauxoo/6.1_maintenance-dev_luis into lp:addons-vauxoo/6.1
- 6.1_maintenance-dev_luis
- Merge into 6.1
Proposed by
Luis Torres - http://www.vauxoo.com
Status: | Merged |
---|---|
Merged at revision: | 632 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/6.1_maintenance-dev_luis |
Merge into: | lp:addons-vauxoo/6.1 |
Diff against target: |
2295 lines (+2204/-0) 16 files modified
maintenance/__init__.py (+29/-0) maintenance/__openerp__.py (+46/-0) maintenance/i18n/es.po (+771/-0) maintenance/maintenance.py (+334/-0) maintenance/maintenance_report.xml (+12/-0) maintenance/maintenance_view.xml (+271/-0) maintenance/maintenance_wizard.xml (+93/-0) maintenance/product.py (+172/-0) maintenance/report/__init__.py (+1/-0) maintenance/report/orden_dia.py (+67/-0) maintenance/report/orden_dia.rml (+131/-0) maintenance/wizard/__init__.py (+29/-0) maintenance/wizard/set_tire.py (+104/-0) maintenance/wizard/wizard_check_maintenance.py (+45/-0) maintenance/wizard/wizard_maintenance_cancel.py (+58/-0) maintenance/wizard/wizard_maintenance_start.py (+41/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/6.1_maintenance-dev_luis |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julio Serna-http://www.vauxoo.com | Pending | ||
Review via email:
|
Commit message
Description of the change
Se agrego el modulo para mantenimientos, migrado de la version 6.0
To post a comment you must log in.
- 634. By Luis Torres - http://www.vauxoo.com
-
[IMP][maintenan
ce]Added search and translation - 635. By Luis Torres - http://www.vauxoo.com
-
[REF][maintenan
ce]was commented the code related with tires - 636. By Luis Torres - http://www.vauxoo.com
-
[IMP][maintenan
ce]Changed menuitem after of action
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'maintenance' |
2 | === added file 'maintenance/__init__.py' |
3 | --- maintenance/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ maintenance/__init__.py 2014-06-11 15:54:53 +0000 |
5 | @@ -0,0 +1,29 @@ |
6 | +# -*- encoding: utf-8 -*- |
7 | +########################################################################### |
8 | +# Module Writen to OpenERP, Open Source Management Solution |
9 | +# |
10 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
11 | +# All Rights Reserved. |
12 | +# info Vauxoo (info@vauxoo.com) |
13 | +############################################################################ |
14 | +# Coded by: Julio Serna(julio@vauxoo.com) |
15 | +############################################################################ |
16 | +# |
17 | +# This program is free software: you can redistribute it and/or modify |
18 | +# it under the terms of the GNU Affero General Public License as |
19 | +# published by the Free Software Foundation, either version 3 of the |
20 | +# License, or (at your option) any later version. |
21 | +# |
22 | +# This program is distributed in the hope that it will be useful, |
23 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | +# GNU Affero General Public License for more details. |
26 | +# |
27 | +# You should have received a copy of the GNU Affero General Public License |
28 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 | +# |
30 | +############################################################################## |
31 | +import maintenance |
32 | +import product |
33 | +import wizard |
34 | +import report |
35 | |
36 | === added file 'maintenance/__openerp__.py' |
37 | --- maintenance/__openerp__.py 1970-01-01 00:00:00 +0000 |
38 | +++ maintenance/__openerp__.py 2014-06-11 15:54:53 +0000 |
39 | @@ -0,0 +1,46 @@ |
40 | +# -*- encoding: utf-8 -*- |
41 | +########################################################################### |
42 | +# Module Writen to OpenERP, Open Source Management Solution |
43 | +# |
44 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
45 | +# All Rights Reserved. |
46 | +# info Vauxoo (info@vauxoo.com) |
47 | +############################################################################ |
48 | +# Coded by: Julio Serna(julio@vauxoo.com) |
49 | +############################################################################ |
50 | +# |
51 | +# This program is free software: you can redistribute it and/or modify |
52 | +# it under the terms of the GNU Affero General Public License as |
53 | +# published by the Free Software Foundation, either version 3 of the |
54 | +# License, or (at your option) any later version. |
55 | +# |
56 | +# This program is distributed in the hope that it will be useful, |
57 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
58 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
59 | +# GNU Affero General Public License for more details. |
60 | +# |
61 | +# You should have received a copy of the GNU Affero General Public License |
62 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
63 | +# |
64 | +############################################################################## |
65 | + |
66 | +{ |
67 | + "name" : "Maintenance", |
68 | + "version" : "1.0", |
69 | + "author" : "Tecnos", |
70 | + "category" : "Generic Modules/Maintenance", |
71 | + "website" : "", |
72 | + "description": """ |
73 | + Modulo de Mantenimientos para tractos |
74 | + """, |
75 | + "depends" : ["product","base","stock"], |
76 | + "init_xml" : [], |
77 | + "data_xml" : [], |
78 | + "demo_xml" : [], |
79 | + "update_xml" : [ |
80 | + "maintenance_wizard.xml", |
81 | + "maintenance_view.xml", |
82 | + "maintenance_report.xml"], |
83 | + "active": False, |
84 | + "installable": True |
85 | + } |
86 | |
87 | === added directory 'maintenance/i18n' |
88 | === added file 'maintenance/i18n/es.po' |
89 | --- maintenance/i18n/es.po 1970-01-01 00:00:00 +0000 |
90 | +++ maintenance/i18n/es.po 2014-06-11 15:54:53 +0000 |
91 | @@ -0,0 +1,771 @@ |
92 | +# Translation of OpenERP Server. |
93 | +# This file contains the translation of the following modules: |
94 | +# * maintenance |
95 | +# |
96 | +msgid "" |
97 | +msgstr "" |
98 | +"Project-Id-Version: OpenERP Server 6.1\n" |
99 | +"Report-Msgid-Bugs-To: \n" |
100 | +"POT-Creation-Date: 2014-06-10 14:13+0000\n" |
101 | +"PO-Revision-Date: 2014-06-10 14:13+0000\n" |
102 | +"Last-Translator: <>\n" |
103 | +"Language-Team: \n" |
104 | +"MIME-Version: 1.0\n" |
105 | +"Content-Type: text/plain; charset=UTF-8\n" |
106 | +"Content-Transfer-Encoding: \n" |
107 | +"Plural-Forms: \n" |
108 | + |
109 | +#. module: maintenance |
110 | +#: field:product.product,routing_available:0 |
111 | +msgid "Available" |
112 | +msgstr "Disponible" |
113 | + |
114 | +#. module: maintenance |
115 | +#: report:orden.dia:0 |
116 | +msgid "Tipo" |
117 | +msgstr "Tipo" |
118 | + |
119 | +#. module: maintenance |
120 | +#: view:maintenance.order.line:0 |
121 | +msgid "Group By..." |
122 | +msgstr "Agrupar Por..." |
123 | + |
124 | +#. module: maintenance |
125 | +#: model:ir.model,name:maintenance.model_tracto_modelo |
126 | +msgid "tracto.modelo" |
127 | +msgstr "tracto.modelo" |
128 | + |
129 | +#. module: maintenance |
130 | +#: model:ir.ui.menu,name:maintenance.menu_maintenance_update |
131 | +#: view:wizard.check.maintenance:0 |
132 | +msgid "Update Maintenances" |
133 | +msgstr "Actualizar mantenimientos" |
134 | + |
135 | +#. module: maintenance |
136 | +#: selection:maintenance.order.line,state:0 |
137 | +msgid "Finish" |
138 | +msgstr "Finalizado" |
139 | + |
140 | +#. module: maintenance |
141 | +#: view:maintenance.order.line:0 |
142 | +#: view:wizard.maintenance.start:0 |
143 | +msgid "Start" |
144 | +msgstr "Iniciar" |
145 | + |
146 | +#. module: maintenance |
147 | +#: view:maintenance.order.line:0 |
148 | +#: selection:maintenance.order.line,state:0 |
149 | +msgid "In Process" |
150 | +msgstr "En proceso" |
151 | + |
152 | +#. module: maintenance |
153 | +#: field:product.template,brand_id:0 |
154 | +msgid "Marca" |
155 | +msgstr "Marca" |
156 | + |
157 | +#. module: maintenance |
158 | +#: field:product.template,refaccion1:0 |
159 | +msgid "Refaccion 1" |
160 | +msgstr "Refaccion 1" |
161 | + |
162 | +#. module: maintenance |
163 | +#: model:ir.actions.report.xml,name:maintenance.orden_dia |
164 | +msgid "Orden del Dia" |
165 | +msgstr "Orden del Dia" |
166 | + |
167 | +#. module: maintenance |
168 | +#: selection:product.template,axle_type:0 |
169 | +msgid "Tracto 10 Llantas" |
170 | +msgstr "Tracto 10 Llantas" |
171 | + |
172 | +#. module: maintenance |
173 | +#: field:product.template,maintenance_id:0 |
174 | +msgid "Mantenimiento" |
175 | +msgstr "Mantenimiento" |
176 | + |
177 | +#. module: maintenance |
178 | +#: field:maintenance.bom.line,product_uom:0 |
179 | +#: field:maintenance.material.line,product_uom:0 |
180 | +msgid "UoM" |
181 | +msgstr "UdM" |
182 | + |
183 | +#. module: maintenance |
184 | +#: field:maintenance.bom,costo_total:0 |
185 | +msgid "Total Cost" |
186 | +msgstr "Costo total" |
187 | + |
188 | +#. module: maintenance |
189 | +#: view:wizard.maintenance.start:0 |
190 | +msgid "Indicate the date of completion of maintenance" |
191 | +msgstr "Indique la fecha de término del mantenimiento" |
192 | + |
193 | +#. module: maintenance |
194 | +#: view:maintenance.bom:0 |
195 | +#: field:maintenance.bom,notes:0 |
196 | +#: view:maintenance.order.line:0 |
197 | +msgid "Notes" |
198 | +msgstr "Notas" |
199 | + |
200 | +#. module: maintenance |
201 | +#: selection:product.template,axle_type:0 |
202 | +msgid "Tracto 6 Llantas" |
203 | +msgstr "Tracto 6 Llantas" |
204 | + |
205 | +#. module: maintenance |
206 | +#: selection:maintenance.order.line,type:0 |
207 | +msgid "Preventive" |
208 | +msgstr "Preventivo" |
209 | + |
210 | +#. module: maintenance |
211 | +#: selection:product.template,tire_state:0 |
212 | +msgid "Usada" |
213 | +msgstr "Usada" |
214 | + |
215 | +#. module: maintenance |
216 | +#: selection:maintenance.order.line,state:0 |
217 | +msgid "Reassigned" |
218 | +msgstr "Reasignado" |
219 | + |
220 | +#. module: maintenance |
221 | +#: view:product.product:0 |
222 | +msgid "Characteristics" |
223 | +msgstr "Características" |
224 | + |
225 | +#. module: maintenance |
226 | +#: code:addons/maintenance/maintenance.py:206 |
227 | +#: code:addons/maintenance/wizard/wizard_maintenance_cancel.py:41 |
228 | +#, python-format |
229 | +msgid "Warning!" |
230 | +msgstr "Advertencia!" |
231 | + |
232 | +#. module: maintenance |
233 | +#: report:orden.dia:0 |
234 | +msgid "Descripcion" |
235 | +msgstr "Descripcion" |
236 | + |
237 | +#. module: maintenance |
238 | +#: field:maintenance.material.line,line_id:0 |
239 | +msgid "Order Line" |
240 | +msgstr "Linea Orden" |
241 | + |
242 | +#. module: maintenance |
243 | +#: field:product.template,current_pos:0 |
244 | +msgid "Posicion Actual" |
245 | +msgstr "Posicion Actual" |
246 | + |
247 | +#. module: maintenance |
248 | +#: view:maintenance.bom:0 |
249 | +msgid "Order Line Maintenance" |
250 | +msgstr "Linea de orden del mantenimiento" |
251 | + |
252 | +#. module: maintenance |
253 | +#: field:product.template,front_left:0 |
254 | +msgid "Frente Izquierdo" |
255 | +msgstr "Frente Izquierdo" |
256 | + |
257 | +#. module: maintenance |
258 | +#: field:maintenance.order.line,priority:0 |
259 | +msgid "Priority" |
260 | +msgstr "Prioridad" |
261 | + |
262 | +#. module: maintenance |
263 | +#: view:maintenance.order.line:0 |
264 | +#: field:maintenance.order.line,state:0 |
265 | +msgid "State" |
266 | +msgstr "Estado" |
267 | + |
268 | +#. module: maintenance |
269 | +#: model:ir.model,name:maintenance.model_stock_picking |
270 | +msgid "Picking List" |
271 | +msgstr "Albarán" |
272 | + |
273 | +#. module: maintenance |
274 | +#: field:maintenance.order.line,warehouse_id:0 |
275 | +msgid "Warehouse" |
276 | +msgstr "Almacén" |
277 | + |
278 | +#. module: maintenance |
279 | +#: field:maintenance.bom,type:0 |
280 | +#: field:maintenance.order.line,type:0 |
281 | +#: field:product.template,axle_type:0 |
282 | +msgid "Type" |
283 | +msgstr "Tipo" |
284 | + |
285 | +#. module: maintenance |
286 | +#: view:maintenance.order.line:0 |
287 | +msgid "Maintenances in process" |
288 | +msgstr "Mantenimientos en proceso" |
289 | + |
290 | +#. module: maintenance |
291 | +#: selection:product.template,tire_type:0 |
292 | +msgid "Convencional" |
293 | +msgstr "Convencional" |
294 | + |
295 | +#. module: maintenance |
296 | +#: field:maintenance.order.line,costo:0 |
297 | +msgid "Total cost" |
298 | +msgstr "Costo total" |
299 | + |
300 | +#. module: maintenance |
301 | +#: field:maintenance.order.line,picking_ids:0 |
302 | +msgid "Transfers" |
303 | +msgstr "Translados" |
304 | + |
305 | +#. module: maintenance |
306 | +#: field:product.product,maintenance_ids:0 |
307 | +#: field:stock.picking,maintenance_id:0 |
308 | +msgid "Maintenance Program" |
309 | +msgstr "Programa de mantenimiento" |
310 | + |
311 | +#. module: maintenance |
312 | +#: model:ir.ui.menu,name:maintenance.menu_maintenance_configuration |
313 | +msgid "Configuration" |
314 | +msgstr "Configuración" |
315 | + |
316 | +#. module: maintenance |
317 | +#: field:product.template,size:0 |
318 | +msgid "Medida" |
319 | +msgstr "Medida" |
320 | + |
321 | +#. module: maintenance |
322 | +#: view:maintenance.bom:0 |
323 | +msgid "General Info." |
324 | +msgstr "Info. General" |
325 | + |
326 | +#. module: maintenance |
327 | +#: field:product.template,front_right:0 |
328 | +msgid "Frente Derecho" |
329 | +msgstr "Frente Derecho" |
330 | + |
331 | +#. module: maintenance |
332 | +#: field:product.template,talacha:0 |
333 | +msgid "Talachas" |
334 | +msgstr "Talachas" |
335 | + |
336 | +#. module: maintenance |
337 | +#: view:maintenance.order.line:0 |
338 | +#: field:maintenance.order.line,material_ids:0 |
339 | +msgid "Materials" |
340 | +msgstr "Materiales" |
341 | + |
342 | +#. module: maintenance |
343 | +#: view:wizard.maintenance.cancel:0 |
344 | +msgid "If you want reassign the maintenance, you must be indicate the date of compromise" |
345 | +msgstr "Si desea reasignar el mantenimiento debe indicar la fecha de compromiso" |
346 | + |
347 | +#. module: maintenance |
348 | +#: model:ir.actions.act_window,name:maintenance.action_wizard_update_maintenance |
349 | +#: model:ir.ui.menu,name:maintenance.menu_wizard_check_maintenance |
350 | +msgid "Update Maintenance" |
351 | +msgstr "Actualizar mantenimiento" |
352 | + |
353 | +#. module: maintenance |
354 | +#: field:product.template,rear2_left2:0 |
355 | +#: field:product.template,rear_left2:0 |
356 | +msgid "Izquierdo 2" |
357 | +msgstr "Izquierdo 2" |
358 | + |
359 | +#. module: maintenance |
360 | +#: selection:maintenance.order.line,type:0 |
361 | +msgid "Corrective" |
362 | +msgstr "Correctivo" |
363 | + |
364 | +#. module: maintenance |
365 | +#: model:ir.actions.act_window,name:maintenance.action_maintenance_order_line_form |
366 | +#: model:ir.ui.menu,name:maintenance.menu_maintenance_order_line |
367 | +#: model:ir.ui.menu,name:maintenance.menu_maintenance_order_line_all |
368 | +msgid "Maintenances" |
369 | +msgstr "Mantenimientos" |
370 | + |
371 | +#. module: maintenance |
372 | +#: view:product.product:0 |
373 | +#: field:product.template,product_image:0 |
374 | +msgid "Image" |
375 | +msgstr "Imagen" |
376 | + |
377 | +#. module: maintenance |
378 | +#: model:ir.model,name:maintenance.model_tire_brand |
379 | +msgid "tire.brand" |
380 | +msgstr "tire.brand" |
381 | + |
382 | +#. module: maintenance |
383 | +#: selection:maintenance.order.line,state:0 |
384 | +msgid "Canceled" |
385 | +msgstr "Cancelado" |
386 | + |
387 | +#. module: maintenance |
388 | +#: selection:product.template,tire_type:0 |
389 | +msgid "Direccional" |
390 | +msgstr "Direccional" |
391 | + |
392 | +#. module: maintenance |
393 | +#: model:ir.model,name:maintenance.model_wizard_maintenance_start |
394 | +msgid "wizard.maintenance.start" |
395 | +msgstr "wizard.maintenance.start" |
396 | + |
397 | +#. module: maintenance |
398 | +#: model:ir.model,name:maintenance.model_maintenance_bom_line |
399 | +msgid "maintenance.bom.line" |
400 | +msgstr "maintenance.bom.line" |
401 | + |
402 | +#. module: maintenance |
403 | +#: help:wizard.maintenance.cancel,date:0 |
404 | +msgid "Use this date when you want reassign this maintenance" |
405 | +msgstr "Utilice esta fecha cuando desee reasignar el mantenimiento" |
406 | + |
407 | +#. module: maintenance |
408 | +#: field:tire.history,date:0 |
409 | +msgid "Fecha" |
410 | +msgstr "Fecha" |
411 | + |
412 | +#. module: maintenance |
413 | +#: constraint:product.template:0 |
414 | +msgid "Error: The default UOM and the purchase UOM must be in the same category." |
415 | +msgstr "Error: La UdM por defecto y la UdM de compra deben estar en la misma categoría." |
416 | + |
417 | +#. module: maintenance |
418 | +#: field:product.template,history_ids:0 |
419 | +msgid "Historial" |
420 | +msgstr "Historial" |
421 | + |
422 | +#. module: maintenance |
423 | +#: field:product.template,refaccion2:0 |
424 | +msgid "Refaccion 2" |
425 | +msgstr "Refaccion 2" |
426 | + |
427 | +#. module: maintenance |
428 | +#: report:orden.dia:0 |
429 | +msgid "Reporte" |
430 | +msgstr "Reporte" |
431 | + |
432 | +#. module: maintenance |
433 | +#: view:maintenance.bom:0 |
434 | +msgid "Program" |
435 | +msgstr "Programa" |
436 | + |
437 | +#. module: maintenance |
438 | +#: selection:maintenance.order.line,state:0 |
439 | +msgid "Draft" |
440 | +msgstr "Borrador" |
441 | + |
442 | +#. module: maintenance |
443 | +#: view:wizard.check.maintenance:0 |
444 | +msgid "Click on Update below to start the process..." |
445 | +msgstr "Haga clic en actualizar para iniciar el proceso..." |
446 | + |
447 | +#. module: maintenance |
448 | +#: model:ir.ui.menu,name:maintenance.menu_maintenance_root |
449 | +#: view:maintenance.order.line:0 |
450 | +#: view:product.product:0 |
451 | +msgid "Maintenance" |
452 | +msgstr "Mantenimiento" |
453 | + |
454 | +#. module: maintenance |
455 | +#: field:maintenance.order.line,pendiente_id:0 |
456 | +msgid "Pending" |
457 | +msgstr "Pendiente" |
458 | + |
459 | +#. module: maintenance |
460 | +#: field:tire.history,tire_id:0 |
461 | +msgid "Tire" |
462 | +msgstr "Llanta" |
463 | + |
464 | +#. module: maintenance |
465 | +#: field:maintenance.bom.line,bom_id:0 |
466 | +#: field:maintenance.order.line,bom_id:0 |
467 | +#: field:tracto.modelo,line_ids:0 |
468 | +msgid "Maintenance List" |
469 | +msgstr "Lista de mantenimiento" |
470 | + |
471 | +#. module: maintenance |
472 | +#: field:product.template,rear2_right2:0 |
473 | +#: field:product.template,rear_right2:0 |
474 | +msgid "Derecho 2" |
475 | +msgstr "Derecho 2" |
476 | + |
477 | +#. module: maintenance |
478 | +#: field:product.template,model:0 |
479 | +#: field:product.template,modelo_id:0 |
480 | +msgid "Modelo" |
481 | +msgstr "Modelo" |
482 | + |
483 | +#. module: maintenance |
484 | +#: view:maintenance.bom:0 |
485 | +msgid "Maintenance Orders" |
486 | +msgstr "Ordenes de mantenimiento" |
487 | + |
488 | +#. module: maintenance |
489 | +#: field:maintenance.bom,active:0 |
490 | +msgid "Active" |
491 | +msgstr "Activo" |
492 | + |
493 | +#. module: maintenance |
494 | +#: field:product.template,rear2_left:0 |
495 | +#: field:product.template,rear_left:0 |
496 | +msgid "Izquierdo" |
497 | +msgstr "Izquierdo" |
498 | + |
499 | +#. module: maintenance |
500 | +#: field:product.template,tire_state:0 |
501 | +msgid "Estado" |
502 | +msgstr "Estado" |
503 | + |
504 | +#. module: maintenance |
505 | +#: field:product.template,recorrido:0 |
506 | +msgid "Recorrido" |
507 | +msgstr "Recorrido" |
508 | + |
509 | +#. module: maintenance |
510 | +#: view:maintenance.order.line:0 |
511 | +msgid "Mantenances" |
512 | +msgstr "Mantenimientos" |
513 | + |
514 | +#. module: maintenance |
515 | +#: report:orden.dia:0 |
516 | +msgid "Notas" |
517 | +msgstr "Notas" |
518 | + |
519 | +#. module: maintenance |
520 | +#: model:ir.actions.act_window,name:maintenance.action_maintenance_bom_form |
521 | +#: model:ir.ui.menu,name:maintenance.menu_action_maintenance_bom_form |
522 | +msgid "Maintenance BoM" |
523 | +msgstr "BoM Mantenimiento" |
524 | + |
525 | +#. module: maintenance |
526 | +#: field:maintenance.order.line,orden:0 |
527 | +msgid "Order Day" |
528 | +msgstr "Orden del día" |
529 | + |
530 | +#. module: maintenance |
531 | +#: field:product.template,maintenance_ids:0 |
532 | +msgid "Mantenimientos" |
533 | +msgstr "Mantenimientos" |
534 | + |
535 | +#. module: maintenance |
536 | +#: sql_constraint:stock.picking:0 |
537 | +msgid "Reference must be unique per Company!" |
538 | +msgstr "¡La referencia debe ser única por compañía!" |
539 | + |
540 | +#. module: maintenance |
541 | +#: view:wizard.maintenance.start:0 |
542 | +msgid "Start Maintenances" |
543 | +msgstr "Iniciar mantenimientos" |
544 | + |
545 | +#. module: maintenance |
546 | +#: model:ir.model,name:maintenance.model_wizard_maintenance_cancel |
547 | +msgid "wizard.maintenance.cancel" |
548 | +msgstr "wizard.maintenance.cancel" |
549 | + |
550 | +#. module: maintenance |
551 | +#: field:maintenance.bom,tiempo:0 |
552 | +msgid "Estimated Hours" |
553 | +msgstr "Horas estimadas" |
554 | + |
555 | +#. module: maintenance |
556 | +#: selection:product.template,tire_state:0 |
557 | +msgid "Original" |
558 | +msgstr "Original" |
559 | + |
560 | +#. module: maintenance |
561 | +#: field:maintenance.bom,type_qty:0 |
562 | +#: field:maintenance.bom.line,product_qty:0 |
563 | +#: field:maintenance.material.line,product_qty:0 |
564 | +msgid "Quantity" |
565 | +msgstr "Cantidad" |
566 | + |
567 | +#. module: maintenance |
568 | +#: view:maintenance.bom:0 |
569 | +msgid "Bill of Materials" |
570 | +msgstr "Lista de materiales" |
571 | + |
572 | +#. module: maintenance |
573 | +#: selection:product.template,axle_type:0 |
574 | +msgid "Caja 4 Llantas" |
575 | +msgstr "Caja 4 Llantas" |
576 | + |
577 | +#. module: maintenance |
578 | +#: field:maintenance.order.line,date_release:0 |
579 | +msgid "Date End" |
580 | +msgstr "Fecha fin" |
581 | + |
582 | +#. module: maintenance |
583 | +#: field:wizard.maintenance.cancel,date:0 |
584 | +msgid "Compromise date" |
585 | +msgstr "Fecha compromiso" |
586 | + |
587 | +#. module: maintenance |
588 | +#: code:addons/maintenance/maintenance.py:206 |
589 | +#, python-format |
590 | +msgid "The warehouse is required" |
591 | +msgstr "El almacén es requerido" |
592 | + |
593 | +#. module: maintenance |
594 | +#: field:maintenance.order.line,date_due:0 |
595 | +msgid "Date Compromise" |
596 | +msgstr "Fecha de compromiso" |
597 | + |
598 | +#. module: maintenance |
599 | +#: view:maintenance.order.line:0 |
600 | +#: view:wizard.check.maintenance:0 |
601 | +#: view:wizard.maintenance.start:0 |
602 | +msgid "Cancel" |
603 | +msgstr "Cancelar" |
604 | + |
605 | +#. module: maintenance |
606 | +#: view:wizard.maintenance.cancel:0 |
607 | +msgid "Close" |
608 | +msgstr "Cerrar" |
609 | + |
610 | +#. module: maintenance |
611 | +#: view:wizard.check.maintenance:0 |
612 | +msgid "This wizard search the products that need an maintenance, and create the maintenance." |
613 | +msgstr "Este asistente busca los productos que necesitan mantenimientos, y los crea." |
614 | + |
615 | +#. module: maintenance |
616 | +#: view:maintenance.order.line:0 |
617 | +msgid "Movements" |
618 | +msgstr "Movimientos" |
619 | + |
620 | +#. module: maintenance |
621 | +#: field:product.template,rear2_right:0 |
622 | +#: field:product.template,rear_right:0 |
623 | +msgid "Derecho" |
624 | +msgstr "Derecho" |
625 | + |
626 | +#. module: maintenance |
627 | +#: view:product.product:0 |
628 | +msgid "Codes" |
629 | +msgstr "Códigos" |
630 | + |
631 | +#. module: maintenance |
632 | +#: selection:product.template,tire_state:0 |
633 | +msgid "Renovada" |
634 | +msgstr "Renovada" |
635 | + |
636 | +#. module: maintenance |
637 | +#: selection:product.template,axle_type:0 |
638 | +msgid "Caja 8 Llantas" |
639 | +msgstr "Caja 8 Llantas" |
640 | + |
641 | +#. module: maintenance |
642 | +#: field:product.template,renew:0 |
643 | +msgid "Renovado" |
644 | +msgstr "Renovado" |
645 | + |
646 | +#. module: maintenance |
647 | +#: selection:product.template,tire_type:0 |
648 | +msgid "Traccion" |
649 | +msgstr "Traccion" |
650 | + |
651 | +#. module: maintenance |
652 | +#: report:orden.dia:0 |
653 | +msgid "ORDEN DE MANTENIMIENTO" |
654 | +msgstr "ORDEN DE MANTENIMIENTO" |
655 | + |
656 | +#. module: maintenance |
657 | +#: report:orden.dia:0 |
658 | +msgid "Compromiso" |
659 | +msgstr "Compromiso" |
660 | + |
661 | +#. module: maintenance |
662 | +#: model:ir.model,name:maintenance.model_product_product |
663 | +#: field:maintenance.bom.line,product_id:0 |
664 | +#: field:maintenance.material.line,product_id:0 |
665 | +#: view:maintenance.order.line:0 |
666 | +#: field:maintenance.order.line,product_id:0 |
667 | +msgid "Product" |
668 | +msgstr "Producto" |
669 | + |
670 | +#. module: maintenance |
671 | +#: field:maintenance.order.line,date_done:0 |
672 | +#: field:wizard.maintenance.start,date:0 |
673 | +msgid "Date Finished" |
674 | +msgstr "Fecha termino" |
675 | + |
676 | +#. module: maintenance |
677 | +#: field:maintenance.bom,name:0 |
678 | +#: field:maintenance.order.line,name:0 |
679 | +#: field:maintenance.order.line,notes:0 |
680 | +#: field:tracto.modelo,description:0 |
681 | +msgid "Description" |
682 | +msgstr "Descripción" |
683 | + |
684 | +#. module: maintenance |
685 | +#: model:ir.model,name:maintenance.model_maintenance_order_line |
686 | +msgid "maintenance.order.line" |
687 | +msgstr "maintenance.order.line" |
688 | + |
689 | +#. module: maintenance |
690 | +#: model:ir.model,name:maintenance.model_tire_history |
691 | +msgid "tire.history" |
692 | +msgstr "tire.history" |
693 | + |
694 | +#. module: maintenance |
695 | +#: model:ir.model,name:maintenance.model_maintenance_material_line |
696 | +msgid "maintenance.material.line" |
697 | +msgstr "maintenance.material.line" |
698 | + |
699 | +#. module: maintenance |
700 | +#: field:product.template,capas:0 |
701 | +msgid "Numero de Capas" |
702 | +msgstr "Numero de Capas" |
703 | + |
704 | +#. module: maintenance |
705 | +#: view:maintenance.order.line:0 |
706 | +msgid "Finished" |
707 | +msgstr "Terminado" |
708 | + |
709 | +#. module: maintenance |
710 | +#: field:maintenance.bom.line,costo:0 |
711 | +#: field:maintenance.material.line,costo:0 |
712 | +msgid "Cost" |
713 | +msgstr "Costo" |
714 | + |
715 | +#. module: maintenance |
716 | +#: model:ir.model,name:maintenance.model_wizard_check_maintenance |
717 | +msgid "wizard.check.maintenance" |
718 | +msgstr "wizard.check.maintenance" |
719 | + |
720 | +#. module: maintenance |
721 | +#: code:addons/maintenance/wizard/wizard_maintenance_cancel.py:41 |
722 | +#, python-format |
723 | +msgid "You must be set a date" |
724 | +msgstr "Debes indicar una fecha" |
725 | + |
726 | +#. module: maintenance |
727 | +#: model:ir.actions.act_window,name:maintenance.action_wizard_start_maintenance |
728 | +msgid "Start Maintenance" |
729 | +msgstr "Iniciar mantenimiento" |
730 | + |
731 | +#. module: maintenance |
732 | +#: field:tire.brand,name:0 |
733 | +#: field:tire.size,name:0 |
734 | +msgid "nombre" |
735 | +msgstr "nombre" |
736 | + |
737 | +#. module: maintenance |
738 | +#: selection:product.template,tire_state:0 |
739 | +msgid "Nueva" |
740 | +msgstr "Nueva" |
741 | + |
742 | +#. module: maintenance |
743 | +#: field:maintenance.order.line,date:0 |
744 | +msgid "Report Date" |
745 | +msgstr "Fecha reporte" |
746 | + |
747 | +#. module: maintenance |
748 | +#: report:orden.dia:0 |
749 | +#: field:tire.history,tracto_id:0 |
750 | +msgid "Tracto/Caja" |
751 | +msgstr "Tracto/Caja" |
752 | + |
753 | +#. module: maintenance |
754 | +#: field:maintenance.order.line,distance:0 |
755 | +#: field:product.product,distance:0 |
756 | +msgid "Distance" |
757 | +msgstr "Distancia" |
758 | + |
759 | +#. module: maintenance |
760 | +#: view:product.product:0 |
761 | +msgid "Name" |
762 | +msgstr "Nombre" |
763 | + |
764 | +#. module: maintenance |
765 | +#: field:product.template,profundidad:0 |
766 | +msgid "Profundidad" |
767 | +msgstr "Profundidad" |
768 | + |
769 | +#. module: maintenance |
770 | +#: field:product.template,date_tire:0 |
771 | +msgid "Fecha Revision" |
772 | +msgstr "Fecha Revision" |
773 | + |
774 | +#. module: maintenance |
775 | +#: field:maintenance.bom,line_ids:0 |
776 | +msgid "Lines" |
777 | +msgstr "Lineas" |
778 | + |
779 | +#. module: maintenance |
780 | +#: report:orden.dia:0 |
781 | +msgid "Costo" |
782 | +msgstr "Costo" |
783 | + |
784 | +#. module: maintenance |
785 | +#: model:ir.model,name:maintenance.model_product_template |
786 | +msgid "Product Template" |
787 | +msgstr "Plantilla de producto" |
788 | + |
789 | +#. module: maintenance |
790 | +#: model:ir.model,name:maintenance.model_maintenance_bom |
791 | +msgid "maintenance.bom" |
792 | +msgstr "maintenance.bom" |
793 | + |
794 | +#. module: maintenance |
795 | +#: selection:product.template,tire_type:0 |
796 | +msgid "Radial" |
797 | +msgstr "Radial" |
798 | + |
799 | +#. module: maintenance |
800 | +#: view:wizard.maintenance.cancel:0 |
801 | +msgid "Reassign" |
802 | +msgstr "Reasignar" |
803 | + |
804 | +#. module: maintenance |
805 | +#: model:ir.actions.act_window,name:maintenance.action_tracto_modelo_form |
806 | +#: model:ir.ui.menu,name:maintenance.menu_action_tracto_modelo_form |
807 | +#: field:maintenance.bom,modelo_id:0 |
808 | +#: field:maintenance.order.line,modelo_id:0 |
809 | +#: field:product.product,modelo_id:0 |
810 | +#: view:tracto.modelo:0 |
811 | +#: field:tracto.modelo,name:0 |
812 | +msgid "Model" |
813 | +msgstr "Modelo" |
814 | + |
815 | +#. module: maintenance |
816 | +#: field:product.template,distance:0 |
817 | +#: field:tire.history,distance:0 |
818 | +msgid "Kilometraje" |
819 | +msgstr "Kilometraje" |
820 | + |
821 | +#. module: maintenance |
822 | +#: view:wizard.check.maintenance:0 |
823 | +msgid "Update" |
824 | +msgstr "Actualizar" |
825 | + |
826 | +#. module: maintenance |
827 | +#: model:ir.model,name:maintenance.model_tire_size |
828 | +msgid "tire.size" |
829 | +msgstr "tire.size" |
830 | + |
831 | +#. module: maintenance |
832 | +#: constraint:product.product:0 |
833 | +msgid "Error: Invalid ean code" |
834 | +msgstr "Error: Código EAN erróneo" |
835 | + |
836 | +#. module: maintenance |
837 | +#: view:maintenance.order.line:0 |
838 | +msgid "Calculate Materials" |
839 | +msgstr "Calcular materiales" |
840 | + |
841 | +#. module: maintenance |
842 | +#: field:tire.history,position:0 |
843 | +msgid "Posicion" |
844 | +msgstr "Posicion" |
845 | + |
846 | +#. module: maintenance |
847 | +#: model:ir.actions.act_window,name:maintenance.action_wizard_cancel_maintenance |
848 | +#: view:wizard.maintenance.cancel:0 |
849 | +msgid "Cancel Maintenance" |
850 | +msgstr "Cancelar mantenimiento" |
851 | + |
852 | +#. module: maintenance |
853 | +#: field:maintenance.bom.line,total:0 |
854 | +#: field:maintenance.material.line,total:0 |
855 | +msgid "Total" |
856 | +msgstr "Total" |
857 | + |
858 | +#. module: maintenance |
859 | +#: field:product.template,tire_type:0 |
860 | +msgid "Tipo de Piso" |
861 | +msgstr "Tipo de Piso" |
862 | + |
863 | |
864 | === added directory 'maintenance/images' |
865 | === added file 'maintenance/images/knowledge-hover.png' |
866 | Binary files maintenance/images/knowledge-hover.png 1970-01-01 00:00:00 +0000 and maintenance/images/knowledge-hover.png 2014-06-11 15:54:53 +0000 differ |
867 | === added file 'maintenance/images/knowledge.png' |
868 | Binary files maintenance/images/knowledge.png 1970-01-01 00:00:00 +0000 and maintenance/images/knowledge.png 2014-06-11 15:54:53 +0000 differ |
869 | === added file 'maintenance/maintenance.py' |
870 | --- maintenance/maintenance.py 1970-01-01 00:00:00 +0000 |
871 | +++ maintenance/maintenance.py 2014-06-11 15:54:53 +0000 |
872 | @@ -0,0 +1,334 @@ |
873 | +# -*- encoding: utf-8 -*- |
874 | +########################################################################### |
875 | +# Module Writen to OpenERP, Open Source Management Solution |
876 | +# |
877 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
878 | +# All Rights Reserved. |
879 | +# info Vauxoo (info@vauxoo.com) |
880 | +############################################################################ |
881 | +# Coded by: Julio Serna(julio@vauxoo.com) |
882 | +############################################################################ |
883 | +# |
884 | +# This program is free software: you can redistribute it and/or modify |
885 | +# it under the terms of the GNU Affero General Public License as |
886 | +# published by the Free Software Foundation, either version 3 of the |
887 | +# License, or (at your option) any later version. |
888 | +# |
889 | +# This program is distributed in the hope that it will be useful, |
890 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
891 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
892 | +# GNU Affero General Public License for more details. |
893 | +# |
894 | +# You should have received a copy of the GNU Affero General Public License |
895 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
896 | +# |
897 | +############################################################################## |
898 | +from osv import fields |
899 | +from osv import osv |
900 | +import time |
901 | +import os |
902 | +from mx.DateTime import * |
903 | +import netsvc |
904 | +from tools.translate import _ |
905 | + |
906 | +class tracto_modelo(osv.osv): |
907 | + _name = 'tracto.modelo' |
908 | + |
909 | + _columns = { |
910 | + 'name': fields.char('Model', size=64, required=True), |
911 | + 'description': fields.char('Description', size=64), |
912 | + 'line_ids': fields.one2many('maintenance.bom', 'modelo_id', 'Maintenance List') |
913 | + } |
914 | + |
915 | +tracto_modelo() |
916 | + |
917 | +class product_product(osv.osv): |
918 | + _inherit = 'product.product' |
919 | + |
920 | + _columns = { |
921 | + 'modelo_id': fields.many2one('tracto.modelo', 'Model'), |
922 | + 'distance': fields.float('Distance'), |
923 | + 'maintenance_ids': fields.one2many('maintenance.order.line', 'product_id', 'Maintenance Program') |
924 | + } |
925 | + |
926 | +product_product() |
927 | + |
928 | +class maintenance_bom(osv.osv): |
929 | + _name = 'maintenance.bom' |
930 | + |
931 | + def _get_costo(self, cr, uid, ids, name, args, context): |
932 | + res = {} |
933 | + for bom in self.browse(cr, uid, ids): |
934 | + res[bom.id] = 0 |
935 | + for line in bom.line_ids: |
936 | + res[bom.id] += (line.costo*line.product_qty) |
937 | + return res |
938 | + |
939 | + def _type_maintenance_bom(self, cr, uid, ids=None, context=None): |
940 | + if context is None: |
941 | + context = {} |
942 | + types = [('week','Semanas'), |
943 | + ('mes', 'Meses'), |
944 | + ('km', 'KM')] |
945 | + return types |
946 | + |
947 | + _columns = { |
948 | + 'name': fields.char('Description', size=128, required=True), |
949 | + 'modelo_id': fields.many2one('tracto.modelo', 'Model'), |
950 | + 'line_ids': fields.one2many('maintenance.bom.line', 'bom_id', 'Lines'), |
951 | + 'notes': fields.text('Notes'), |
952 | + 'tiempo': fields.float('Estimated Hours'), |
953 | + 'costo_total': fields.function(_get_costo, method=True, type='float', string='Total Cost'), |
954 | + 'type': fields.selection(_type_maintenance_bom, 'Type'), |
955 | + 'type_qty': fields.integer('Quantity'), |
956 | + 'active': fields.boolean('Active') |
957 | + } |
958 | + |
959 | + _defaults = { |
960 | + 'active': lambda *a: True, |
961 | + } |
962 | + |
963 | +maintenance_bom() |
964 | + |
965 | +class maintenance_bom_line(osv.osv): |
966 | + _name = 'maintenance.bom.line' |
967 | + |
968 | + def _get_total(self, cr, uid, ids, name, args, context): |
969 | + query = """SELECT mbl.id, product_qty*costo FROM maintenance_bom_line mbl WHERE id IN (%s)"""%",".join(map(str, ids)) |
970 | + cr.execute(query) |
971 | + res = dict(cr.fetchall()) |
972 | + for id in ids: |
973 | + res.setdefault(id, 0.0) |
974 | + return res |
975 | + |
976 | + _rec_name = 'product_id' |
977 | + |
978 | + _columns = { |
979 | + 'product_id': fields.many2one('product.product', 'Product', required=True, domain = [('type','=','product')]), |
980 | + 'product_qty': fields.float('Quantity', required=True), |
981 | + 'costo': fields.float('Cost'), |
982 | + 'total': fields.function(_get_total, method=True, type='float', string="Total"), |
983 | + 'bom_id': fields.many2one('maintenance.bom', 'Maintenance List', ondelete='cascade', select=True), |
984 | + 'product_uom': fields.many2one('product.uom', 'UoM', required=True), |
985 | + } |
986 | + |
987 | + def onchange_product(self, cr, uid, ids, product_id): |
988 | + if not product_id: |
989 | + return {'value':{'product_uom':False, 'costo':0}} |
990 | + product = self.pool.get('product.product').browse(cr, uid, product_id) |
991 | + return {'value':{'product_uom':product.uom_id.id, 'name': product.name, 'costo':product.standard_price}} |
992 | + |
993 | +maintenance_bom_line() |
994 | + |
995 | +class maintenance_order_line(osv.osv): |
996 | + _name = 'maintenance.order.line' |
997 | + |
998 | + def create(self, cr, uid, vals, context={}): |
999 | + query = "SELECT COALESCE(MAX(orden)+1, 1) FROM maintenance_order_line WHERE date = '%s'"%vals['date'] |
1000 | + cr.execute(query) |
1001 | + res = cr.fetchone()[0] |
1002 | + vals['orden'] = res |
1003 | + return super(maintenance_order_line, self).create(cr, uid, vals, context) |
1004 | + |
1005 | + def write(self, cr, uid, ids, vals, context=None): |
1006 | + if vals.has_key('date'): |
1007 | + query = "SELECT COALESCE(MAX(orden)+1, 1) FROM maintenance_order_line WHERE date = '%s'"%vals['date'] |
1008 | + cr.execute(query) |
1009 | + res = cr.fetchone()[0] |
1010 | + vals['orden'] = res |
1011 | + return super(maintenance_order_line, self).write(cr, uid, ids, vals, context) |
1012 | + |
1013 | + def _get_costo(self, cr, uid, ids, name, args, context): |
1014 | + res = {} |
1015 | + for order in self.browse(cr, uid, ids): |
1016 | + res[order.id] = 0 |
1017 | + for line in order.material_ids: |
1018 | + res[order.id] += line.total |
1019 | + return res |
1020 | + |
1021 | + _columns = { |
1022 | + 'name': fields.char('Description', size=128, required=True, readonly=True, states={'draft':[('readonly', False)]}), |
1023 | + 'orden': fields.integer('Order Day', readonly=True), |
1024 | + 'product_id': fields.many2one('product.product', 'Product', required=True, readonly=True, states={'draft':[('readonly', False)]}), |
1025 | + 'bom_id': fields.many2one('maintenance.bom', 'Maintenance List', readonly=True, states={'draft':[('readonly', False)]}), |
1026 | + 'priority': fields.integer('Priority'), |
1027 | + 'date':fields.date('Report Date', required=True, readonly=True, states={'draft':[('readonly', False)]}), |
1028 | + 'date_done':fields.date('Date Finished', readonly=True), |
1029 | + 'date_due': fields.date('Date Compromise', readonly=True), |
1030 | + 'date_release': fields.datetime('Date End'), |
1031 | + 'notes': fields.text('Description'), |
1032 | + 'costo': fields.function(_get_costo, method=True, type='float', string='Total cost'), |
1033 | + 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'), |
1034 | + 'picking_ids': fields.one2many('stock.picking', 'maintenance_id', 'Transfers'), |
1035 | + 'type':fields.selection([ |
1036 | + ('correctivo','Corrective'), |
1037 | + ('preventivo','Preventive'), ], 'Type'), |
1038 | + 'state':fields.selection([ |
1039 | + ('draft','Draft'), |
1040 | + ('done','Finish'), |
1041 | + ('cancel', 'Canceled'), |
1042 | + ('in_progress','In Process'), |
1043 | + ('reassigned','Reassigned')], 'State', readonly=True), |
1044 | + 'material_ids': fields.one2many('maintenance.material.line', 'line_id', 'Materials'), |
1045 | + 'modelo_id': fields.many2one('tracto.modelo', 'Model'), |
1046 | + 'pendiente_id': fields.many2one('maintenance.order.line', 'Pending', readonly=True), |
1047 | + 'distance': fields.float('Distance', required=True, readonly=False, states={'draft':[('readonly', False)]}), |
1048 | + } |
1049 | + |
1050 | + _defaults = { |
1051 | + 'state': lambda *a: 'draft', |
1052 | + 'date': lambda *a: time.strftime('%Y-%m-%d'), |
1053 | + 'type': lambda *a: 'preventivo', |
1054 | + } |
1055 | + |
1056 | + def action_start(self, cr, uid, ids, ctx={}): |
1057 | + self.write(cr, uid, ids, {'state':'in_progress'}) |
1058 | + return True |
1059 | + |
1060 | + def onchange_bom(self, cr, uid, ids, bom_id): |
1061 | + if not bom_id: |
1062 | + return {'value':{}} |
1063 | + bom = self.pool.get('maintenance.bom').browse(cr, uid, bom_id) |
1064 | + return {'value':{'name':bom.name}} |
1065 | + |
1066 | + def onchange_product(self, cr, uid, ids, product_id): |
1067 | + if not product_id: |
1068 | + return {'value':{'modelo_id':False, 'bom_id':False}} |
1069 | + product = self.pool.get('product.product').browse(cr, uid, product_id) |
1070 | + return {'value':{'modelo_id':product.modelo_id and product.modelo_id.id or False, 'distance':product.distance}} |
1071 | + |
1072 | + def action_done(self, cr, uid, ids, context={}): |
1073 | + self.write(cr, uid, ids, {'state':'done', 'date_done':time.strftime('%Y-%m-%d')}) |
1074 | + picking_obj = self.pool.get('stock.picking') |
1075 | + picking_id = False |
1076 | + for maintenance in self.browse(cr, uid, ids): |
1077 | + if not maintenance.warehouse_id: |
1078 | + raise osv.except_osv(_('Warning!'), _('The warehouse is required')) |
1079 | + self.write(cr, uid, maintenance.id, {'distance':maintenance.product_id.distance}) |
1080 | + if maintenance.material_ids: |
1081 | + picking_id = picking_obj.create(cr, uid, { |
1082 | + 'origin': 'MA:%s'%maintenance.name, |
1083 | + 'type': 'internal', |
1084 | + 'move_type': 'one', |
1085 | + 'state': 'assigned', |
1086 | + 'maintenance_id': maintenance.id, |
1087 | + 'auto_picking': False,}) |
1088 | + for line in maintenance.material_ids: |
1089 | + self.pool.get('stock.move').create(cr, uid, { |
1090 | + 'name':'%s'%line.product_id.name, |
1091 | + 'picking_id':picking_id, |
1092 | + 'product_id': line.product_id.id, |
1093 | + 'product_qty': line.product_qty, |
1094 | + 'product_uom': line.product_id.uom_id.id, |
1095 | + 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'), |
1096 | + 'location_id': maintenance.warehouse_id and \ |
1097 | + maintenance.warehouse_id.lot_stock_id and \ |
1098 | + maintenance.warehouse_id.lot_stock_id.id or False, |
1099 | + 'location_dest_id': maintenance.warehouse_id and\ |
1100 | + maintenance.warehouse_id.lot_output_id and\ |
1101 | + maintenance.warehouse_id.lot_output_id.id or False, |
1102 | + 'state': 'draft',}) |
1103 | + if picking_id: |
1104 | + picking_obj.draft_validate(cr, uid, [picking_id], context=context) |
1105 | + return True |
1106 | + |
1107 | + def action_cancel(self, cr, uid, ids, ctx={}): |
1108 | + self.write(cr, uid, ids, {'state':'cancel'}) |
1109 | + return True |
1110 | + |
1111 | + def action_draft(self, cr, uid, ids, ctx={}): |
1112 | + self.write(cr, uid, ids, {'state':'draft'}) |
1113 | + return True |
1114 | + |
1115 | + def action_calcular(self, cr, uid, ids, ctx={}): |
1116 | + for order in self.browse(cr, uid, ids): |
1117 | + if order.bom_id: |
1118 | + self.pool.get('maintenance.material.line').unlink(cr, uid, map(lambda x: x.id, order.material_ids)) |
1119 | + for line in order.bom_id.line_ids: |
1120 | + self.pool.get('maintenance.material.line').create(cr, uid, { |
1121 | + 'product_id': line.product_id.id, |
1122 | + 'line_id': order.id, |
1123 | + 'product_qty': line.product_qty, |
1124 | + 'product_uom': line.product_uom.id, |
1125 | + 'costo': line.costo, |
1126 | + }) |
1127 | + return True |
1128 | + |
1129 | + def _check_maintenance(self, cr, uid, ids, context=None): |
1130 | + product_obj = self.pool.get('product.product') |
1131 | + tracto_ids = product_obj.search(cr, uid, [('modelo_id', '!=', False)]) |
1132 | + mol_ids = [] |
1133 | + for tracto in product_obj.browse(cr, uid, tracto_ids): |
1134 | + for bom in tracto.modelo_id.line_ids: |
1135 | + crear = False |
1136 | + res = self.search(cr, uid, [('product_id', '=', tracto.id), ('bom_id', '=', bom.id), ('state', '!=', 'cancel')]) |
1137 | + if not res and bom.type != '' and ( (bom.type == 'km' and tracto.distance > bom.type_qty) or bom.type != 'km'): |
1138 | + crear = True |
1139 | + else: |
1140 | + query = """SELECT CASE WHEN mb.type = 'km' THEN (pp.distance - MAX(mol.distance)) > type_qty |
1141 | + WHEN mb.type = 'mes' THEN now() > MAX(date_done)+(type_qty||'months')::interval |
1142 | + WHEN mb.type = 'mes' THEN now() > MAX(date_done)+(type_qty||'weeks')::interval |
1143 | + ELSE False END as diferencia |
1144 | + FROM maintenance_order_line mol |
1145 | + JOIN maintenance_bom mb ON mol.bom_id = mb.id |
1146 | + JOIN product_product pp ON pp.id = mol.product_id |
1147 | + JOIN product_template pt ON pt.id = pp.product_tmpl_id |
1148 | + WHERE product_id = %s AND mb.active = True AND mb.id = %s AND mol.state IN ('done', 'in_progress', 'draft') |
1149 | + GROUP BY bom_id, mb.type, mb.type_qty, pp.distance"""%(tracto.id, bom.id) |
1150 | + cr.execute(query) |
1151 | + res = cr.dictfetchall() |
1152 | + for result in res: |
1153 | + if result['diferencia']: |
1154 | + crear = True |
1155 | + if crear: |
1156 | + mol_id = self.pool.get('maintenance.order.line').create(cr, uid, { |
1157 | + 'name': bom.name, |
1158 | + 'product_id':tracto.id, |
1159 | + 'bom_id':bom.id, |
1160 | + 'date': time.strftime('%Y-%m-%d'), |
1161 | + 'modelo_id': tracto.modelo_id.id, |
1162 | + 'distance': tracto.distance}) |
1163 | + mol_ids.append(mol_id) |
1164 | + return mol_ids |
1165 | + |
1166 | +maintenance_order_line() |
1167 | + |
1168 | +class stock_picking(osv.osv): |
1169 | + _inherit = 'stock.picking' |
1170 | + |
1171 | + _columns = { |
1172 | + 'maintenance_id': fields.many2one('maintenance.order.line', 'Maintenance Program', readonly=True), |
1173 | + } |
1174 | + |
1175 | +stock_picking() |
1176 | + |
1177 | +class maintenance_material_line(osv.osv): |
1178 | + _name = 'maintenance.material.line' |
1179 | + _description = 'maintenance.material.line' |
1180 | + |
1181 | + def _get_total(self, cr, uid, ids, name, args, context): |
1182 | + query = """SELECT mml.id, product_qty*costo FROM maintenance_material_line mml WHERE id IN (%s)"""%",".join(map(str, ids)) |
1183 | + cr.execute(query) |
1184 | + res = dict(cr.fetchall()) |
1185 | + for id in ids: |
1186 | + res.setdefault(id, 0.0) |
1187 | + return res |
1188 | + |
1189 | + _rec_name = 'product_id' |
1190 | + |
1191 | + _columns = { |
1192 | + 'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '!=', 'service')]), |
1193 | + 'line_id': fields.many2one('maintenance.order.line', 'Order Line'), |
1194 | + 'product_qty': fields.float('Quantity'), |
1195 | + 'costo': fields.float('Cost'), |
1196 | + 'total': fields.function(_get_total, method=True, type='float', string="Total"), |
1197 | + 'product_uom': fields.many2one('product.uom', 'UoM'), |
1198 | + } |
1199 | + |
1200 | + def onchange_product(self, cr, uid, ids, product_id): |
1201 | + if not product_id: |
1202 | + return {'value':{'product_uom':False, 'costo':0}} |
1203 | + product = self.pool.get('product.product').browse(cr, uid, product_id) |
1204 | + return {'value':{'product_uom':product.uom_id.id, 'name': product.name, 'costo':product.standard_price}} |
1205 | + |
1206 | +maintenance_material_line() |
1207 | |
1208 | === added file 'maintenance/maintenance_report.xml' |
1209 | --- maintenance/maintenance_report.xml 1970-01-01 00:00:00 +0000 |
1210 | +++ maintenance/maintenance_report.xml 2014-06-11 15:54:53 +0000 |
1211 | @@ -0,0 +1,12 @@ |
1212 | +<?xml version="1.0" encoding="utf-8"?> |
1213 | +<openerp> |
1214 | + <data> |
1215 | + |
1216 | + <report id="orden_dia" |
1217 | + name="orden.dia" |
1218 | + string="Orden del Dia" |
1219 | + model="maintenance.order.line" |
1220 | + rml="maintenance/report/orden_dia.rml" |
1221 | + auto="True"/> |
1222 | + </data> |
1223 | +</openerp> |
1224 | |
1225 | === added file 'maintenance/maintenance_view.xml' |
1226 | --- maintenance/maintenance_view.xml 1970-01-01 00:00:00 +0000 |
1227 | +++ maintenance/maintenance_view.xml 2014-06-11 15:54:53 +0000 |
1228 | @@ -0,0 +1,271 @@ |
1229 | +<?xml version="1.0" encoding="utf-8"?> |
1230 | +<openerp> |
1231 | + <data> |
1232 | + <menuitem icon="terp-sale" id="menu_maintenance_root" name="Maintenance"/> |
1233 | + <menuitem id="menu_maintenance_configuration" name="Configuration" parent="menu_maintenance_root" sequence="1"/> |
1234 | + |
1235 | + <record id="view_maintenance_order_line_form" model="ir.ui.view"> |
1236 | + <field name="name">maintenance.order.line.form</field> |
1237 | + <field name="model">maintenance.order.line</field> |
1238 | + <field name="type">form</field> |
1239 | + <field name="arch" type="xml"> |
1240 | + <form string="Maintenance"> |
1241 | + <group col="4" colspan="4"> |
1242 | + <field name="product_id" select="1" on_change="onchange_product(product_id)"/> |
1243 | + <field name="distance" select="1" on_change="onchange_product(product_id)"/> |
1244 | + <field name="bom_id" on_change="onchange_bom(bom_id)" domain="[('modelo_id', 'in', [False, modelo_id])]"/> |
1245 | + <field name="name" select="2"/> |
1246 | + <field name="orden"/> |
1247 | + <field name="priority"/> |
1248 | + <field name="type" select="1"/> |
1249 | + <field name="date" select="1"/> |
1250 | + <field name="date_done" select="2"/> |
1251 | + <field name="date_due"/> |
1252 | + <field name="costo"/> |
1253 | + <field name="date_release" attrs="{'readonly':[('state','!=','in_progress')], 'required':[('state','=','in_progress')]}"/> |
1254 | + <field name="modelo_id" invisible="1"/> |
1255 | + </group> |
1256 | + <notebook colspan="4"> |
1257 | + <page string="Materials"> |
1258 | + <field name="material_ids" colspan="4" nolabel="1"> |
1259 | + <tree string="Materials"> |
1260 | + <field name="product_id"/> |
1261 | + <field name="product_qty"/> |
1262 | + <field name="costo"/> |
1263 | + <field name="total"/> |
1264 | + <field name="product_uom"/> |
1265 | + </tree> |
1266 | + <form string="Materials"> |
1267 | + <field name="product_id" on_change="onchange_product(product_id)"/> |
1268 | + <field name="product_uom" invisible="1"/> |
1269 | + <field name="product_qty"/> |
1270 | + <field name="costo" invisible="1"/> |
1271 | + <field name="total"/> |
1272 | + </form> |
1273 | + </field> |
1274 | + <field name="state" select="1"/> |
1275 | + <group col="10" colspan="2"> |
1276 | + <button name="action_calcular" states="draft" string="Calculate Materials" type="object" icon="gtk-ok"/> |
1277 | + <button name="%(action_wizard_start_maintenance)d" states="draft" string="Start" type="action" icon="gtk-apply"/> |
1278 | + <button name="action_done" states="in_progress" string="Finished" type="object" icon="gtk-apply"/> |
1279 | + <button name="%(action_wizard_cancel_maintenance)d" states="draft,in_progress" string="Cancel" type="action" icon="gtk-stop"/> |
1280 | + <!--button name="action_draft" states="done" string="Borrador" type="object"/--> |
1281 | + </group> |
1282 | + </page> |
1283 | + <page string="Movements"> |
1284 | + <field name="warehouse_id" attrs="{'required':[('state','in',['in_progress','done'])]}"/> |
1285 | + <field name="pendiente_id"/> |
1286 | + <field name="picking_ids" colspan="4" nolabel="1"/> |
1287 | + </page> |
1288 | + <page string="Notes"> |
1289 | + <field name="notes" colspan="4" nolabel="1"/> |
1290 | + </page> |
1291 | + </notebook> |
1292 | + </form> |
1293 | + </field> |
1294 | + </record> |
1295 | + |
1296 | + <record id="view_maintenance_order_line_tree" model="ir.ui.view"> |
1297 | + <field name="name">maintenance.order.line.tree</field> |
1298 | + <field name="model">maintenance.order.line</field> |
1299 | + <field name="type">tree</field> |
1300 | + <field name="arch" type="xml"> |
1301 | + <tree colors="grey:state == 'cancel';" string="Maintenance"> |
1302 | + <field name="product_id"/> |
1303 | + <field name="distance"/> |
1304 | + <field name="name"/> |
1305 | + <field name="orden"/> |
1306 | + <field name="priority"/> |
1307 | + <field name="type"/> |
1308 | + <field name="state"/> |
1309 | + <field name="date"/> |
1310 | + <field name="date_done"/> |
1311 | + <field name="date_due"/> |
1312 | + <field name="date_release"/> |
1313 | + <field name="costo"/> |
1314 | + </tree> |
1315 | + </field> |
1316 | + </record> |
1317 | + |
1318 | + <record id="view_maintenance_order_line_search" model="ir.ui.view"> |
1319 | + <field name="name">view.maintenance.order.line.search</field> |
1320 | + <field name="model">maintenance.order.line</field> |
1321 | + <field name="type">search</field> |
1322 | + <field name="arch" type="xml"> |
1323 | + <search string="Mantenances"> |
1324 | + <group> |
1325 | + <filter icon="terp-check" name="in_process" string="In Process" domain="[('state','=','in_progress')]" help="Maintenances in process"/> |
1326 | + </group> |
1327 | + <newline/> |
1328 | + <group expand="0" string="Group By..."> |
1329 | + <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> |
1330 | + <separator orientation="vertical" /> |
1331 | + <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/> |
1332 | + </group> |
1333 | + </search> |
1334 | + |
1335 | + </field> |
1336 | + </record> |
1337 | + |
1338 | + <!-- Todos --> |
1339 | + <record id="action_maintenance_order_line_form" model="ir.actions.act_window"> |
1340 | + <field name="name">Maintenances</field> |
1341 | + <field name="type">ir.actions.act_window</field> |
1342 | + <field name="res_model">maintenance.order.line</field> |
1343 | + <field name="view_type">form</field> |
1344 | + <field name="view_mode">tree,form,search</field> |
1345 | + <field name="domain">[]</field> |
1346 | + </record> |
1347 | + <menuitem id="menu_maintenance_order_line" parent="menu_maintenance_root"/> |
1348 | + <menuitem action="action_maintenance_order_line_form" id="menu_maintenance_order_line_all" parent="menu_maintenance_order_line"/> |
1349 | + |
1350 | + <!-- BoM's--> |
1351 | + <record id="view_maintenance_bom_form" model="ir.ui.view"> |
1352 | + <field name="name">maintenance.bom.form</field> |
1353 | + <field name="model">maintenance.bom</field> |
1354 | + <field name="type">form</field> |
1355 | + <field name="arch" type="xml"> |
1356 | + <form string="Maintenance Orders"> |
1357 | + <notebook> |
1358 | + <page string="General Info."> |
1359 | + <field name="name" select="1"/> |
1360 | + <field name="modelo_id" select="1"/> |
1361 | + <field name="costo_total"/> |
1362 | + <field name="active" select="2"/> |
1363 | + <field name="tiempo" select="2"/> |
1364 | + <newline/> |
1365 | + <field name="line_ids" colspan="4" nolabel="1"> |
1366 | + <tree string="Order Line Maintenance"> |
1367 | + <field name="product_id"/> |
1368 | + <field name="product_qty"/> |
1369 | + <field name="costo"/> |
1370 | + <field name="total"/> |
1371 | + <field name="product_uom"/> |
1372 | + </tree> |
1373 | + <form string="Order Line Maintenance"> |
1374 | + <field name="product_id" on_change="onchange_product(product_id)"/> |
1375 | + <field name="product_qty"/> |
1376 | + <field name="costo"/> |
1377 | + <field name="total"/> |
1378 | + <field name="product_uom"/> |
1379 | + </form> |
1380 | + </field> |
1381 | + </page> |
1382 | + <page string="Program"> |
1383 | + <field name="type"/> |
1384 | + <field name="type_qty"/> |
1385 | + </page> |
1386 | + <page string="Notes"> |
1387 | + <field name="notes" colspan="4" nolabel="1"/> |
1388 | + </page> |
1389 | + </notebook> |
1390 | + </form> |
1391 | + </field> |
1392 | + </record> |
1393 | + <record id="view_maintenance_bom_tree" model="ir.ui.view"> |
1394 | + <field name="name">maintenance.bom.tree</field> |
1395 | + <field name="model">maintenance.bom</field> |
1396 | + <field name="type">tree</field> |
1397 | + <field name="arch" type="xml"> |
1398 | + <tree string="Bill of Materials"> |
1399 | + <field name="name"/> |
1400 | + <field name="modelo_id"/> |
1401 | + <field name="costo_total"/> |
1402 | + <field name="type"/> |
1403 | + <field name="type_qty"/> |
1404 | + </tree> |
1405 | + </field> |
1406 | + </record> |
1407 | + <record id="action_maintenance_bom_form" model="ir.actions.act_window"> |
1408 | + <field name="name">Maintenance BoM</field> |
1409 | + <field name="type">ir.actions.act_window</field> |
1410 | + <field name="res_model">maintenance.bom</field> |
1411 | + <field name="view_type">form</field> |
1412 | + <field name="view_mode">tree,form</field> |
1413 | + </record> |
1414 | + <menuitem action="action_maintenance_bom_form" id="menu_action_maintenance_bom_form" parent="menu_maintenance_configuration"/> |
1415 | + |
1416 | + <record id="view_tracto_modelo_tree" model="ir.ui.view"> |
1417 | + <field name="name">tracto.modelo.tree</field> |
1418 | + <field name="model">tracto.modelo</field> |
1419 | + <field name="type">tree</field> |
1420 | + <field name="arch" type="xml"> |
1421 | + <tree string="Model"> |
1422 | + <field name="name" select="1"/> |
1423 | + <field name="description"/> |
1424 | + </tree> |
1425 | + </field> |
1426 | + </record> |
1427 | + <record id="view_tracto_modelo_form" model="ir.ui.view"> |
1428 | + <field name="name">tracto.modelo.form</field> |
1429 | + <field name="model">tracto.modelo</field> |
1430 | + <field name="type">form</field> |
1431 | + <field name="arch" type="xml"> |
1432 | + <form string="Model"> |
1433 | + <field name="name" select="1"/> |
1434 | + <field name="description"/> |
1435 | + <field name="line_ids" colspan="4" nolabel="1"/> |
1436 | + </form> |
1437 | + </field> |
1438 | + </record> |
1439 | + <record id="action_tracto_modelo_form" model="ir.actions.act_window"> |
1440 | + <field name="name">Model</field> |
1441 | + <field name="type">ir.actions.act_window</field> |
1442 | + <field name="res_model">tracto.modelo</field> |
1443 | + <field name="view_type">form</field> |
1444 | + <field name="view_mode">tree,form</field> |
1445 | + </record> |
1446 | + <menuitem action="action_tracto_modelo_form" id="menu_action_tracto_modelo_form" parent="menu_maintenance_configuration"/> |
1447 | + |
1448 | + <record model="ir.ui.view" id="view_product_normal_form_maintenance"> |
1449 | + <field name="name">view.product.normal.form.maintenance</field> |
1450 | + <field name="model">product.product</field> |
1451 | + <field name="type">form</field> |
1452 | + <field name="inherit_id" ref="product.product_normal_form_view"/> |
1453 | + <field name="arch" type="xml"> |
1454 | + <xpath expr="/form/notebook/page[@string='Information']" position="after"> |
1455 | + <page string="Maintenance"> |
1456 | + <field name="maintenance_id" colspan="4"/> |
1457 | + <field name="modelo_id"/> |
1458 | + <field name="distance"/> |
1459 | + <field name="maintenance_ids" colspan="4" nolabel="1" readonly="1"/> |
1460 | + </page> |
1461 | + </xpath> |
1462 | + </field> |
1463 | + </record> |
1464 | + |
1465 | + <record id="product_normal_form_view_image_inh" model="ir.ui.view"> |
1466 | + <field name="name">product.normal.form.view.image.inh</field> |
1467 | + <field name="model">product.product</field> |
1468 | + <field name="type">form</field> |
1469 | + <field name="inherit_id" ref="product.product_normal_form_view"/> |
1470 | + <field name="arch" type="xml"> |
1471 | + <xpath expr="/form[@string='Product']/group" position="replace"> |
1472 | + <group colspan="4" col="6"> |
1473 | + <group colspan="1" col="2"> |
1474 | + <separator string="Name" colspan="2"/> |
1475 | + <field name="name"/> |
1476 | + <field groups="product.group_product_variant" name="variants" /> |
1477 | + </group> |
1478 | + <group colspan="1" col="2"> |
1479 | + <separator string="Codes" colspan="2"/> |
1480 | + <field name="default_code"/> |
1481 | + <field name="ean13" groups="base.group_extended"/> |
1482 | + </group> |
1483 | + <group colspan="1" col="2"> |
1484 | + <separator string="Characteristics" colspan="2"/> |
1485 | + <field name="sale_ok"/> |
1486 | + <field name="purchase_ok"/> |
1487 | + </group> |
1488 | + <group colspan="1" col="2"> |
1489 | + <separator string="Image" colspan="2"/> |
1490 | + <field name="product_image" widget='image'/> |
1491 | + </group> |
1492 | + </group> |
1493 | + </xpath> |
1494 | + </field> |
1495 | + </record> |
1496 | + |
1497 | + |
1498 | + </data> |
1499 | +</openerp> |
1500 | |
1501 | === added file 'maintenance/maintenance_wizard.xml' |
1502 | --- maintenance/maintenance_wizard.xml 1970-01-01 00:00:00 +0000 |
1503 | +++ maintenance/maintenance_wizard.xml 2014-06-11 15:54:53 +0000 |
1504 | @@ -0,0 +1,93 @@ |
1505 | +<?xml version="1.0"?> |
1506 | +<openerp> |
1507 | + <data> |
1508 | + <menuitem icon="terp-sale" id="menu_maintenance_root" name="Maintenance" |
1509 | + web_icon="images/knowledge.png" |
1510 | + web_icon_hover="images/knowledge-hover.png"/>/> |
1511 | + <menuitem id="menu_maintenance_update" name="Update Maintenances" parent="menu_maintenance_root"/> |
1512 | + |
1513 | + <record id="view_wizard_update_maintenance" model="ir.ui.view"> |
1514 | + <field name="name">view.wizard.update.maintenance</field> |
1515 | + <field name="model">wizard.check.maintenance</field> |
1516 | + <field name="type">form</field> |
1517 | + <field name="arch" type="xml"> |
1518 | + <form string="Update Maintenances"> |
1519 | + <separator string="This wizard search the products that need an maintenance, and create the maintenance."/> |
1520 | + <newline/> |
1521 | + <separator string="Click on Update below to start the process..."/> |
1522 | + <separator colspan="4"/> |
1523 | + <group colspan="4"> |
1524 | + <button name="update_maintenances" string="Update" type="object" icon="gtk-apply"/> |
1525 | + <button special="cancel" string="Cancel" icon="gtk-stop"/> |
1526 | + </group> |
1527 | + </form> |
1528 | + </field> |
1529 | + </record> |
1530 | + <record id="action_wizard_update_maintenance" model="ir.actions.act_window"> |
1531 | + <field name="name">Update Maintenance</field> |
1532 | + <field name="type">ir.actions.act_window</field> |
1533 | + <field name="res_model">wizard.check.maintenance</field> |
1534 | + <field name="view_type">form</field> |
1535 | + <field name="view_mode">form</field> |
1536 | + <field name="target">new</field> |
1537 | + </record> |
1538 | + <menuitem action="action_wizard_update_maintenance" id="menu_wizard_check_maintenance" parent="menu_maintenance_update"/> |
1539 | + |
1540 | + <record id="view_wizard_start_maintenance" model="ir.ui.view"> |
1541 | + <field name="name">view.wizard.start.maintenance</field> |
1542 | + <field name="model">wizard.maintenance.start</field> |
1543 | + <field name="type">form</field> |
1544 | + <field name="arch" type="xml"> |
1545 | + <form string="Start Maintenances"> |
1546 | + <separator string="Indicate the date of completion of maintenance"/> |
1547 | + <newline/> |
1548 | + <separator colspan="4"/> |
1549 | + <group> |
1550 | + <field name="date"/> |
1551 | + </group> |
1552 | + <group colspan="4"> |
1553 | + <button name="start_maintenance" string="Start" type="object" icon="gtk-apply"/> |
1554 | + <button special="cancel" string="Cancel" icon="gtk-stop"/> |
1555 | + </group> |
1556 | + </form> |
1557 | + </field> |
1558 | + </record> |
1559 | + <record id="action_wizard_start_maintenance" model="ir.actions.act_window"> |
1560 | + <field name="name">Start Maintenance</field> |
1561 | + <field name="type">ir.actions.act_window</field> |
1562 | + <field name="res_model">wizard.maintenance.start</field> |
1563 | + <field name="view_type">form</field> |
1564 | + <field name="view_mode">form</field> |
1565 | + <field name="target">new</field> |
1566 | + </record> |
1567 | + |
1568 | + <record id="view_wizard_cancel_maintenance" model="ir.ui.view"> |
1569 | + <field name="name">view.wizard.cancel.maintenance</field> |
1570 | + <field name="model">wizard.maintenance.cancel</field> |
1571 | + <field name="type">form</field> |
1572 | + <field name="arch" type="xml"> |
1573 | + <form string="Cancel Maintenance"> |
1574 | + <separator colspan="4" string="If you want reassign the maintenance, you must be indicate the date of compromise"/> |
1575 | + <group> |
1576 | + <field name="date"/> |
1577 | + </group> |
1578 | + <separator colspan="4"/> |
1579 | + <group colspan="3"> |
1580 | + <button name="reassign_maintenance" string="Reassign" type="object" icon="gtk-apply"/> |
1581 | + <button name="cancel_maintenance" string="Cancel Maintenance" type="object" icon="gtk-stop"/> |
1582 | + <button special="cancel" string="Close" icon="gtk-stop"/> |
1583 | + </group> |
1584 | + </form> |
1585 | + </field> |
1586 | + </record> |
1587 | + <record id="action_wizard_cancel_maintenance" model="ir.actions.act_window"> |
1588 | + <field name="name">Cancel Maintenance</field> |
1589 | + <field name="type">ir.actions.act_window</field> |
1590 | + <field name="res_model">wizard.maintenance.cancel</field> |
1591 | + <field name="view_type">form</field> |
1592 | + <field name="view_mode">form</field> |
1593 | + <field name="target">new</field> |
1594 | + </record> |
1595 | + |
1596 | + </data> |
1597 | +</openerp> |
1598 | |
1599 | === added file 'maintenance/product.py' |
1600 | --- maintenance/product.py 1970-01-01 00:00:00 +0000 |
1601 | +++ maintenance/product.py 2014-06-11 15:54:53 +0000 |
1602 | @@ -0,0 +1,172 @@ |
1603 | +# -*- encoding: utf-8 -*- |
1604 | +########################################################################### |
1605 | +# Module Writen to OpenERP, Open Source Management Solution |
1606 | +# |
1607 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
1608 | +# All Rights Reserved. |
1609 | +# info Vauxoo (info@vauxoo.com) |
1610 | +############################################################################ |
1611 | +# Coded by: Julio Serna(julio@vauxoo.com) |
1612 | +############################################################################ |
1613 | +# |
1614 | +# This program is free software: you can redistribute it and/or modify |
1615 | +# it under the terms of the GNU Affero General Public License as |
1616 | +# published by the Free Software Foundation, either version 3 of the |
1617 | +# License, or (at your option) any later version. |
1618 | +# |
1619 | +# This program is distributed in the hope that it will be useful, |
1620 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1621 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1622 | +# GNU Affero General Public License for more details. |
1623 | +# |
1624 | +# You should have received a copy of the GNU Affero General Public License |
1625 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1626 | +# |
1627 | +############################################################################## |
1628 | +from osv import fields |
1629 | +from osv import osv |
1630 | +import time |
1631 | +import os |
1632 | +from mx.DateTime import * |
1633 | +import netsvc |
1634 | +import base64 |
1635 | + |
1636 | +#~ class tire_brand(osv.osv): |
1637 | + #~ _name = 'tire.brand' |
1638 | +#~ |
1639 | + #~ _columns = { |
1640 | + #~ 'name': fields.char('nombre', size=64) |
1641 | + #~ } |
1642 | +#~ |
1643 | +#~ tire_brand() |
1644 | + |
1645 | +#~ class tire_size(osv.osv): |
1646 | + #~ _name = 'tire.size' |
1647 | +#~ |
1648 | + #~ _columns = { |
1649 | + #~ 'name': fields.char('nombre', size=64) |
1650 | + #~ } |
1651 | +#~ |
1652 | +#~ tire_size() |
1653 | + |
1654 | +class product_template(osv.osv): |
1655 | + _inherit = 'product.template' |
1656 | + |
1657 | + #~ def _get_current(self, cr, uid, ids, name, arg, context=None): |
1658 | + #~ query = """SELECT th.id, MAX(th.date) FROM tire_history th WHERE th.tire_id in (%s) GROUP BY th.id"""%(",".join(map(str, ids))) |
1659 | + #~ cr.execute(query) |
1660 | + #~ hist_ids = cr.dictfetchall() |
1661 | + #~ res = {} |
1662 | + #~ for hist in self.pool.get('tire.history').browse(cr, uid, map(lambda x: x['id'], hist_ids)): |
1663 | + #~ res[hist.tire_id.id] = "%s - %s - %s Km"%(hist.tracto_id.name, hist.position, hist.distance) |
1664 | + #~ for id in ids: |
1665 | + #~ res.setdefault(id, '') |
1666 | + #~ return res |
1667 | + |
1668 | + def _get_release(self, cr, uid, ids, name, arg, context=None): |
1669 | + res = {} |
1670 | + query = """SELECT product_id, id, MAX(date_release) as date FROM maintenance_order_line WHERE product_id in (%s) AND state='in_progress' GROUP BY product_id, id"""%(",".join(map(str, ids))) |
1671 | + cr.execute(query) |
1672 | + for release in cr.dictfetchall(): |
1673 | + res[release['product_id']] = release['id'] |
1674 | + for id in ids: |
1675 | + res.setdefault(id, '') |
1676 | + return res |
1677 | + |
1678 | + _columns = { |
1679 | + #Datos necesarios para los mantenimientos automaticos |
1680 | + 'modelo_id': fields.many2one('tracto.modelo', 'Modelo'), |
1681 | + 'distance': fields.float('Kilometraje'), |
1682 | + 'maintenance_ids': fields.one2many('maintenance.order.line', 'product_id', 'Mantenimientos'), |
1683 | + 'maintenance_id': fields.function(_get_release, method=True, string="Mantenimiento", type="many2one", relation="maintenance.order.line"), |
1684 | + 'product_image': fields.binary('Image'), |
1685 | + 'model': fields.char('Modelo', size=16), |
1686 | + #Datos para las llantas |
1687 | + #~ 'tire_state': fields.selection([('nueva', 'Nueva'), ('usada', 'Usada'), ('renovada','Renovada'), ('original','Original')],'Estado'), |
1688 | + #~ 'brand_id': fields.many2one('tire.brand', 'Marca'), |
1689 | + #~ 'size': fields.many2one('tire.size', 'Medida'), |
1690 | + #~ 'tire_type': fields.selection([('convencional','Convencional'),('direccional','Direccional'),('radial','Radial'),('traccion','Traccion')], 'Tipo de Piso'), |
1691 | + #~ 'renew': fields.integer('Renovado'), |
1692 | + #~ 'talacha': fields.integer('Talachas'), |
1693 | + #~ 'recorrido': fields.integer('Recorrido'), |
1694 | + #~ 'capas': fields.integer('Numero de Capas'), |
1695 | + #~ 'profundidad': fields.float('Profundidad'), |
1696 | + #~ 'date_tire': fields.date('Fecha Revision'), |
1697 | + #Posicionamiento en ejes |
1698 | + #EJE 1 |
1699 | + #~ 'front_left': fields.many2one('product.product', 'Frente Izquierdo', readonly=True), |
1700 | + #~ 'front_right': fields.many2one('product.product', 'Frente Derecho', readonly=True), |
1701 | + #EJE 2 |
1702 | + #~ 'rear_left': fields.many2one('product.product', 'Izquierdo', readonly=True), |
1703 | + #~ 'rear_left2': fields.many2one('product.product', 'Izquierdo 2', readonly=True), |
1704 | + #~ 'rear_right': fields.many2one('product.product', 'Derecho', readonly=True), |
1705 | + #~ 'rear_right2': fields.many2one('product.product', 'Derecho 2', readonly=True), |
1706 | + #EJE 3 |
1707 | + #~ 'rear2_left': fields.many2one('product.product', 'Izquierdo', readonly=True), |
1708 | + #~ 'rear2_left2': fields.many2one('product.product', 'Izquierdo 2', readonly=True), |
1709 | + #~ 'rear2_right': fields.many2one('product.product', 'Derecho', readonly=True), |
1710 | + #~ 'rear2_right2': fields.many2one('product.product', 'Derecho 2', readonly=True), |
1711 | + #Refacciones . . . duh!!! |
1712 | + #~ 'refaccion1': fields.many2one('product.product', 'Refaccion 1', readonly=True), |
1713 | + #~ 'refaccion2': fields.many2one('product.product', 'Refaccion 2', readonly=True), |
1714 | + #~ 'axle_type': fields.selection([('',''), |
1715 | + #~ ('tracto6','Tracto 6 Llantas'), |
1716 | + #~ ('tracto10','Tracto 10 Llantas'), |
1717 | + #~ ('caja4','Caja 4 Llantas'), |
1718 | + #~ ('caja8','Caja 8 Llantas')],'Type'), |
1719 | +#~ |
1720 | + #~ 'history_ids': fields.one2many('tire.history', 'tire_id', 'Historial'), |
1721 | + #~ 'current_pos': fields.function(_get_current, method=True, string="Posicion Actual",type="char", size="64"), |
1722 | + |
1723 | + } |
1724 | + |
1725 | +product_template() |
1726 | + |
1727 | +#~ class product_product(osv.osv): |
1728 | + #~ _inherit = 'product.product' |
1729 | +#~ |
1730 | + #~ def _search_routing_available(self, cr, uid, obj, name, args, context={}): |
1731 | + #~ ids = [] |
1732 | + #~ for product in self.browse(cr, uid, self.search(cr, uid, [('id','<>',0)], context=context), context=context): |
1733 | + #~ if args[0][2] and product.routing_available: |
1734 | + #~ ids.append( product.id ) |
1735 | + #~ elif not args[0][2] and not product.routing_available: |
1736 | + #~ ids.append( product.id ) |
1737 | + #~ #if not ids: return [('id', '=', 0)] |
1738 | + #~ return [('id', 'in', ids)] |
1739 | +#~ |
1740 | + #~ def _get_routing_available(self, cr, uid, ids, field_name, args, context={}): |
1741 | + #~ res = {} |
1742 | + #~ for product in self.browse(cr, uid, ids, context=context): |
1743 | + #~ available = False |
1744 | + #~ if (not product.routing_state or product.routing_state in ('draft', 'done', 'cancel')) and not product.maintenance_id: |
1745 | + #~ available = True |
1746 | + #~ if product.routing_state == 'downloading' and product.vehicle_type == 'principal': |
1747 | + #~ available = True |
1748 | + #~ res.update( {product.id: available} ) |
1749 | + #~ return res |
1750 | +#~ |
1751 | + #~ _columns = { |
1752 | + #~ 'routing_available': fields.function(_get_routing_available, method=True, type="boolean", string="Available", fnct_search=_search_routing_available,), |
1753 | + #~ } |
1754 | +#~ |
1755 | +#~ product_product() |
1756 | + |
1757 | + |
1758 | +#~ class tire_history(osv.osv): |
1759 | + #~ _name = 'tire.history' |
1760 | +#~ |
1761 | + #~ _rec_name = 'tracto_id' |
1762 | + #~ _columns = { |
1763 | + #~ 'tracto_id': fields.many2one('product.product', 'Tracto/Caja', required=True), |
1764 | + #~ 'tire_id': fields.many2one('product.product', 'Tire', required=True), |
1765 | + #~ 'date': fields.date('Fecha', required=True), |
1766 | + #~ 'distance': fields.integer('Kilometraje'), |
1767 | + #~ 'position': fields.char('Posicion', size=64) |
1768 | + #~ } |
1769 | +#~ |
1770 | + #~ _defaults = { |
1771 | + #~ 'date': lambda *a: time.strftime('%Y-%m-%d'), |
1772 | + #~ } |
1773 | +#~ |
1774 | +#~ tire_history() |
1775 | |
1776 | === added directory 'maintenance/report' |
1777 | === added file 'maintenance/report/__init__.py' |
1778 | --- maintenance/report/__init__.py 1970-01-01 00:00:00 +0000 |
1779 | +++ maintenance/report/__init__.py 2014-06-11 15:54:53 +0000 |
1780 | @@ -0,0 +1,1 @@ |
1781 | +import orden_dia |
1782 | \ No newline at end of file |
1783 | |
1784 | === added file 'maintenance/report/orden_dia.py' |
1785 | --- maintenance/report/orden_dia.py 1970-01-01 00:00:00 +0000 |
1786 | +++ maintenance/report/orden_dia.py 2014-06-11 15:54:53 +0000 |
1787 | @@ -0,0 +1,67 @@ |
1788 | +# -*- encoding: utf-8 -*- |
1789 | +########################################################################### |
1790 | +# Module Writen to OpenERP, Open Source Management Solution |
1791 | +# |
1792 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
1793 | +# All Rights Reserved. |
1794 | +# info Vauxoo (info@vauxoo.com) |
1795 | +############################################################################ |
1796 | +# Coded by: Julio Serna(julio@vauxoo.com) |
1797 | +############################################################################ |
1798 | +# |
1799 | +# This program is free software: you can redistribute it and/or modify |
1800 | +# it under the terms of the GNU Affero General Public License as |
1801 | +# published by the Free Software Foundation, either version 3 of the |
1802 | +# License, or (at your option) any later version. |
1803 | +# |
1804 | +# This program is distributed in the hope that it will be useful, |
1805 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1806 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1807 | +# GNU Affero General Public License for more details. |
1808 | +# |
1809 | +# You should have received a copy of the GNU Affero General Public License |
1810 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1811 | +# |
1812 | +############################################################################## |
1813 | +import time |
1814 | +import pooler |
1815 | +from report import report_sxw |
1816 | + |
1817 | +class orden_dia(report_sxw.rml_parse): |
1818 | + def __init__(self, cr, uid, name, context): |
1819 | + super(orden_dia, self).__init__(cr, uid, name, context=context) |
1820 | + self.localcontext.update({ |
1821 | + 'time': time, |
1822 | + 'get_lines':self.get_lines, |
1823 | + }) |
1824 | + |
1825 | + def get_lines(self): |
1826 | + query = """ |
1827 | + SELECT |
1828 | + CASE WHEN mol.type = 'correctivo' THEN 'Correctivo' ELSE 'Preventivo' END as tipo, |
1829 | + notes, |
1830 | + date, |
1831 | + date_release, |
1832 | + SUM(mml.product_qty*mml.costo) as costo, |
1833 | + mol.name as name, |
1834 | + pt.name as tracto |
1835 | + FROM |
1836 | + maintenance_order_line mol |
1837 | + LEFT JOIN |
1838 | + maintenance_material_line mml ON mol.id = mml.line_id |
1839 | + JOIN |
1840 | + product_product pp ON mol.product_id = pp.id |
1841 | + JOIN |
1842 | + product_template pt ON pp.product_tmpl_id = pt.id |
1843 | + WHERE |
1844 | + mol.state IN ('draft') |
1845 | + GROUP BY |
1846 | + mol.type, notes, date, date_release, mol.name, pt.name |
1847 | + ORDER BY |
1848 | + pt.name, date""" |
1849 | + self.cr.execute(query) |
1850 | + res = self.cr.dictfetchall() |
1851 | + return res |
1852 | + |
1853 | +report_sxw.report_sxw('report.orden.dia', 'maintenance.order.line','addons/maintenance/report/account_tax_code.rml', parser=orden_dia, header=False) |
1854 | + |
1855 | |
1856 | === added file 'maintenance/report/orden_dia.rml' |
1857 | --- maintenance/report/orden_dia.rml 1970-01-01 00:00:00 +0000 |
1858 | +++ maintenance/report/orden_dia.rml 2014-06-11 15:54:53 +0000 |
1859 | @@ -0,0 +1,131 @@ |
1860 | +<?xml version="1.0"?> |
1861 | +<document filename="test.pdf"> |
1862 | + <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"> |
1863 | + <pageTemplate id="first"> |
1864 | + <frame id="first" x1="28.0" y1="42.0" width="539" height="758"/> |
1865 | + </pageTemplate> |
1866 | + </template> |
1867 | + <stylesheet> |
1868 | + <blockTableStyle id="Standard_Outline"> |
1869 | + <blockAlignment value="LEFT"/> |
1870 | + <blockValign value="TOP"/> |
1871 | + </blockTableStyle> |
1872 | + <blockTableStyle id="Tabla2"> |
1873 | + <blockAlignment value="LEFT"/> |
1874 | + <blockValign value="TOP"/> |
1875 | + </blockTableStyle> |
1876 | + <blockTableStyle id="Tabla3"> |
1877 | + <blockAlignment value="LEFT"/> |
1878 | + <blockValign value="TOP"/> |
1879 | + </blockTableStyle> |
1880 | + <initialize> |
1881 | + <paraStyle name="all" alignment="justify"/> |
1882 | + </initialize> |
1883 | + <paraStyle name="P1" fontName="Helvetica" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> |
1884 | + <paraStyle name="Standard" fontName="Times-Roman"/> |
1885 | + <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> |
1886 | + <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> |
1887 | + <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> |
1888 | + <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> |
1889 | + <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> |
1890 | + <paraStyle name="Index" fontName="Times-Roman"/> |
1891 | + <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/> |
1892 | + <paraStyle name="Footer" fontName="Times-Roman"/> |
1893 | + <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> |
1894 | + <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> |
1895 | + <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> |
1896 | + <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> |
1897 | + <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> |
1898 | + <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1899 | + <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1900 | + <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
1901 | + <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> |
1902 | + <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
1903 | + <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> |
1904 | + <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> |
1905 | + <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> |
1906 | + <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> |
1907 | + <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> |
1908 | + <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1909 | + <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1910 | + <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1911 | + <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> |
1912 | + <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> |
1913 | + <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
1914 | + </stylesheet> |
1915 | + <story> |
1916 | + <para style="terp_default_8"> |
1917 | + <font color="white"> </font> |
1918 | + </para> |
1919 | + <para style="terp_default_8"> |
1920 | + <font color="white"> </font> |
1921 | + </para> |
1922 | + <para style="terp_default_8">[[ repeatIn(objects, 'o') ]]</para> |
1923 | + <para style="P1">ORDEN DE MANTENIMIENTO</para> |
1924 | + <para style="terp_default_9"> |
1925 | + <font color="white"> </font> |
1926 | + </para> |
1927 | + <blockTable colWidths="58.0,137.0,63.0,62.0,63.0,44.0,112.0" repeatRows="1" style="Tabla2"> |
1928 | + <tr> |
1929 | + <td> |
1930 | + <para style="terp_tblheader_Details">Tipo</para> |
1931 | + </td> |
1932 | + <td> |
1933 | + <para style="terp_tblheader_Details">Descripcion</para> |
1934 | + </td> |
1935 | + <td> |
1936 | + <para style="terp_tblheader_Details">Tracto/Caja</para> |
1937 | + </td> |
1938 | + <td> |
1939 | + <para style="terp_tblheader_Details">Reporte</para> |
1940 | + </td> |
1941 | + <td> |
1942 | + <para style="terp_tblheader_Details">Compromiso</para> |
1943 | + </td> |
1944 | + <td> |
1945 | + <para style="terp_tblheader_Details">Costo</para> |
1946 | + </td> |
1947 | + <td> |
1948 | + <para style="terp_tblheader_Details">Notas</para> |
1949 | + </td> |
1950 | + </tr> |
1951 | + </blockTable> |
1952 | + <para style="terp_default_2"> |
1953 | + <font color="white"> </font> |
1954 | + </para> |
1955 | + <section> |
1956 | + <para style="terp_default_8">[[ repeatIn(get_lines(),'line') ]]</para> |
1957 | + <blockTable colWidths="57.0,139.0,61.0,62.0,63.0,45.0,112.0" style="Tabla3"> |
1958 | + <tr> |
1959 | + <td> |
1960 | + <para style="terp_default_9">[[ line['tipo'] ]]</para> |
1961 | + </td> |
1962 | + <td> |
1963 | + <para style="terp_default_9">[[ line['name'] ]]</para> |
1964 | + </td> |
1965 | + <td> |
1966 | + <para style="terp_default_9">[[ line['tracto'] ]]</para> |
1967 | + </td> |
1968 | + <td> |
1969 | + <para style="terp_default_9">[[ time.strftime('%d-%m-%Y',time.strptime(line['date'],'%Y-%m-%d')) ]]</para> |
1970 | + </td> |
1971 | + <td> |
1972 | + <para style="terp_default_9">[[ time.strftime('%d-%m-%Y',time.strptime(line['date_release'],'%Y-%m-%d %H:%M:%S')) ]]</para> |
1973 | + </td> |
1974 | + <td> |
1975 | + <para style="terp_default_9">[[ line['costo'] ]]</para> |
1976 | + </td> |
1977 | + <td> |
1978 | + <para style="terp_default_9">[[ line['notes'] ]]</para> |
1979 | + </td> |
1980 | + </tr> |
1981 | + </blockTable> |
1982 | + <para style="terp_default_2"> |
1983 | + <font color="white"> </font> |
1984 | + </para> |
1985 | + </section> |
1986 | + <para style="terp_default_8"> |
1987 | + <font color="white"> </font> |
1988 | + </para> |
1989 | + </story> |
1990 | +</document> |
1991 | |
1992 | === added file 'maintenance/report/orden_dia.sxw' |
1993 | Binary files maintenance/report/orden_dia.sxw 1970-01-01 00:00:00 +0000 and maintenance/report/orden_dia.sxw 2014-06-11 15:54:53 +0000 differ |
1994 | === added directory 'maintenance/wizard' |
1995 | === added file 'maintenance/wizard/__init__.py' |
1996 | --- maintenance/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
1997 | +++ maintenance/wizard/__init__.py 2014-06-11 15:54:53 +0000 |
1998 | @@ -0,0 +1,29 @@ |
1999 | +# -*- encoding: utf-8 -*- |
2000 | +########################################################################### |
2001 | +# Module Writen to OpenERP, Open Source Management Solution |
2002 | +# |
2003 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
2004 | +# All Rights Reserved. |
2005 | +# info Vauxoo (info@vauxoo.com) |
2006 | +############################################################################ |
2007 | +# Coded by: Julio Serna(julio@vauxoo.com) |
2008 | +############################################################################ |
2009 | +# |
2010 | +# This program is free software: you can redistribute it and/or modify |
2011 | +# it under the terms of the GNU Affero General Public License as |
2012 | +# published by the Free Software Foundation, either version 3 of the |
2013 | +# License, or (at your option) any later version. |
2014 | +# |
2015 | +# This program is distributed in the hope that it will be useful, |
2016 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2017 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2018 | +# GNU Affero General Public License for more details. |
2019 | +# |
2020 | +# You should have received a copy of the GNU Affero General Public License |
2021 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2022 | +# |
2023 | +############################################################################## |
2024 | +import wizard_maintenance_cancel |
2025 | +import wizard_check_maintenance |
2026 | +#~ import set_tire |
2027 | +import wizard_maintenance_start |
2028 | |
2029 | === added file 'maintenance/wizard/set_tire.py' |
2030 | --- maintenance/wizard/set_tire.py 1970-01-01 00:00:00 +0000 |
2031 | +++ maintenance/wizard/set_tire.py 2014-06-11 15:54:53 +0000 |
2032 | @@ -0,0 +1,104 @@ |
2033 | +# -*- encoding: utf-8 -*- |
2034 | +########################################################################### |
2035 | +# Module Writen to OpenERP, Open Source Management Solution |
2036 | +# |
2037 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
2038 | +# All Rights Reserved. |
2039 | +# info Vauxoo (info@vauxoo.com) |
2040 | +############################################################################ |
2041 | +# Coded by: Julio Serna(julio@vauxoo.com) |
2042 | +############################################################################ |
2043 | +# |
2044 | +# This program is free software: you can redistribute it and/or modify |
2045 | +# it under the terms of the GNU Affero General Public License as |
2046 | +# published by the Free Software Foundation, either version 3 of the |
2047 | +# License, or (at your option) any later version. |
2048 | +# |
2049 | +# This program is distributed in the hope that it will be useful, |
2050 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2051 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2052 | +# GNU Affero General Public License for more details. |
2053 | +# |
2054 | +# You should have received a copy of the GNU Affero General Public License |
2055 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2056 | +# |
2057 | +############################################################################## |
2058 | +import time |
2059 | +import netsvc |
2060 | +from tools.misc import UpdateableStr, UpdateableDict |
2061 | +import pooler |
2062 | + |
2063 | +import wizard |
2064 | +from osv import osv |
2065 | + |
2066 | +_arch = UpdateableStr() |
2067 | +_fields = UpdateableDict() |
2068 | + |
2069 | +def _get_form(self, cr, uid, data, ctx): |
2070 | + _fields.clear() |
2071 | + _arch_lst = ['<?xml version="1.0"?>', '<form string="Llantas">'] |
2072 | + for tracto in pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, [data['id']]): |
2073 | + if tracto.axle_type != 'caja4' and tracto.axle_type != 'caja8': |
2074 | + _arch_lst += ['<separator string="EJE Delantero" colspan="4"/>','<field name="front_left"/>', '<field name="front_right"/>'] |
2075 | + _fields['front_left'] = {'string':'Izquierdo', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.front_left and tracto.front_left.id or False} |
2076 | + _fields['front_right'] = {'string':'Derecho', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.front_right and tracto.front_right.id or False} |
2077 | + |
2078 | + _arch_lst += ['<separator string="EJE Trasero" colspan="4"/>','<group colspan="4" col="8">','<field name="rear_left2"/>','<field name="rear_left"/>','<field name="rear_right"/>','<field name="rear_right2"/>', '</group>'] |
2079 | + _fields['rear_left'] = {'string':'Izquierdo', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear_left and tracto.rear_left.id or False} |
2080 | + _fields['rear_left2'] = {'string':'Izquierdo 2', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear_left2 and tracto.rear_left2.id or False} |
2081 | + _fields['rear_right'] = {'string':'Derecho', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear_right and tracto.rear_right.id or False} |
2082 | + _fields['rear_right2'] = {'string':'Derecho 2', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear_right2 and tracto.rear_right2.id or False} |
2083 | + |
2084 | + if tracto.axle_type != 'tracto6' and tracto.axle_type != 'caja4': |
2085 | + _arch_lst += ['<separator string="EJE Trasero 2" colspan="4"/>','<group colspan="4" col="8">','<field name="rear2_left2"/>','<field name="rear2_left"/>','<field name="rear2_right"/>','<field name="rear2_right2"/>', '</group>'] |
2086 | + _fields['rear2_left'] = {'string':'Izquierdo', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear2_left and tracto.rear2_left.id or False} |
2087 | + _fields['rear2_left2'] = {'string':'Izquierdo 2', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear2_left2 and tracto.rear2_left2.id or False} |
2088 | + _fields['rear2_right'] = {'string':'Derecho', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear2_right2 and tracto.rear2_right2.id or False} |
2089 | + _fields['rear2_right2'] = {'string':'Derecho 2', 'type':'many2one', 'relation':'product.product', 'required':True, 'default':tracto.rear2_right2 and tracto.rear2_right2.id or False} |
2090 | + |
2091 | + _arch_lst += ['<separator string="Refacciones" colspan="4"/>', '<field name="refaccion1"/>', '<field name="refaccion2"/>'] |
2092 | + _fields['refaccion1'] = {'string':'Refaccion 1', 'type':'many2one', 'relation':'product.product', 'default':tracto.refaccion1 and tracto.refaccion1.id or False} |
2093 | + _fields['refaccion2'] = {'string':'Refaccion 2', 'type':'many2one', 'relation':'product.product', 'default':tracto.refaccion2 and tracto.refaccion2.id or False} |
2094 | + _arch_lst.append('</form>') |
2095 | + _arch.string = '\n'.join(_arch_lst) |
2096 | + return {} |
2097 | + |
2098 | +def _set(self, cr, uid, data, context): |
2099 | + product_obj = pooler.get_pool(cr.dbname).get('product.product') |
2100 | + hist_obj = pooler.get_pool(cr.dbname).get('tire.history') |
2101 | + for tracto in product_obj.browse(cr, uid, [data['id']]): |
2102 | + for key in data['form'].iterkeys(): |
2103 | + value = eval('tracto.%s.id'%key) |
2104 | + if value != data['form'][key]: |
2105 | + tire = product_obj.browse(cr, uid, [data['form'][key]])[0] |
2106 | + product_obj.write(cr, uid, tracto.id, {key:data['form'][key]} ) |
2107 | + hist_obj.create(cr, uid, { |
2108 | + 'tracto_id': tracto.id, |
2109 | + 'tire_id': data['form'][key], |
2110 | + 'distance': tire.recorrido, |
2111 | + 'position': key,}) |
2112 | + return {} |
2113 | + |
2114 | +class set(wizard.interface): |
2115 | + |
2116 | + states = { |
2117 | + 'init': { |
2118 | + 'actions': [ _get_form ], |
2119 | + 'result': {'type': 'form', 'arch': _arch, 'fields': _fields, |
2120 | + 'state' : ( |
2121 | + ('end', 'Cancel'), |
2122 | + ('set', 'Cambiar') |
2123 | + ) |
2124 | + }, |
2125 | + }, |
2126 | + 'set': { |
2127 | + 'actions': [], |
2128 | + 'result': { |
2129 | + 'type': 'action', |
2130 | + 'action': _set, |
2131 | + 'state': 'end', |
2132 | + }, |
2133 | + } |
2134 | + } |
2135 | + |
2136 | +set('wizard.set.tire') |
2137 | |
2138 | === added file 'maintenance/wizard/wizard_check_maintenance.py' |
2139 | --- maintenance/wizard/wizard_check_maintenance.py 1970-01-01 00:00:00 +0000 |
2140 | +++ maintenance/wizard/wizard_check_maintenance.py 2014-06-11 15:54:53 +0000 |
2141 | @@ -0,0 +1,45 @@ |
2142 | +# -*- encoding: utf-8 -*- |
2143 | +########################################################################### |
2144 | +# Module Writen to OpenERP, Open Source Management Solution |
2145 | +# |
2146 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
2147 | +# All Rights Reserved. |
2148 | +# info Vauxoo (info@vauxoo.com) |
2149 | +############################################################################ |
2150 | +# Coded by: Julio Serna(julio@vauxoo.com) |
2151 | +############################################################################ |
2152 | +# |
2153 | +# This program is free software: you can redistribute it and/or modify |
2154 | +# it under the terms of the GNU Affero General Public License as |
2155 | +# published by the Free Software Foundation, either version 3 of the |
2156 | +# License, or (at your option) any later version. |
2157 | +# |
2158 | +# This program is distributed in the hope that it will be useful, |
2159 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2160 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2161 | +# GNU Affero General Public License for more details. |
2162 | +# |
2163 | +# You should have received a copy of the GNU Affero General Public License |
2164 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2165 | +# |
2166 | +############################################################################## |
2167 | +from osv import osv, fields |
2168 | + |
2169 | +class wizard_check_maintenance(osv.Model): |
2170 | + _name = 'wizard.check.maintenance' |
2171 | + |
2172 | + def update_maintenances(self, cr, uid, ids, context=None): |
2173 | + mol_ids = self.pool.get('maintenance.order.line')._check_maintenance(cr, uid, ids, context=context) |
2174 | + return { |
2175 | + 'domain': "[('id','in', [" + ','.join(map(str,mol_ids)) + "])]", |
2176 | + 'name': 'Mantenimientos', |
2177 | + 'view_type': 'form', |
2178 | + 'view_mode': 'tree,form', |
2179 | + 'res_model': 'maintenance.order.line', |
2180 | + 'view_id': False, |
2181 | + 'type': 'ir.actions.act_window' |
2182 | + } |
2183 | + |
2184 | + |
2185 | + |
2186 | + |
2187 | |
2188 | === added file 'maintenance/wizard/wizard_maintenance_cancel.py' |
2189 | --- maintenance/wizard/wizard_maintenance_cancel.py 1970-01-01 00:00:00 +0000 |
2190 | +++ maintenance/wizard/wizard_maintenance_cancel.py 2014-06-11 15:54:53 +0000 |
2191 | @@ -0,0 +1,58 @@ |
2192 | +# -*- encoding: utf-8 -*- |
2193 | +########################################################################### |
2194 | +# Module Writen to OpenERP, Open Source Management Solution |
2195 | +# |
2196 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
2197 | +# All Rights Reserved. |
2198 | +# info Vauxoo (info@vauxoo.com) |
2199 | +############################################################################ |
2200 | +# Coded by: Julio Serna(julio@vauxoo.com) |
2201 | +############################################################################ |
2202 | +# |
2203 | +# This program is free software: you can redistribute it and/or modify |
2204 | +# it under the terms of the GNU Affero General Public License as |
2205 | +# published by the Free Software Foundation, either version 3 of the |
2206 | +# License, or (at your option) any later version. |
2207 | +# |
2208 | +# This program is distributed in the hope that it will be useful, |
2209 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2210 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2211 | +# GNU Affero General Public License for more details. |
2212 | +# |
2213 | +# You should have received a copy of the GNU Affero General Public License |
2214 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2215 | +# |
2216 | +############################################################################## |
2217 | +from osv import osv, fields |
2218 | +from tools.translate import _ |
2219 | + |
2220 | +class wizard_maintenance_cancel(osv.Model): |
2221 | + _name = 'wizard.maintenance.cancel' |
2222 | + |
2223 | + _columns = { |
2224 | + 'date': fields.datetime('Compromise date', help='Use this date when you want reassign this maintenance',), |
2225 | + } |
2226 | + |
2227 | + def reassign_maintenance(self, cr, uid, ids, context): |
2228 | + mol_obj = self.pool.get('maintenance.order.line') |
2229 | + data = self.browse(cr, uid, ids[0], context=context) |
2230 | + active_ids = context.get('active_ids', []) |
2231 | + if not data.date: |
2232 | + raise osv.except_osv(_('Warning!'), _('You must be set a date')) |
2233 | + for mol in mol_obj.browse(cr, uid, active_ids, context=context): |
2234 | + mol_id = mol_obj.copy(cr, uid, mol.id, {'date_due': data.date, 'picking_ids':[], 'pendiente_id': mol.id}) |
2235 | + mol_obj.write(cr, uid, mol.id, {'state': 'reassigned'}) |
2236 | + return { |
2237 | + 'domain': "[('id','in', [" + str(mol_id) + "])]", |
2238 | + 'name': 'Mantenimientos', |
2239 | + 'view_type': 'form', |
2240 | + 'view_mode': 'tree,form', |
2241 | + 'res_model': 'maintenance.order.line', |
2242 | + 'view_id': False, |
2243 | + 'type': 'ir.actions.act_window' |
2244 | + } |
2245 | + |
2246 | + def cancel_maintenance(self, cr, uid, ids, context): |
2247 | + active_id = context.get('active_id', []) |
2248 | + self.pool.get('maintenance.order.line').write(cr, uid, active_id, {'state': 'cancel'}, context=context) |
2249 | + return {} |
2250 | |
2251 | === added file 'maintenance/wizard/wizard_maintenance_start.py' |
2252 | --- maintenance/wizard/wizard_maintenance_start.py 1970-01-01 00:00:00 +0000 |
2253 | +++ maintenance/wizard/wizard_maintenance_start.py 2014-06-11 15:54:53 +0000 |
2254 | @@ -0,0 +1,41 @@ |
2255 | +# -*- encoding: utf-8 -*- |
2256 | +########################################################################### |
2257 | +# Module Writen to OpenERP, Open Source Management Solution |
2258 | +# |
2259 | +# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/ |
2260 | +# All Rights Reserved. |
2261 | +# info Vauxoo (info@vauxoo.com) |
2262 | +############################################################################ |
2263 | +# Coded by: Julio Serna(julio@vauxoo.com) |
2264 | +############################################################################ |
2265 | +# |
2266 | +# This program is free software: you can redistribute it and/or modify |
2267 | +# it under the terms of the GNU Affero General Public License as |
2268 | +# published by the Free Software Foundation, either version 3 of the |
2269 | +# License, or (at your option) any later version. |
2270 | +# |
2271 | +# This program is distributed in the hope that it will be useful, |
2272 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2273 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2274 | +# GNU Affero General Public License for more details. |
2275 | +# |
2276 | +# You should have received a copy of the GNU Affero General Public License |
2277 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2278 | +# |
2279 | +############################################################################## |
2280 | +from osv import osv, fields |
2281 | + |
2282 | +class wizard_maintenance_start(osv.Model): |
2283 | + _name = 'wizard.maintenance.start' |
2284 | + |
2285 | + _columns = { |
2286 | + 'date': fields.datetime('Date Finished', required=True,), |
2287 | + } |
2288 | + |
2289 | + def start_maintenance(self, cr, uid, ids, context=None): |
2290 | + mol_obj = self.pool.get('maintenance.order.line') |
2291 | + active_ids = context.get('active_ids', []) |
2292 | + data = self.browse(cr, uid, ids[0], context=context) |
2293 | + for mol in mol_obj.browse(cr, uid, active_ids, context=context): |
2294 | + mol_obj.write(cr, uid, mol.id, {'date_release': data.date, 'state': 'in_progress'}) |
2295 | + return {} |