Merge lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_webkit-afe into lp:~openerp-community-reviewer/openerp-mrp-reports/7.0
- 7.0-add_serpentcs_mrp_webkit-afe
- Merge into 7.0
Proposed by
Alexandre Fayolle - camptocamp
Status: | Merged |
---|---|
Merged at revision: | 3 |
Proposed branch: | lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_webkit-afe |
Merge into: | lp:~openerp-community-reviewer/openerp-mrp-reports/7.0 |
Diff against target: |
858 lines (+817/-0) 8 files modified
mrp_webkit/__init__.py (+24/-0) mrp_webkit/__openerp__.py (+46/-0) mrp_webkit/mrp_report.xml (+330/-0) mrp_webkit/report/__init__.py (+26/-0) mrp_webkit/report/bom_structure.mako (+66/-0) mrp_webkit/report/bom_structure.py (+66/-0) mrp_webkit/report/order.mako (+220/-0) mrp_webkit/report/order.py (+39/-0) |
To merge this branch: | bzr merge lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_webkit-afe |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guewen Baconnier @ Camptocamp | Approve | ||
Alex Comba - Agile BG (community) | code review, no test | Approve | |
Lorenzo Battistini (community) | code review | Approve | |
Review via email: mp+209039@code.launchpad.net |
Commit message
Description of the change
Extraction of mrp_report from lp:~serpentcs/openobject-addons/7.0-webkit-reports for inclusion in OCA
To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) : | # |
review:
Approve
(code review)
Revision history for this message
Alex Comba - Agile BG (tafaru) : | # |
review:
Approve
(code review, no test)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'mrp_webkit' |
2 | === added file 'mrp_webkit/__init__.py' |
3 | --- mrp_webkit/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ mrp_webkit/__init__.py 2014-03-03 11:00:02 +0000 |
5 | @@ -0,0 +1,24 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>) |
11 | +# |
12 | +# This program is free software: you can redistribute it and/or modify |
13 | +# it under the terms of the GNU Affero General Public License as |
14 | +# published by the Free Software Foundation, either version 3 of the |
15 | +# License, or (at your option) any later version. |
16 | +# |
17 | +# This program is distributed in the hope that it will be useful, |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | +# GNU Affero General Public License for more details. |
21 | +# |
22 | +# You should have received a copy of the GNU Affero General Public License |
23 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | +# |
25 | +############################################################################ |
26 | + |
27 | +from . import report |
28 | + |
29 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
30 | |
31 | === added file 'mrp_webkit/__openerp__.py' |
32 | --- mrp_webkit/__openerp__.py 1970-01-01 00:00:00 +0000 |
33 | +++ mrp_webkit/__openerp__.py 2014-03-03 11:00:02 +0000 |
34 | @@ -0,0 +1,46 @@ |
35 | +# -*- coding: utf-8 -*- |
36 | +############################################################################## |
37 | +# |
38 | +# OpenERP, Open Source Management Solution |
39 | +# Copyright (C) 2011-2013 Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>) |
40 | +# |
41 | +# This program is free software: you can redistribute it and/or modify |
42 | +# it under the terms of the GNU Affero General Public License as |
43 | +# published by the Free Software Foundation, either version 3 of the |
44 | +# License, or (at your option) any later version. |
45 | +# |
46 | +# This program is distributed in the hope that it will be useful, |
47 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
48 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
49 | +# GNU Affero General Public License for more details. |
50 | +# |
51 | +# You should have received a copy of the GNU Affero General Public License |
52 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
53 | +# |
54 | +############################################################################ |
55 | + |
56 | + |
57 | +{ |
58 | + 'name': 'MRP', |
59 | + 'version': '1.0', |
60 | + 'author': 'Serpent Consulting Services Pvt. Ltd.', |
61 | + 'website': 'http://www.serpentcs.com', |
62 | + 'category': 'Manufacturing', |
63 | + 'sequence': 18, |
64 | + 'summary': 'Manufacturing Orders, Bill of Materials, Routing', |
65 | + 'depends': ['mrp','report_webkit'], |
66 | + 'description': """ |
67 | +Manage the Manufacturing process in OpenERP |
68 | +=========================================== |
69 | + |
70 | + It is conversion of rml report to Webkit Report. |
71 | + |
72 | + """, |
73 | + 'data': [ |
74 | + 'mrp_report.xml', |
75 | + ], |
76 | + 'installable': True, |
77 | + 'application': True, |
78 | + 'auto_install': False, |
79 | +} |
80 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
81 | |
82 | === added file 'mrp_webkit/mrp_report.xml' |
83 | --- mrp_webkit/mrp_report.xml 1970-01-01 00:00:00 +0000 |
84 | +++ mrp_webkit/mrp_report.xml 2014-03-03 11:00:02 +0000 |
85 | @@ -0,0 +1,330 @@ |
86 | +<?xml version="1.0" encoding="utf-8"?> |
87 | +<openerp> |
88 | + <data> |
89 | + <record id="bom webkit header" model="ir.header_webkit"> |
90 | + <field name="footer_html"><![CDATA[]]></field> |
91 | + <field name="orientation">Portrait</field> |
92 | + <field name="format">A4</field> |
93 | + <field name="html"><![CDATA[ |
94 | + <html> |
95 | + <head> |
96 | + |
97 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> |
98 | + <script> |
99 | + function subst() { |
100 | + var vars={}; |
101 | + var x=document.location.search.substring(1).split('&'); |
102 | + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} |
103 | + if(vars['page']!=1){ |
104 | + document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML; |
105 | + } |
106 | + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
107 | + for(var i in x) { |
108 | + var y = document.getElementsByClassName(x[i]); |
109 | + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; |
110 | + } |
111 | + } |
112 | + </script> |
113 | + <style type="text/css"> |
114 | + ${css} |
115 | + </style> |
116 | + </head> |
117 | + <body style="border:0; margin:0;" onload="subst()"> |
118 | + <table style="border:0" width="100%"> |
119 | + <tr> |
120 | + <td width="92%"> |
121 | + <td width="4%" style="text-align:right;font-size:10;width:350px;"> <span class="page"/></td> |
122 | + <td width="4%" style="text-align:left;font-size:10;width:30px"> / <span class="topage"/></td> |
123 | + </tr> |
124 | + </table> ${_debug or ''|n} |
125 | + <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" > |
126 | + |
127 | + </table>${_debug or ''|n} |
128 | + <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table"> |
129 | + <tr > |
130 | + <td style="text-align:left; border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="35%"><b>${ _('BOM Name') }</b></td> |
131 | + <td style="text-align:left;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="35%"><b>${ _('Product Name') }</b></td> |
132 | + <td style="text-align:right;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="15%"><b>${ _('Quantity') }<b></td> |
133 | + <td style="text-align:center;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="15%"><b>${ _('BOM Ref') }</b></td> |
134 | + </tr> |
135 | + </table> |
136 | + </body> |
137 | +</html>]]> |
138 | + </field> |
139 | + <field eval="15.0" name="margin_top"/> |
140 | + <field eval="5.0" name="margin_bottom"/> |
141 | + <field name="css"><![CDATA[ |
142 | + |
143 | + |
144 | + |
145 | + |
146 | +.basic_table{ |
147 | +border-color:black; |
148 | +border-collapse: collapse; |
149 | +font-family: Helvetica-Bold; |
150 | +} |
151 | +.basic_table td { |
152 | +border-color:black; |
153 | +border-bottom:2px solid black; |
154 | +font-size:12px; |
155 | +} |
156 | + |
157 | +.list_table { |
158 | +border-color:black; |
159 | +border-collapse: collapse; |
160 | +font-family: Helvetica; |
161 | +} |
162 | +.list_table td { |
163 | +border-bottom:1px solid #ccc; |
164 | +font-size:12px; |
165 | +padding-left:3px |
166 | +padding-right:3px |
167 | +padding-top:3px |
168 | +padding-bottom:3px |
169 | +} |
170 | +.list_table1 { |
171 | +border-color:black; |
172 | +border-collapse: collapse; |
173 | +font-family: Helvetica; |
174 | +} |
175 | +.list_table1 td { |
176 | +border-color:gray; |
177 | +border-bottom:2px solid gray; |
178 | +font-size:12px; |
179 | + |
180 | +} |
181 | +.list_table2 { |
182 | +border-color:black; |
183 | +border-collapse: collapse; |
184 | + |
185 | +} |
186 | +.list_table2 td { |
187 | +border-color:black; |
188 | +border-top:2px solid black; |
189 | +border-bottom:2px solid black; |
190 | +font-size:12; |
191 | +padding-left:3px |
192 | +padding-right:3px |
193 | +padding-top:3px |
194 | +padding-bottom:3px |
195 | +} |
196 | +.list_table th { |
197 | +border-bottom:2px solid black; |
198 | +text-align:left; |
199 | +font-size:12px; |
200 | +font-weight:bold; |
201 | +padding-left:3px |
202 | +padding-right:3px |
203 | +} |
204 | + |
205 | +.list_tabe thead { |
206 | + display:table-header-group; |
207 | +} |
208 | + |
209 | + |
210 | +.total { |
211 | +width:100%; |
212 | +} |
213 | +.lib { |
214 | +width:10.3%; |
215 | +} |
216 | +.tot { |
217 | +text-align:left; |
218 | +width:15%; |
219 | +} |
220 | +.righttot { |
221 | +width:74%; |
222 | +} |
223 | +.tax { |
224 | +width:50%; |
225 | +} |
226 | +table { |
227 | + display: table; |
228 | + width: 100%; |
229 | + } |
230 | + |
231 | + table thead { |
232 | + display: table-header-group; |
233 | + } |
234 | + |
235 | + table tbody { |
236 | + display: table-row-group; |
237 | + } |
238 | + |
239 | + table tfoot { |
240 | + display: table-footer-group; |
241 | + } |
242 | + |
243 | + table tr { |
244 | + display: table-row; |
245 | + height: auto; |
246 | + } |
247 | + |
248 | + table th, |
249 | + table td { |
250 | + display: table-cell; |
251 | + overflow: visible; |
252 | + } |
253 | + |
254 | + table th, |
255 | + table td { |
256 | + height: 1px; /* Do the trick to make div.nobrk fill td height */ |
257 | + } |
258 | + |
259 | + table tr.singlecell td, |
260 | + table tr.singlecell th { |
261 | + height: auto; /* Reset trick for a full row td */ |
262 | + } |
263 | + |
264 | + .nobrk { |
265 | + page-break-inside: avoid; |
266 | + orphans: 10; |
267 | + widows: 10; |
268 | + position: relative; |
269 | + margin: -1px 0 0 -1px; |
270 | + min-height: 14px; |
271 | + line-height: 14px; |
272 | + height: 100%; |
273 | + } |
274 | + |
275 | + table tbody td .nobrk { |
276 | + min-height: 5px; |
277 | + } |
278 | + ]]> |
279 | + </field> |
280 | + <field name="name">bom webkit header</field> |
281 | + </record> |
282 | + |
283 | +<record id="production webkit header" model="ir.header_webkit"> |
284 | + <field name="footer_html"><![CDATA[]]></field> |
285 | + <field name="orientation">Portrait</field> |
286 | + <field name="format">A4</field> |
287 | + <field name="html"><![CDATA[ |
288 | + <html> |
289 | + <head> |
290 | + |
291 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> |
292 | + <script> |
293 | + function subst() { |
294 | + var vars={}; |
295 | + var x=document.location.search.substring(1).split('&'); |
296 | + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} |
297 | + if(vars['page']!=1){ |
298 | + document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML; |
299 | + } |
300 | + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
301 | + for(var i in x) { |
302 | + var y = document.getElementsByClassName(x[i]); |
303 | + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; |
304 | + } |
305 | + } |
306 | + </script> |
307 | + <style type="text/css"> |
308 | + ${css} |
309 | + </style> |
310 | + </head> |
311 | + <body style="border:0; margin:0;" onload="subst()"> |
312 | + <table class="header" style="border-bottom: 1px solid black; width: 100%"> |
313 | + <tr > |
314 | + <td style="text-align:right;font-size:10;font-family: Helvetica-Bold;" width="15%">${ formatLang(time.strftime('%Y-%m-%d'),date=True)} ${time.strftime('%I:%M')}</td> |
315 | + <td style="text-align:center;font-size:14; font-family: Helvetica-Bold;" width="75%"><b>${company.partner_id.name |entity}</b></td> |
316 | + <td width="5%" style="text-align:right;font-size:10;width:350px; font-family: Helvetica-Bold;" > <span class="page"/></td> |
317 | + <td width="5%" style="text-align:left;font-size:10;width:30px font-family: Helvetica-Bold;"> / <span class="topage"/></td> |
318 | + </tr> |
319 | + </table> ${_debug or ''|n} |
320 | + <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" > |
321 | + |
322 | + </table>${_debug or ''|n} |
323 | + <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table"> |
324 | + <tr > |
325 | + |
326 | + </tr> |
327 | + </table> |
328 | + </body> |
329 | +</html>]]> |
330 | + </field> |
331 | + <field eval="15.0" name="margin_top"/> |
332 | + <field eval="5.0" name="margin_bottom"/> |
333 | + <field name="css"><![CDATA[ |
334 | + |
335 | +.basic_table{ |
336 | +border-collapse: collapse; |
337 | +font-family: Helvetica-Bold; |
338 | +} |
339 | +.basic_table td { |
340 | +border-color:black; |
341 | +border-bottom:2px solid black; |
342 | + |
343 | +} |
344 | + |
345 | + .title{ |
346 | + text-align:left |
347 | + font-family: Helvetica-Bold; |
348 | + font-size:12px; |
349 | +} |
350 | + |
351 | +.list_table { |
352 | +border-color:black; |
353 | +border-collapse: collapse; |
354 | +font-family: Helvetica; |
355 | +} |
356 | +.list_table td { |
357 | +border-color:gray; |
358 | +border-bottom:1px solid gray; |
359 | +font-size:12px; |
360 | + |
361 | +} |
362 | +.list_table1 { |
363 | +border-color:black; |
364 | +border-collapse: collapse; |
365 | +font-family: Helvetica; |
366 | +font-size:12px; |
367 | +} |
368 | +.list_table1 td { |
369 | +border-color:gray; |
370 | +border-bottom:1px solid gray; |
371 | + |
372 | + |
373 | +} |
374 | +.list_table2 { |
375 | +text-align:center; |
376 | +border-collapse: collapse; |
377 | +} |
378 | +.list_table2 td { |
379 | + border:1px solid lightGrey; |
380 | + border-collapse: collapse; |
381 | + font-family: Helvetica; |
382 | + font-size:11px; |
383 | + } |
384 | + |
385 | +} |
386 | + |
387 | + ]]> |
388 | + </field> |
389 | + <field name="name">production webkit header</field> |
390 | + </record> |
391 | + |
392 | + <report |
393 | + auto="True" |
394 | + header="False" |
395 | + id="report_bom_structure" |
396 | + model="mrp.bom" |
397 | + name="bom.structure.webkit" |
398 | + file="mrp_webkit/report/bom_structure.mako" |
399 | + string="BOM Structure" |
400 | + report_type="webkit" |
401 | + webkit_header="bom webkit header"/> |
402 | + |
403 | + <report |
404 | + id="report_mrp_production_report" |
405 | + string="Production Order" |
406 | + model="mrp.production" |
407 | + name="mrp.production.order.webkit" |
408 | + file="mrp_webkit/report/order.mako" |
409 | + auto="False" |
410 | + report_type="webkit" |
411 | + webkit_header="production webkit header" |
412 | + /> |
413 | + |
414 | + </data> |
415 | +</openerp> |
416 | |
417 | === added directory 'mrp_webkit/report' |
418 | === added file 'mrp_webkit/report/__init__.py' |
419 | --- mrp_webkit/report/__init__.py 1970-01-01 00:00:00 +0000 |
420 | +++ mrp_webkit/report/__init__.py 2014-03-03 11:00:02 +0000 |
421 | @@ -0,0 +1,26 @@ |
422 | +# -*- coding: utf-8 -*- |
423 | +############################################################################## |
424 | +# |
425 | +# OpenERP, Open Source Management Solution |
426 | +# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>) |
427 | +# |
428 | +# This program is free software: you can redistribute it and/or modify |
429 | +# it under the terms of the GNU Affero General Public License as |
430 | +# published by the Free Software Foundation, either version 3 of the |
431 | +# License, or (at your option) any later version. |
432 | +# |
433 | +# This program is distributed in the hope that it will be useful, |
434 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
435 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
436 | +# GNU Affero General Public License for more details. |
437 | +# |
438 | +# You should have received a copy of the GNU Affero General Public License |
439 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
440 | +# |
441 | +############################################################################ |
442 | + |
443 | +from . import order |
444 | +from . import bom_structure |
445 | + |
446 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
447 | + |
448 | |
449 | === added file 'mrp_webkit/report/bom_structure.mako' |
450 | --- mrp_webkit/report/bom_structure.mako 1970-01-01 00:00:00 +0000 |
451 | +++ mrp_webkit/report/bom_structure.mako 2014-03-03 11:00:02 +0000 |
452 | @@ -0,0 +1,66 @@ |
453 | +<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
454 | + |
455 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
456 | + <head> |
457 | + <style type="text/css"> |
458 | + ${css} |
459 | + </style> |
460 | + <title>BOM Structure.pdf</title> |
461 | + </head> |
462 | + <body> |
463 | + <table width="100%"> |
464 | + <tr> |
465 | + <td style="text-align:center;"> |
466 | + <h2><b>${ _('BOM Structure') } </b></h2> |
467 | + </td> |
468 | + </tr> |
469 | + </table> |
470 | + |
471 | + <table width="100%" class="basic_table"> |
472 | + <tr > |
473 | + <td style="text-align:left;" width="35%"><b>${ _('BOM Name') }</b></td> |
474 | + <td style="text-align:left;" width="35%"><b>${ _('Product Name') }</b></td> |
475 | + <td style="text-align:right;" width="15%"><b>${ _('Quantity') }<b></td> |
476 | + <td style="text-align:center;" width="15%"><b>${ _('BOM Ref') }</b></td> |
477 | + </tr> |
478 | + </table> |
479 | + %for o in objects: |
480 | + <table width="100%" class="list_table1"> |
481 | + <tr > |
482 | + <td style="text-align:left;" width="35%"><b> |
483 | + ${o.name}</b> |
484 | + </td> |
485 | + <td style="text-align:left;" width="35%"><b> |
486 | + [ ${(o.product_id.default_code) or removeParentNode('font')}] ${o.product_id.name}</b> |
487 | + </td> |
488 | + <td style="text-align:right;" width="15%"><b> |
489 | + ${o.product_qty} ${o.product_uom.name}</b> |
490 | + </td> |
491 | + <td style="text-align:center;" width="15%"><b> |
492 | + ${o.code or ''}</b> |
493 | + </td><br/> |
494 | + </tr> |
495 | + </table> |
496 | + |
497 | + %for l in get_children(o.bom_lines): |
498 | + <table width="100%" class="list_table"> |
499 | + <tr> |
500 | + <td style="text-align:left ; padding-left:10px" width="35%" class="cell_extended_gray"> |
501 | + <font color="white" >${'... '*(l['level'])}</font> - ${l['name']} |
502 | + </td> |
503 | + <td style="text-align:left;" width="35%" class="cell_extended_gray"> |
504 | + ${ (l['pcode']) or '' } ${l['pname']} |
505 | + </td> |
506 | + <td style="text-align:right;" width="15%" class="cell_extended_gray"> |
507 | + ${l['pqty']} ${l['uname']} |
508 | + </td> |
509 | + <td style="text-align:center;" width="15%" class="cell_extended_gray"> |
510 | + ${l['code'] or ''} |
511 | + </td> |
512 | + </tr> |
513 | + </table> |
514 | + %endfor |
515 | + </br> |
516 | + %endfor |
517 | +</body> |
518 | +</html> |
519 | |
520 | === added file 'mrp_webkit/report/bom_structure.py' |
521 | --- mrp_webkit/report/bom_structure.py 1970-01-01 00:00:00 +0000 |
522 | +++ mrp_webkit/report/bom_structure.py 2014-03-03 11:00:02 +0000 |
523 | @@ -0,0 +1,66 @@ |
524 | +# -*- coding: utf-8 -*- |
525 | +############################################################################## |
526 | +# |
527 | +# OpenERP, Open Source Management Solution |
528 | +# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>) |
529 | +# |
530 | +# This program is free software: you can redistribute it and/or modify |
531 | +# it under the terms of the GNU Affero General Public License as |
532 | +# published by the Free Software Foundation, either version 3 of the |
533 | +# License, or (at your option) any later version. |
534 | +# |
535 | +# This program is distributed in the hope that it will be useful, |
536 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
537 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
538 | +# GNU Affero General Public License for more details. |
539 | +# |
540 | +# You should have received a copy of the GNU Affero General Public License |
541 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
542 | +# |
543 | +############################################################################ |
544 | + |
545 | +import time |
546 | + |
547 | +from openerp.report import report_sxw |
548 | + |
549 | +class bom_structure(report_sxw.rml_parse): |
550 | + def __init__(self, cr, uid, name, context): |
551 | + super(bom_structure, self).__init__(cr, uid, name, context=context) |
552 | + self.localcontext.update({ |
553 | + 'time': time, |
554 | + 'get_children': self.get_children, |
555 | + }) |
556 | + |
557 | + def get_children(self, object, level=0): |
558 | + result = [] |
559 | + |
560 | + def _get_rec(object, level): |
561 | + for l in object: |
562 | + res = {} |
563 | + res['name'] = l.name |
564 | + res['pname'] = l.product_id.name |
565 | + res['pcode'] = l.product_id.default_code |
566 | + res['pqty'] = l.product_qty |
567 | + res['uname'] = l.product_uom.name |
568 | + res['code'] = l.code |
569 | + res['level'] = level |
570 | + result.append(res) |
571 | + if l.child_complete_ids: |
572 | + if level < 6: |
573 | + level += 1 |
574 | + _get_rec(l.child_complete_ids,level) |
575 | + if 0 < level < 6: |
576 | + level -= 1 |
577 | + return result |
578 | + |
579 | + children = _get_rec(object,level) |
580 | + |
581 | + return children |
582 | + |
583 | +report_sxw.report_sxw('report.bom.structure.webkit', |
584 | + 'mrp.bom', |
585 | + 'mrp_webkit/report/bom_structure.mako', |
586 | + parser=bom_structure,header='internal') |
587 | + |
588 | + |
589 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
590 | |
591 | === added file 'mrp_webkit/report/order.mako' |
592 | --- mrp_webkit/report/order.mako 1970-01-01 00:00:00 +0000 |
593 | +++ mrp_webkit/report/order.mako 2014-03-03 11:00:02 +0000 |
594 | @@ -0,0 +1,220 @@ |
595 | +<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
596 | + |
597 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
598 | + <head> |
599 | + <style type="text/css"> |
600 | + ${css} |
601 | + </style> |
602 | + <title>Production Order.pdf</title> |
603 | + </head> |
604 | + <body> |
605 | + %for o in objects: |
606 | + <table class="title" width="100%"> |
607 | + <tr> |
608 | + <td width="100%"> |
609 | + <h3><b>${ _('Production Order N°') } : ${o.name}</b></h3> |
610 | + </td> |
611 | + </tr> |
612 | + </table> |
613 | + |
614 | + <table width="100%" class="list_table2"> |
615 | + <tr> |
616 | + <td width="35%"> |
617 | + <b>${ _('Source Document') }</b> |
618 | + </td> |
619 | + <td width="40%"> |
620 | + <b>${ _('Product') }</b> |
621 | + </td> |
622 | + <td width="25%"> |
623 | + <b>${ _('Quantity') }</b> |
624 | + </td> |
625 | + </tr> |
626 | + </table> |
627 | + <table width="100%" class="list_table2"> |
628 | + <tr> |
629 | + <td width="35%"> |
630 | + ${o.origin or ''} |
631 | + </td> |
632 | + <td width="40%"> |
633 | + ${o.product_id and o.product_id.code or ''} ${o.product_id and o.product_id.name or ''} |
634 | + </td> |
635 | + <td width="25%"> |
636 | + ${formatLang(o.product_qty)} ${o.product_id and o.product_uom and o.product_uom.name or ''} |
637 | + </td> |
638 | + </tr> |
639 | + </table> |
640 | + <br/> |
641 | + |
642 | + <table width="100%" class="list_table2"> |
643 | + <tr> |
644 | + <td width="35%"> |
645 | + <b>${ _('Scheduled Date') }</b> |
646 | + </td> |
647 | + <td width="18%"> |
648 | + <b>${ _('Printing date') }</b> |
649 | + </td> |
650 | + <td width="22%"> |
651 | + <b>${ _('Partner Ref') }</b> |
652 | + </td> |
653 | + <td width="25%"> |
654 | + <b>${ _('SO Number') }</b> |
655 | + </td> |
656 | + </tr> |
657 | + </table> |
658 | + <table width="100%" class="list_table2"> |
659 | + <tr> |
660 | + <td width="35%"> |
661 | + ${formatLang(o.date_planned, date_time = True)} |
662 | + </td> |
663 | + <td width="18%"> |
664 | + ${formatLang(time.strftime('%Y-%m-%d'),date = True)} |
665 | + </td> |
666 | + <td width="22%"> |
667 | + ${'sale_ref' in o._columns.keys() and o.sale_ref or ''} |
668 | + </td> |
669 | + <td width="25%"> |
670 | + ${'sale_name' in o._columns.keys() and o.sale_name or ''} |
671 | + </td> |
672 | + </tr> |
673 | + </table> |
674 | + <br/> |
675 | + |
676 | + %if o.workcenter_lines ==[]: |
677 | + |
678 | + %else: |
679 | + <table width="100%"> |
680 | + <tr> |
681 | + <td style="text-align:left;" width="100%"> |
682 | + <h4><b>${ _('Work Orders') }</b></h4> |
683 | + </td> |
684 | + </tr> |
685 | + </table> |
686 | + <table width="100%" class="list_table2"> |
687 | + <tr> |
688 | + <td width="15%"> |
689 | + <b>${ _('Sequence') }</b> |
690 | + </td> |
691 | + <td width="30%"> |
692 | + <b>${ _('Name') }</b> |
693 | + </td> |
694 | + <td width="30%"> |
695 | + <b>${ _('WorkCenter') }</b> |
696 | + </td> |
697 | + <td width="12%"> |
698 | + <b>${ _('No. Of Cycles') }</b> |
699 | + </td> |
700 | + <td width="13%"> |
701 | + <b>${ _('No. Of Hours') }</b> |
702 | + </td> |
703 | + </tr> |
704 | + </table> |
705 | + %for line2 in o.workcenter_lines: |
706 | + <table width="100%" class="list_table2"> |
707 | + <tr> |
708 | + <td width="15%"> |
709 | + ${str(line2.sequence)} |
710 | + </td> |
711 | + <td width="30%"> |
712 | + ${line2.name} |
713 | + </td> |
714 | + <td width="30%"> |
715 | + ${line2.workcenter_id and line2.workcenter_id.name or ''} |
716 | + </td> |
717 | + <td width="12%"> |
718 | + ${formatLang(line2.cycle)} |
719 | + </td> |
720 | + <td width="13%"> |
721 | + ${formatLang(line2.hour)} |
722 | + </td> |
723 | + </tr> |
724 | + </table><br/> |
725 | + %endfor |
726 | + %endif |
727 | + |
728 | + <table class="title" width="100%"> |
729 | + <tr> |
730 | + <td width="100%"> |
731 | + <h3>${ _('Bill Of Material') }</h3> |
732 | + </td> |
733 | + </tr> |
734 | + </table> |
735 | + <table style="border-bottom:2px solid black;font-family: Helvetica; font-size:11px;" width="100%" > |
736 | + <tr> |
737 | + <td style="text-align:left; " width="55%"> |
738 | + <b>${ _('Product') }</b> |
739 | + </td> |
740 | + <td style="text-align:right;" width="10%"> |
741 | + <b>${ _('Quantity') }</b> |
742 | + </td> |
743 | + <td style="text-align:center;" width="20%"> |
744 | + <b>${ _('Source Location') }</b> |
745 | + </td> |
746 | + <td style="text-align:center;" width="15%"> |
747 | + <b>${ _('Destination Location') }</b> |
748 | + </td> |
749 | + </tr> |
750 | + </table> |
751 | + |
752 | + %if o.move_lines ==[]: |
753 | + |
754 | + %else: |
755 | + <table style="font-family: Helvetica; font-size:11px;" width="100%"> |
756 | + <tr> |
757 | + <td width="100%"> |
758 | + <b>${ _('Products to Consume') }</b> |
759 | + </td> |
760 | + </tr> |
761 | + </table> |
762 | + %for line in o.move_lines: |
763 | + <table width="100%" class="list_table"> |
764 | + <tr> |
765 | + <td style="text-align:left;" width="55%"> |
766 | + ${line.product_id and line.product_id.code or ''} ${line.product_id and line.product_id.name or ''} |
767 | + </td> |
768 | + <td style="text-align:right;" width="10%"> |
769 | + ${formatLang( line.product_qty)} ${line.product_uom and line.product_uom.name or ''} |
770 | + </td> |
771 | + <td style="text-align:center;"width="20%"> |
772 | + ${line.location_id and line.location_id.name or ''} |
773 | + </td> |
774 | + <td style="text-align:center;"width="15%"> |
775 | + ${line.location_dest_id and line.location_dest_id.name or ''} |
776 | + </td> |
777 | + </tr> |
778 | + </table> |
779 | + %endfor |
780 | + %endif |
781 | + |
782 | + %if o.move_lines2 ==[]: |
783 | + |
784 | + %else: |
785 | + <table class="title" width="100%"> |
786 | + <tr> |
787 | + <td width="100%"> |
788 | + <h5><b>${ _('Consumed Products') }</b></h5> |
789 | + </td> |
790 | + </tr> |
791 | + </table> |
792 | + %for line2 in o.move_lines2: |
793 | + <table width="100%" class="list_table1"> |
794 | + <tr> |
795 | + <td style="text-align:left;"width="55%"> |
796 | + ${line2.product_id and line2.product_id.code or ''} ${line2.product_id and line2.product_id.name or ''} |
797 | + </td> |
798 | + <td style="text-align:right;"width="10%"> |
799 | + ${formatLang( line2.product_qty)} ${line2.product_uom and line2.product_uom.name or ''} |
800 | + </td> |
801 | + <td style="text-align:center;"width="20%"> |
802 | + ${line2.location_id and line2.location_id.name or ''} |
803 | + </td> |
804 | + <td style="text-align:center;"width="15%"> |
805 | + ${line2.location_dest_id and line2.location_dest_id.name or ''} |
806 | + </td> |
807 | + </tr> |
808 | + </table> |
809 | + %endfor |
810 | + %endif |
811 | + <p style="page-break-after:always"></p> |
812 | + %endfor |
813 | + </body> |
814 | +</html> |
815 | |
816 | === added file 'mrp_webkit/report/order.py' |
817 | --- mrp_webkit/report/order.py 1970-01-01 00:00:00 +0000 |
818 | +++ mrp_webkit/report/order.py 2014-03-03 11:00:02 +0000 |
819 | @@ -0,0 +1,39 @@ |
820 | +# -*- coding: utf-8 -*- |
821 | +############################################################################## |
822 | +# |
823 | +# OpenERP, Open Source Management Solution |
824 | +# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>) |
825 | +# |
826 | +# This program is free software: you can redistribute it and/or modify |
827 | +# it under the terms of the GNU Affero General Public License as |
828 | +# published by the Free Software Foundation, either version 3 of the |
829 | +# License, or (at your option) any later version. |
830 | +# |
831 | +# This program is distributed in the hope that it will be useful, |
832 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
833 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
834 | +# GNU Affero General Public License for more details. |
835 | +# |
836 | +# You should have received a copy of the GNU Affero General Public License |
837 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
838 | +# |
839 | +############################################################################ |
840 | + |
841 | +import time |
842 | + |
843 | +from openerp.report import report_sxw |
844 | + |
845 | +class order(report_sxw.rml_parse): |
846 | + def __init__(self, cr, uid, name, context): |
847 | + super(order, self).__init__(cr, uid, name, context=context) |
848 | + self.localcontext.update({ |
849 | + 'time': time, |
850 | + }) |
851 | + |
852 | +report_sxw.report_sxw('report.mrp.production.order.webkit', |
853 | + 'mrp.production', |
854 | + 'addons/mrp_webkit/report/order.mako', |
855 | + parser=order, |
856 | + header='internal') |
857 | + |
858 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
Thanks