Merge lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit into lp:~openerp-community-reviewer/openerp-mrp-reports/7.0

Proposed by Nicola Malcontenti - Agile BG
Status: Rejected
Rejected by: Yannick Vaucher @ Camptocamp
Proposed branch: lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit
Merge into: lp:~openerp-community-reviewer/openerp-mrp-reports/7.0
Diff against target: 638 lines (+597/-0)
7 files modified
mrp_webkit/__init__.py (+23/-0)
mrp_webkit/__openerp__.py (+47/-0)
mrp_webkit/mrp_report.xml (+330/-0)
mrp_webkit/report/__init__.py (+24/-0)
mrp_webkit/report/bom_structure.mako (+66/-0)
mrp_webkit/report/bom_structure.py (+68/-0)
mrp_webkit/report/order.py (+39/-0)
To merge this branch: bzr merge lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Disapprove
Lorenzo Battistini (community) Needs Fixing
Review via email: mp+207471@code.launchpad.net

Description of the change

Hi,
I've made this Merge Proposal to add mrp_webkit in this branch such as is written here https://twitter.com/eLBaddi/status/433245831563448321

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Ciao Nico

you should remove mrp_webkit/.DS_Store
and run a PEP8 validator

When importing Python modules from the same addon, use explicit relative import rather than absolute import, example in __init__.py, do not use:
    import sale
  But
    from . import sale

line 552: osv is not used

review: Needs Fixing
2. By Hurrinico

[FIX] Community fix

Revision history for this message
Nicola Malcontenti - Agile BG (hurrin1c0) wrote :

> Ciao Nico
>
> you should remove mrp_webkit/.DS_Store
> and run a PEP8 validator
>
> When importing Python modules from the same addon, use explicit relative
> import rather than absolute import, example in __init__.py, do not use:
> import sale
> But
> from . import sale
>
> line 552: osv is not used
fixed

Revision history for this message
Lorenzo Battistini (elbati) wrote :

line 418: added file 'mrp_webkit/report/.DS_Store'
line 594: there's something wrong with symlink

review: Needs Fixing
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

I did the MP again, using bazaar extractor to preserve the original authors.

review: Disapprove
Revision history for this message
Lorenzo Battistini (elbati) wrote :

On 03/03/2014 11:58 AM, Alexandre Fayolle - camptocamp wrote:
> Review: Disapprove
>
> I did the MP again, using bazaar extractor to preserve the original authors.

Thanks Alexandre.

Here is the link
https://code.launchpad.net/~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_webkit-afe/+merge/209039
<https://code.launchpad.net/%7Ecamptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_webkit-afe/+merge/209039>

Unmerged revisions

2. By Hurrinico

[FIX] Community fix

1. By Hurrinico

