← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit into lp:openerp-mrp-reports

 

Nicola Malcontenti - Agile BG has proposed merging lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit into lp:openerp-mrp-reports.

Requested reviews:
  OpenERP Community Reviewer/Maintainer (openerp-community-reviewer)

For more details, see:
https://code.launchpad.net/~agilebg/openerp-mrp-reports/adding_mrp_webkit/+merge/207471

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
-- 
https://code.launchpad.net/~agilebg/openerp-mrp-reports/adding_mrp_webkit/+merge/207471
Your team OpenERP Community Reviewer/Maintainer is requested to review the proposed merge of lp:~agilebg/openerp-mrp-reports/adding_mrp_webkit into lp:openerp-mrp-reports.
=== added directory 'mrp_webkit'
=== added file 'mrp_webkit/.DS_Store'
Binary files mrp_webkit/.DS_Store	1970-01-01 00:00:00 +0000 and mrp_webkit/.DS_Store	2014-02-20 15:37:21 +0000 differ
=== added file 'mrp_webkit/__init__.py'
--- mrp_webkit/__init__.py	1970-01-01 00:00:00 +0000
+++ mrp_webkit/__init__.py	2014-02-20 15:37:21 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'mrp_webkit/__openerp__.py'
--- mrp_webkit/__openerp__.py	1970-01-01 00:00:00 +0000
+++ mrp_webkit/__openerp__.py	2014-02-20 15:37:21 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011-2013 Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+{
+    'name': 'MRP',
+    'version': '1.0',
+    'author': 'Serpent Consulting Services Pvt. Ltd.',
+    'website': 'http://www.serpentcs.com',
+    'category': 'Manufacturing',
+    'sequence': 18,
+    'summary': 'Manufacturing Orders, Bill of Materials, Routing',
+    'depends': ['mrp','report_webkit'],
+    'description': """
+Manage the Manufacturing process in OpenERP
+===========================================
+
+ It is conversion of rml report to Webkit Report.
+    
+    """,
+    'data': [
+        'mrp_report.xml',
+    ],
+    'installable': True,
+    'application': True,
+    'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== 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-20 15:37:21 +0000
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="bom webkit header" model="ir.header_webkit">
+            <field name="footer_html"><![CDATA[]]></field>
+            <field name="orientation">Portrait</field>
+            <field name="format">A4</field>
+            <field name="html"><![CDATA[
+   <html>
+    <head>
+            
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <script>
+            function subst() {
+                var vars={};
+                var x=document.location.search.substring(1).split('&');
+                for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+                if(vars['page']!=1){
+                   document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+                }
+                var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+                for(var i in x) {
+                    var y = document.getElementsByClassName(x[i]);
+                    for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+                }
+            }            
+        </script>
+        <style type="text/css">
+            ${css}
+        </style>
+    </head>
+    <body style="border:0; margin:0;" onload="subst()">
+        <table style="border:0" width="100%"> 
+            <tr>
+            	<td width="92%">
+                <td width="4%" style="text-align:right;font-size:10;width:350px;">&nbsp;<span class="page"/></td>
+                <td width="4%" style="text-align:left;font-size:10;width:30px">&nbsp;/&nbsp;<span class="topage"/></td>
+            </tr>
+        </table> ${_debug or ''|n}
+        <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
+            
+        </table>${_debug or ''|n}
+        <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
+            <tr >
+                	<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>
+                	<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>
+                 	<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>
+                	<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>
+            	</tr>
+        </table>
+    </body>
+</html>]]>
+            </field>
+            <field eval="15.0" name="margin_top"/>
+            <field eval="5.0" name="margin_bottom"/>
+            <field name="css"><![CDATA[
+            
+
+
+
+.basic_table{
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica-Bold;
+}
+.basic_table td {
+border-color:black;
+border-bottom:2px solid black;
+font-size:12px;
+}
+
+.list_table {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table td {
+border-bottom:1px solid #ccc;
+font-size:12px;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+.list_table1 {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table1 td {
+border-color:gray;
+border-bottom:2px solid gray;
+font-size:12px;
+
+}
+.list_table2 {
+border-color:black;
+border-collapse: collapse;
+
+}
+.list_table2 td {
+border-color:black;
+border-top:2px solid black;
+border-bottom:2px solid black;
+font-size:12;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+.list_table th {
+border-bottom:2px solid black;
+text-align:left; 
+font-size:12px;
+font-weight:bold;
+padding-left:3px
+padding-right:3px
+}
+
+.list_tabe thead {
+    display:table-header-group;
+}
+
+
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+} 
+table {
+              display: table;
+              width: 100%;
+            }
+            
+            table thead {
+              display: table-header-group;
+            }
+            
+            table tbody {
+              display: table-row-group;
+            }
+            
+            table tfoot {
+              display: table-footer-group;
+            }
+            
+            table tr {
+              display: table-row;
+              height: auto;
+            }
+            
+            table th,
+            table td {
+              display: table-cell;
+              overflow: visible;
+            }
+            
+            table th,
+            table td {
+              height: 1px; /* Do the trick to make div.nobrk fill td height */
+            }
+            
+            table tr.singlecell td,
+            table tr.singlecell th {
+              height: auto; /* Reset trick for a full row td */
+            }
+            
+            .nobrk {
+              page-break-inside: avoid;
+              orphans: 10;
+              widows: 10;
+              position: relative;
+              margin: -1px 0 0 -1px;
+              min-height: 14px;
+              line-height: 14px;
+              height: 100%;
+            }
+            
+            table tbody td .nobrk {
+              min-height: 5px;
+            }
+            ]]>
+            </field>
+            <field name="name">bom webkit header</field>
+        </record>
+		
+<record id="production webkit header" model="ir.header_webkit">
+            <field name="footer_html"><![CDATA[]]></field>
+            <field name="orientation">Portrait</field>
+            <field name="format">A4</field>
+            <field name="html"><![CDATA[
+   <html>
+    <head>
+            
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <script>
+            function subst() {
+                var vars={};
+                var x=document.location.search.substring(1).split('&');
+                for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+                if(vars['page']!=1){
+                   document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+                }
+                var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+                for(var i in x) {
+                    var y = document.getElementsByClassName(x[i]);
+                    for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+                }
+            }            
+        </script>
+        <style type="text/css">
+            ${css}
+        </style>
+    </head>
+    <body style="border:0; margin:0;" onload="subst()">
+           <table class="header" style="border-bottom: 1px solid black; width: 100%">
+            <tr >
+                <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>
+                <td style="text-align:center;font-size:14; font-family: Helvetica-Bold;" width="75%"><b>${company.partner_id.name |entity}</b></td>
+                <td width="5%" style="text-align:right;font-size:10;width:350px; font-family: Helvetica-Bold;" >&nbsp;<span class="page"/></td>
+                <td width="5%" style="text-align:left;font-size:10;width:30px font-family: Helvetica-Bold;">&nbsp;/&nbsp;<span class="topage"/></td>
+            </tr>
+        </table> ${_debug or ''|n}
+        <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
+            
+        </table>${_debug or ''|n}
+        <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
+            <tr >
+                	
+            </tr>
+        </table>
+    </body>
+</html>]]>
+            </field>
+            <field eval="15.0" name="margin_top"/>
+            <field eval="5.0" name="margin_bottom"/>
+            <field name="css"><![CDATA[
+            
+.basic_table{
+border-collapse: collapse;
+font-family: Helvetica-Bold;
+}
+.basic_table td {
+border-color:black;
+border-bottom:2px solid black;
+
+}
+
+ .title{
+ text-align:left
+ font-family: Helvetica-Bold;
+ font-size:12px; 
+}
+
+.list_table {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table td {
+border-color:gray;
+border-bottom:1px solid gray;
+font-size:12px;
+
+}
+.list_table1 {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+font-size:12px;
+}
+.list_table1 td {
+border-color:gray;
+border-bottom:1px solid gray;
+
+
+}
+.list_table2 {
+text-align:center;
+border-collapse: collapse;
+}
+.list_table2 td {
+			border:1px solid lightGrey;
+			border-collapse: collapse;
+			font-family: Helvetica;
+            font-size:11px;
+			}
+
+}
+
+            ]]>
+            </field>
+            <field name="name">production webkit header</field>
+        </record>
+
+        <report 
+        	auto="True" 
+        	header="False" 
+        	id="report_bom_structure" 
+        	model="mrp.bom" 
+        	name="bom.structure.webkit" 
+        	file="mrp_webkit/report/bom_structure.mako" 
+        	string="BOM Structure" 
+        	report_type="webkit"
+        	webkit_header="bom webkit header"/>
+
+        <report 
+            id="report_mrp_production_report"
+            string="Production Order"
+            model="mrp.production"
+            name="mrp.production.order.webkit"
+            file="mrp_webkit/report/order.mako"
+            auto="False"
+        	report_type="webkit"
+        	webkit_header="production webkit header"
+            />
+
+    </data>
+</openerp>

=== added directory 'mrp_webkit/report'
=== added file 'mrp_webkit/report/.DS_Store'
Binary files mrp_webkit/report/.DS_Store	1970-01-01 00:00:00 +0000 and mrp_webkit/report/.DS_Store	2014-02-20 15:37:21 +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-20 15:37:21 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import order
+import bom_structure
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== 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-20 15:37:21 +0000
@@ -0,0 +1,66 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+<html xmlns="http://www.w3.org/1999/xhtml";>
+    <head>
+        <style type="text/css">
+            ${css}
+        </style>
+        <title>BOM Structure.pdf</title>        
+    </head>
+    <body>
+       <table  width="100%">
+            <tr>
+                <td style="text-align:center;">
+                    <h2><b>${ _('BOM Structure') }  </b></h2>
+                </td>
+            </tr>
+       </table>
+            
+       <table width="100%" class="basic_table">
+            <tr >
+                <td style="text-align:left;" width="35%"><b>${ _('BOM Name') }</b></td>
+                <td style="text-align:left;" width="35%"><b>${ _('Product Name') }</b></td>
+                <td style="text-align:right;" width="15%"><b>${ _('Quantity') }<b></td>
+                <td style="text-align:center;" width="15%"><b>${ _('BOM Ref') }</b></td>
+            </tr>
+       </table>
+       %for o in objects:
+            <table width="100%" class="list_table1">
+                <tr >
+                    <td style="text-align:left;" width="35%"><b>
+                        ${o.name}</b>
+                    </td>
+                    <td style="text-align:left;" width="35%"><b>
+                       [ ${(o.product_id.default_code) or removeParentNode('font')}] ${o.product_id.name}</b>
+                    </td>
+                    <td style="text-align:right;" width="15%"><b>
+                        ${o.product_qty} ${o.product_uom.name}</b>
+                    </td>
+                    <td style="text-align:center;" width="15%"><b>
+                        ${o.code or ''}</b>
+                    </td><br/>
+                </tr>
+            </table>
+            
+            %for l in get_children(o.bom_lines):
+                <table width="100%" class="list_table">
+                    <tr>
+                        <td style="text-align:left ; padding-left:10px" width="35%" class="cell_extended_gray">
+                            <font color="white" >${'... '*(l['level'])}</font> - ${l['name']}
+                        </td>
+                        <td style="text-align:left;" width="35%" class="cell_extended_gray">
+                            ${ (l['pcode']) or '' } ${l['pname']}
+                        </td>
+                        <td style="text-align:right;" width="15%" class="cell_extended_gray">
+                            ${l['pqty']} ${l['uname']}
+                        </td>
+                        <td style="text-align:center;" width="15%" class="cell_extended_gray">
+                            ${l['code'] or ''}
+                        </td>
+                   </tr>
+              </table>
+           %endfor
+           </br>
+      %endfor
+</body>
+</html>
\ No newline at end of file

=== 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-20 15:37:21 +0000
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from openerp import pooler
+
+class bom_structure(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(bom_structure, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'time': time,
+            'get_children':self.get_children,
+        })
+
+    def get_children(self, object, level=0):
+        result = []
+
+        def _get_rec(object, level):
+            for l in object:
+                res = {}
+                res['name'] = l.name
+                res['pname'] = l.product_id.name
+                res['pcode'] = l.product_id.default_code
+                res['pqty'] = l.product_qty
+                res['uname'] = l.product_uom.name
+                res['code'] = l.code
+                res['level'] = level
+                result.append(res)
+                if l.child_complete_ids:
+                    if level<6:
+                        level += 1
+                    _get_rec(l.child_complete_ids,level)
+                    if level>0 and level<6:
+                        level -= 1
+            return result
+
+        children = _get_rec(object,level)
+
+        return children
+
+report_sxw.report_sxw('report.bom.structure.webkit','mrp.bom','mrp_webkit/report/bom_structure.mako',parser=bom_structure,header='internal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== 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-20 15:37:21 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+
+class order(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(order, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'time': time,
+        })
+
+report_sxw.report_sxw('report.mrp.production.order.webkit','mrp.production','addons/mrp_webkit/report/order.mako',parser=order,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


Follow ups