[FIX] Add mrp_webkit

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'mrp_webkit'
=== added file 'mrp_webkit/__init__.py'
--- mrp_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/__init__.py 2014-02-26 09:55:33 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services
6# (<http://www.serpentcs.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21############################################################################
22
23from . import report
024
=== added file 'mrp_webkit/__openerp__.py'
--- mrp_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/__openerp__.py 2014-02-26 09:55:33 +0000
@@ -0,0 +1,47 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services Pvt.
6# Ltd.(<http://www.serpentcs.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21############################################################################
22
23
24{
25 'name': 'MRP',
26 'version': '1.0',
27 'author': 'Serpent Consulting Services Pvt. Ltd.',
28 'website': 'http://www.serpentcs.com',
29 'category': 'Manufacturing',
30 'sequence': 18,
31 'summary': 'Manufacturing Orders, Bill of Materials, Routing',
32 'depends': ['mrp', 'report_webkit'],
33 'description': """
34Manage the Manufacturing process in OpenERP
35===========================================
36
37 It is conversion of rml report to Webkit Report.
38
39 """,
40 'data': [
41 'mrp_report.xml',
42 ],
43 'installable': True,
44 'application': True,
45 'auto_install': False,
46}
47# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
048
=== added file 'mrp_webkit/mrp_report.xml'
--- mrp_webkit/mrp_report.xml 1970-01-01 00:00:00 +0000
+++ mrp_webkit/mrp_report.xml 2014-02-26 09:55:33 +0000
@@ -0,0 +1,330 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="bom webkit header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[]]></field>
6 <field name="orientation">Portrait</field>
7 <field name="format">A4</field>
8 <field name="html"><![CDATA[
9 <html>
10 <head>
11
12 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
13 <script>
14 function subst() {
15 var vars={};
16 var x=document.location.search.substring(1).split('&');
17 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
18 if(vars['page']!=1){
19 document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
20 }
21 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
22 for(var i in x) {
23 var y = document.getElementsByClassName(x[i]);
24 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
25 }
26 }
27 </script>
28 <style type="text/css">
29 ${css}
30 </style>
31 </head>
32 <body style="border:0; margin:0;" onload="subst()">
33 <table style="border:0" width="100%">
34 <tr>
35 <td width="92%">
36 <td width="4%" style="text-align:right;font-size:10;width:350px;">&nbsp;<span class="page"/></td>
37 <td width="4%" style="text-align:left;font-size:10;width:30px">&nbsp;/&nbsp;<span class="topage"/></td>
38 </tr>
39 </table> ${_debug or ''|n}
40 <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
41
42 </table>${_debug or ''|n}
43 <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
44 <tr >
45 <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>
46 <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>
47 <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>
48 <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>
49 </tr>
50 </table>
51 </body>
52</html>]]>
53 </field>
54 <field eval="15.0" name="margin_top"/>
55 <field eval="5.0" name="margin_bottom"/>
56 <field name="css"><![CDATA[
57
58
59
60
61.basic_table{
62border-color:black;
63border-collapse: collapse;
64font-family: Helvetica-Bold;
65}
66.basic_table td {
67border-color:black;
68border-bottom:2px solid black;
69font-size:12px;
70}
71
72.list_table {
73border-color:black;
74border-collapse: collapse;
75font-family: Helvetica;
76}
77.list_table td {
78border-bottom:1px solid #ccc;
79font-size:12px;
80padding-left:3px
81padding-right:3px
82padding-top:3px
83padding-bottom:3px
84}
85.list_table1 {
86border-color:black;
87border-collapse: collapse;
88font-family: Helvetica;
89}
90.list_table1 td {
91border-color:gray;
92border-bottom:2px solid gray;
93font-size:12px;
94
95}
96.list_table2 {
97border-color:black;
98border-collapse: collapse;
99
100}
101.list_table2 td {
102border-color:black;
103border-top:2px solid black;
104border-bottom:2px solid black;
105font-size:12;
106padding-left:3px
107padding-right:3px
108padding-top:3px
109padding-bottom:3px
110}
111.list_table th {
112border-bottom:2px solid black;
113text-align:left;
114font-size:12px;
115font-weight:bold;
116padding-left:3px
117padding-right:3px
118}
119
120.list_tabe thead {
121 display:table-header-group;
122}
123
124
125.total {
126width:100%;
127}
128.lib {
129width:10.3%;
130}
131.tot {
132text-align:left;
133width:15%;
134}
135.righttot {
136width:74%;
137}
138.tax {
139width:50%;
140}
141table {
142 display: table;
143 width: 100%;
144 }
145
146 table thead {
147 display: table-header-group;
148 }
149
150 table tbody {
151 display: table-row-group;
152 }
153
154 table tfoot {
155 display: table-footer-group;
156 }
157
158 table tr {
159 display: table-row;
160 height: auto;
161 }
162
163 table th,
164 table td {
165 display: table-cell;
166 overflow: visible;
167 }
168
169 table th,
170 table td {
171 height: 1px; /* Do the trick to make div.nobrk fill td height */
172 }
173
174 table tr.singlecell td,
175 table tr.singlecell th {
176 height: auto; /* Reset trick for a full row td */
177 }
178
179 .nobrk {
180 page-break-inside: avoid;
181 orphans: 10;
182 widows: 10;
183 position: relative;
184 margin: -1px 0 0 -1px;
185 min-height: 14px;
186 line-height: 14px;
187 height: 100%;
188 }
189
190 table tbody td .nobrk {
191 min-height: 5px;
192 }
193 ]]>
194 </field>
195 <field name="name">bom webkit header</field>
196 </record>
197
198<record id="production webkit header" model="ir.header_webkit">
199 <field name="footer_html"><![CDATA[]]></field>
200 <field name="orientation">Portrait</field>
201 <field name="format">A4</field>
202 <field name="html"><![CDATA[
203 <html>
204 <head>
205
206 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
207 <script>
208 function subst() {
209 var vars={};
210 var x=document.location.search.substring(1).split('&');
211 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
212 if(vars['page']!=1){
213 document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
214 }
215 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
216 for(var i in x) {
217 var y = document.getElementsByClassName(x[i]);
218 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
219 }
220 }
221 </script>
222 <style type="text/css">
223 ${css}
224 </style>
225 </head>
226 <body style="border:0; margin:0;" onload="subst()">
227 <table class="header" style="border-bottom: 1px solid black; width: 100%">
228 <tr >
229 <td style="text-align:right;font-size:10;font-family: Helvetica-Bold;" width="15%">${ formatLang(time.strftime('%Y-%m-%d'),date=True)}&nbsp;${time.strftime('%I:%M')}</td>
230 <td style="text-align:center;font-size:14; font-family: Helvetica-Bold;" width="75%"><b>${company.partner_id.name |entity}</b></td>
231 <td width="5%" style="text-align:right;font-size:10;width:350px; font-family: Helvetica-Bold;" >&nbsp;<span class="page"/></td>
232 <td width="5%" style="text-align:left;font-size:10;width:30px font-family: Helvetica-Bold;">&nbsp;/&nbsp;<span class="topage"/></td>
233 </tr>
234 </table> ${_debug or ''|n}
235 <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
236
237 </table>${_debug or ''|n}
238 <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
239 <tr >
240
241 </tr>
242 </table>
243 </body>
244</html>]]>
245 </field>
246 <field eval="15.0" name="margin_top"/>
247 <field eval="5.0" name="margin_bottom"/>
248 <field name="css"><![CDATA[
249
250.basic_table{
251border-collapse: collapse;
252font-family: Helvetica-Bold;
253}
254.basic_table td {
255border-color:black;
256border-bottom:2px solid black;
257
258}
259
260 .title{
261 text-align:left
262 font-family: Helvetica-Bold;
263 font-size:12px;
264}
265
266.list_table {
267border-color:black;
268border-collapse: collapse;
269font-family: Helvetica;
270}
271.list_table td {
272border-color:gray;
273border-bottom:1px solid gray;
274font-size:12px;
275
276}
277.list_table1 {
278border-color:black;
279border-collapse: collapse;
280font-family: Helvetica;
281font-size:12px;
282}
283.list_table1 td {
284border-color:gray;
285border-bottom:1px solid gray;
286
287
288}
289.list_table2 {
290text-align:center;
291border-collapse: collapse;
292}
293.list_table2 td {
294 border:1px solid lightGrey;
295 border-collapse: collapse;
296 font-family: Helvetica;
297 font-size:11px;
298 }
299
300}
301
302 ]]>
303 </field>
304 <field name="name">production webkit header</field>
305 </record>
306
307 <report
308 auto="True"
309 header="False"
310 id="report_bom_structure"
311 model="mrp.bom"
312 name="bom.structure.webkit"
313 file="mrp_webkit/report/bom_structure.mako"
314 string="BOM Structure"
315 report_type="webkit"
316 webkit_header="bom webkit header"/>
317
318 <report
319 id="report_mrp_production_report"
320 string="Production Order"
321 model="mrp.production"
322 name="mrp.production.order.webkit"
323 file="mrp_webkit/report/order.mako"
324 auto="False"
325 report_type="webkit"
326 webkit_header="production webkit header"
327 />
328
329 </data>
330</openerp>
0331
=== added directory 'mrp_webkit/report'
=== added file 'mrp_webkit/report/.DS_Store'
1Binary files mrp_webkit/report/.DS_Store 1970-01-01 00:00:00 +0000 and mrp_webkit/report/.DS_Store 2014-02-26 09:55:33 +0000 differ332Binary files mrp_webkit/report/.DS_Store 1970-01-01 00:00:00 +0000 and mrp_webkit/report/.DS_Store 2014-02-26 09:55:33 +0000 differ
=== added file 'mrp_webkit/report/__init__.py'
--- mrp_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/__init__.py 2014-02-26 09:55:33 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services
6# (<http://www.serpentcs.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21############################################################################
22
23from . import order
24from . import bom_structure
025
=== added file 'mrp_webkit/report/bom_structure.mako'
--- mrp_webkit/report/bom_structure.mako 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/bom_structure.mako 2014-02-26 09:55:33 +0000
@@ -0,0 +1,66 @@
1<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3<html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <style type="text/css">
6 ${css}
7 </style>
8 <title>BOM Structure.pdf</title>
9 </head>
10 <body>
11 <table width="100%">
12 <tr>
13 <td style="text-align:center;">
14 <h2><b>${ _('BOM Structure') } </b></h2>
15 </td>
16 </tr>
17 </table>
18
19 <table width="100%" class="basic_table">
20 <tr >
21 <td style="text-align:left;" width="35%"><b>${ _('BOM Name') }</b></td>
22 <td style="text-align:left;" width="35%"><b>${ _('Product Name') }</b></td>
23 <td style="text-align:right;" width="15%"><b>${ _('Quantity') }<b></td>
24 <td style="text-align:center;" width="15%"><b>${ _('BOM Ref') }</b></td>
25 </tr>
26 </table>
27 %for o in objects:
28 <table width="100%" class="list_table1">
29 <tr >
30 <td style="text-align:left;" width="35%"><b>
31 ${o.name}</b>
32 </td>
33 <td style="text-align:left;" width="35%"><b>
34 [ ${(o.product_id.default_code) or removeParentNode('font')}] ${o.product_id.name}</b>
35 </td>
36 <td style="text-align:right;" width="15%"><b>
37 ${o.product_qty} ${o.product_uom.name}</b>
38 </td>
39 <td style="text-align:center;" width="15%"><b>
40 ${o.code or ''}</b>
41 </td><br/>
42 </tr>
43 </table>
44
45 %for l in get_children(o.bom_lines):
46 <table width="100%" class="list_table">
47 <tr>
48 <td style="text-align:left ; padding-left:10px" width="35%" class="cell_extended_gray">
49 <font color="white" >${'... '*(l['level'])}</font> - ${l['name']}
50 </td>
51 <td style="text-align:left;" width="35%" class="cell_extended_gray">
52 ${ (l['pcode']) or '' } ${l['pname']}
53 </td>
54 <td style="text-align:right;" width="15%" class="cell_extended_gray">
55 ${l['pqty']} ${l['uname']}
56 </td>
57 <td style="text-align:center;" width="15%" class="cell_extended_gray">
58 ${l['code'] or ''}
59 </td>
60 </tr>
61 </table>
62 %endfor
63 </br>
64 %endfor
65</body>
66</html>
0\ No newline at end of file67\ No newline at end of file
168
=== added file 'mrp_webkit/report/bom_structure.py'
--- mrp_webkit/report/bom_structure.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/bom_structure.py 2014-02-26 09:55:33 +0000
@@ -0,0 +1,68 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services
6# (<http://www.serpentcs.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21############################################################################
22
23import time
24from openerp.report import report_sxw
25from openerp.osv import osv
26from openerp import pooler
27
28
29class bom_structure(report_sxw.rml_parse):
30 def __init__(self, cr, uid, name, context):
31 super(bom_structure, self).__init__(cr, uid, name, context=context)
32 self.localcontext.update({
33 'time': time,
34 'get_children': self.get_children,
35 })
36
37 def get_children(self, object, level=0):
38 result = []
39
40 def _get_rec(object, level):
41 for l in object:
42 res = {}
43 res['name'] = l.name
44 res['pname'] = l.product_id.name
45 res['pcode'] = l.product_id.default_code
46 res['pqty'] = l.product_qty
47 res['uname'] = l.product_uom.name
48 res['code'] = l.code
49 res['level'] = level
50 result.append(res)
51 if l.child_complete_ids:
52 if level < 6:
53 level += 1
54 _get_rec(l.child_complete_ids, level)
55 if level > 0 and level < 6:
56 level -= 1
57 return result
58
59 children = _get_rec(object, level)
60
61 return children
62
63report_sxw.report_sxw(
64 'report.bom.structure.webkit',
65 'mrp.bom',
66 'mrp_webkit/report/bom_structure.mako',
67 parser=bom_structure,
68 header='internal')
069
=== added symlink 'mrp_webkit/report/order.mako'
=== target is u'../../../../src/mako/mrp_order.mako'
=== added file 'mrp_webkit/report/order.py'
--- mrp_webkit/report/order.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/order.py 2014-02-26 09:55:33 +0000
@@ -0,0 +1,39 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services
6# (<http://www.serpentcs.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21############################################################################
22
23import time
24from openerp.report import report_sxw
25
26
27class order(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(order, self).__init__(cr, uid, name, context=context)
30 self.localcontext.update({
31 'time': time,
32 })
33
34report_sxw.report_sxw(
35 'report.mrp.production.order.webkit',
36 'mrp.production',
37 'addons/mrp_webkit/report/order.mako',
38 parser=order,
39 header='internal')

Subscribers

People subscribed via source and target branches