浏览代码

Informe para producción con diferentes filtros

Sebas 5 年之前
当前提交
9e8fc4d981

+ 23 - 0
__init__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Cybrosys Technologies Pvt. Ltd.
+#    Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
+#    Author: Cybrosys Technologies(<http://www.cybrosys.com>)
+#    you can modify it under the terms of the GNU LESSER
+#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import report
+import wizards
+

二进制
__init__.pyc


+ 31 - 0
__openerp__.py

@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Mrp Reports',
+    'version': '8.0.1.0.0',
+    'summary': 'PDF & XLS Informe para Modulo MRP.',
+    'description': 'PDF & XLS Informe para Modulo MRP con varios filtros.',
+    'category': 'Manufacturing',
+    'author': 'Eiru Software',
+    'website': "http://www.eiru.com.py",
+    'depends': ['base', 'mrp', 'report_xls','eiru_mrp_cost'],
+    'data': [
+        'views/eirumrp_wizard_view.xml',
+        'views/eirumrp_report_template.xml'
+    ],
+    'license': 'LGPL-3',
+    'installable': True,
+    'auto_install': False,
+    'application': False,
+}

+ 22 - 0
report/__init__.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Cybrosys Technologies Pvt. Ltd.
+#    Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
+#    Author: Cybrosys Technologies(<http://www.cybrosys.com>)
+#    you can modify it under the terms of the GNU LESSER
+#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import mrp_parser
+import eirumrp_report_xls

二进制
report/__init__.pyc


+ 298 - 0
report/eirumrp_report_xls.py

@@ -0,0 +1,298 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import xlwt
+import datetime
+from openerp.addons.report_xls.report_xls import report_xls
+
+
+def get_xls(obj):
+    getvals = {
+        'name': obj.name,
+        'product': obj.product_id.name,
+        'product_qty': obj.product_qty,
+        'product_uom': obj.product_uom.name,
+	    'prod_price_unit': obj.prod_price_unit,
+        'product_price': obj.product_price,
+        'user_id': obj.user_id.name,
+        'date_planned': obj.date_planned,
+        'state': obj.state,
+    }
+    templist1 = [(1, 3, 0, 'text', getvals['name']),
+                 (2, 3, 0, 'text', getvals['product']),
+                 (3, 2, 0, 'text', getvals['product_qty']),
+                 (4, 2, 0, 'text', getvals['product_uom']),
+		         (5, 2, 0, 'text', getvals['prod_price_unit']),
+ 		         (6, 2, 0, 'text', getvals['product_price']),
+                 (7, 2, 0, 'text', getvals['user_id']),
+                 (8, 1, 0, 'text', getvals['date_planned']),
+                 (9, 1, 0, 'text', getvals['state']),
+                 ]
+    return templist1
+
+
+class MrpXlsReport(report_xls):
+
+    def generate_xls_report(self, _p, _xs, data, objects, wb):
+            report_name = "Ordenes de producción"
+            ws = wb.add_sheet(report_name[:31])
+            ws.panes_frozen = True
+            ws.remove_splits = True
+            ws.portrait = 1
+            ws.fit_width_to_pages = 1
+            row_pos = 0
+            ws.set_horz_split_pos(row_pos)
+            ws.header_str = self.xls_headers['standard']
+            ws.footer_str = self.xls_footers['standard']
+            _xs.update({
+                'xls_title': 'font: bold true, height 350;'
+            })
+            _xs.update({
+                'xls_sub_title': 'font: bold false, height 250;'
+            })
+            cell_style = xlwt.easyxf(_xs['xls_title'] + _xs['center'])
+            cell_center = xlwt.easyxf(_xs['center'])
+            cell_center_bold_no = xlwt.easyxf(_xs['center'] + _xs['bold'])
+            cell_left_b = xlwt.easyxf(_xs['left'] + _xs['bold'])
+            c_specs = [('report_name', 8, 0, 'text', report_name)]
+            row_pos += 1
+            row_data = self.xls_row_template(c_specs, ['report_name'])
+            row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=cell_style)
+            ws.row(row_pos - 1).height_mismatch = True
+            ws.row(row_pos - 1).height = 220 * 2
+            row_pos += 1
+            date_report = "Fecha del informe :" + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M %p"))
+            top2 = [('entry1', 3, 0, 'text', date_report)]
+            row_data = self.xls_row_template(top2, [x[0] for x in top2])
+            row_pos = self.xls_write_row(ws, row_pos, row_data, cell_left_b)
+            row_pos += 1
+
+            templist = [(1, 3, 0, 'text', 'Referencia'),
+                        (2, 3, 0, 'text', 'Producto'),
+                        (3, 2, 0, 'text', 'Cantidad'),
+                        (4, 2, 0, 'text', 'Unidad'),
+ 			            (5, 2, 0, 'text', 'Costo unit.'),
+ 			            (6, 2, 0, 'text', 'Costo Prod.'),
+                        (7, 2, 0, 'text', 'Responsable'),
+                        (8, 1, 0, 'text', 'Fecha inicio'),
+                        (9, 1, 0, 'text', 'Estado'), ]
+            row_pos += 1
+            row_data = self.xls_row_template(templist, [x[0] for x in templist])
+            row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center_bold_no)
+
+            if data['filter'] is True:
+                if data['filter_user'] is True:
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is not False:
+                        for k in range(0, len(data['product'])):
+                            for l in range(0, len(data['responsible'])):
+                                for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                    obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                    if (data['date_from'] <= obj.date_planned) \
+                                            and (data['date_to'] >= obj.date_planned) \
+                                            and obj.state == data['stage'] \
+                                            and obj.product_id.id == data['product'][k] \
+                                            and obj.user_id.id == data['responsible'][l]:
+                                        templist1 = get_xls(obj)
+
+                                        row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                        row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    elif len(data['product']) == 0 and data['stage'] is not False:
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.state == data['stage'] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is False:
+                        for k in range(0, len(data['product'])):
+                            for l in range(0, len(data['responsible'])):
+                                for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                    obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                    if (data['date_from'] <= obj.date_planned) \
+                                            and (data['date_to'] >= obj.date_planned) \
+                                            and obj.product_id.id == data['product'][k] \
+                                            and obj.user_id.id == data['responsible'][l]:
+                                        templist1 = get_xls(obj)
+
+                                        row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                        row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) == 0 \
+                            and data['stage'] is False:
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                if data['filter_user'] is False:
+                    if len(data['product']) > 0 \
+                            and data['stage'] is not False:
+                        for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.state == data['stage'] \
+                                        and obj.product_id.id == data['product'][k]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    elif len(data['product']) == 0 and data['stage'] is not False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned) \
+                                    and obj.state == data['stage']:
+                                templist1 = get_xls(obj)
+
+                                row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is False:
+                        for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.product_id.id == data['product'][k]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) == 0 \
+                            and data['stage'] is False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned):
+                                templist1 = get_xls(obj)
+
+                                row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+            if data['filter'] is False:
+                if data['filter_user'] is True:
+                    if len(data['product']) > 0 \
+                            and data['stage'] is not False:
+                        for k in range(0, len(data['product'])):
+                            for l in range(0, len(data['responsible'])):
+                                for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                    obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                    if obj.state == data['stage'] \
+                                            and obj.product_id.id == data['product'][k] \
+                                            and obj.user_id.id == data['responsible'][l]:
+                                        templist1 = get_xls(obj)
+
+                                        row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                        row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    elif len(data['product']) == 0 and data['stage'] is not False:
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.state == data['stage'] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is False:
+                        for k in range(0, len(data['product'])):
+                            for l in range(0, len(data['responsible'])):
+                                for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                    obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                    if obj.product_id.id == data['product'][k] \
+                                            and obj.user_id.id == data['responsible'][l]:
+                                        templist1 = get_xls(obj)
+
+                                        row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                        row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) == 0 \
+                            and data['stage'] is False:
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.user_id.id == data['responsible'][l]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                if data['filter_user'] is False:
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is not False:
+                        for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.state == data['stage'] \
+                                        and obj.product_id.id == data['product'][k]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    elif len(data['product']) == 0 and data['stage'] is not False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if obj.state == data['stage']:
+                                templist1 = get_xls(obj)
+
+                                row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) > 0 \
+                            and data['stage'] is False:
+                        for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.product_id.id == data['product'][k]:
+                                    templist1 = get_xls(obj)
+
+                                    row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                                    row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+                    if len(data['product']) == 0 \
+                            and data['stage'] is False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            templist1 = get_xls(obj)
+
+                            row_data = self.xls_row_template(templist1, [x[0] for x in templist1])
+                            row_pos = self.xls_write_row(ws, row_pos, row_data, cell_center)
+
+MrpXlsReport('report.eirumrp_reports_xls', 'mrp.production')

二进制
report/eirumrp_report_xls.pyc


+ 198 - 0
report/mrp_parser.py

@@ -0,0 +1,198 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import datetime
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+
+class MrpReport(report_sxw.rml_parse):
+
+    def __init__(self, cr, uid, name, context=None):
+        super(MrpReport, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'get_details': self.get_details,
+            'get_date': self.get_date,
+        })
+        self.context = context
+
+    def get_date(self):
+        date = datetime.datetime.now()
+        return date
+
+    def get_details(self, data):
+        lines = []
+
+        if data['filter'] is True:
+            if data['filter_user'] is True:
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is not False:
+                    for k in range(0, len(data['product'])):
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.state == data['stage'] \
+                                        and obj.product_id.id == data['product'][k] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    lines.append(obj)
+
+                elif len(data['product']) == 0 and data['stage'] is not False:
+                    for l in range(0, len(data['responsible'])):
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned) \
+                                    and obj.state == data['stage'] \
+                                    and obj.user_id.id == data['responsible'][l]:
+                                lines.append(obj)
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is False:
+                    for k in range(0, len(data['product'])):
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.product_id.id == data['product'][k] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    lines.append(obj)
+
+                if len(data['product']) == 0 \
+                        and data['stage'] is False:
+                    for l in range(0, len(data['responsible'])):
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned) \
+                                    and obj.user_id.id == data['responsible'][l]:
+                                lines.append(obj)
+            if data['filter_user'] is False:
+                if len(data['product']) > 0 \
+                        and data['stage'] is not False:
+                    for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.state == data['stage'] \
+                                        and obj.product_id.id == data['product'][k]:
+                                    lines.append(obj)
+
+                elif len(data['product']) == 0 and data['stage'] is not False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned) \
+                                    and obj.state == data['stage']:
+                                lines.append(obj)
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is False:
+                    for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if (data['date_from'] <= obj.date_planned) \
+                                        and (data['date_to'] >= obj.date_planned) \
+                                        and obj.product_id.id == data['product'][k]:
+                                    lines.append(obj)
+
+                if len(data['product']) == 0 \
+                        and data['stage'] is False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if (data['date_from'] <= obj.date_planned) \
+                                    and (data['date_to'] >= obj.date_planned):
+                                lines.append(obj)
+
+        if data['filter'] is False:
+            if data['filter_user'] is True:
+                if len(data['product']) > 0 \
+                        and data['stage'] is not False:
+                    for k in range(0, len(data['product'])):
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.state == data['stage'] \
+                                        and obj.product_id.id == data['product'][k] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    lines.append(obj)
+
+                elif len(data['product']) == 0 and data['stage'] is not False:
+                    for l in range(0, len(data['responsible'])):
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if obj.state == data['stage'] \
+                                    and obj.user_id.id == data['responsible'][l]:
+                                lines.append(obj)
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is False:
+                    for k in range(0, len(data['product'])):
+                        for l in range(0, len(data['responsible'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.product_id.id == data['product'][k] \
+                                        and obj.user_id.id == data['responsible'][l]:
+                                    lines.append(obj)
+
+                if len(data['product']) == 0 \
+                        and data['stage'] is False:
+                    for l in range(0, len(data['responsible'])):
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if obj.user_id.id == data['responsible'][l]:
+                                lines.append(obj)
+            if data['filter_user'] is False:
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is not False:
+                    for k in range(0, len(data['product'])):
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if obj.state == data['stage'] \
+                                    and obj.product_id.id == data['product'][k]:
+                                lines.append(obj)
+
+                elif len(data['product']) == 0 and data['stage'] is not False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            if obj.state == data['stage']:
+                                lines.append(obj)
+
+                if len(data['product']) > 0 \
+                        and data['stage'] is False:
+                    for k in range(0, len(data['product'])):
+                            for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                                obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                                if obj.product_id.id == data['product'][k]:
+                                    lines.append(obj)
+
+                if len(data['product']) == 0 \
+                        and data['stage'] is False:
+                        for i in self.pool.get('mrp.production').search(self.cr, self.uid, []):
+                            obj = self.pool.get('mrp.production').browse(self.cr, self.uid, i)
+                            lines.append(obj)
+
+        return lines
+
+
+class PrintReport(osv.AbstractModel):
+    _name = 'report.eirumrp_reports.mrp_pdf'
+    _inherit = 'report.abstract_report'
+    _template = 'eirumrp_reports.mrp_pdf'
+    _wrapped_report_class = MrpReport

二进制
report/mrp_parser.pyc


二进制
report/mrp_report_xls.pyc


二进制
static/description/icon.png


+ 83 - 0
views/eirumrp_report_template.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<openerp>
+    <data>
+        <report id="action_report_eiruclaims"
+                 model="mrp.report"
+                 string="MRP Report"
+                 report_type="qweb-pdf"
+                 file="eirumrp_reports.mrp_pdf"
+                 name="eirumrp_reports.mrp_pdf"
+         />
+        <template id="mrp_pdf">
+            <t t-call="report.html_container">
+                <t t-call="report.internal_layout">
+                    <div class="page">
+                        <div class="header" style="text-align:left;"><h1><strong>Informes órdenes de producción</strong></h1></div>
+                        <div class="row mt32 mb32" style="text-align:left;">
+                                <div class="col-xs-12">
+                               <h3>   <strong>  <p t-esc="res_company.name"/></strong></h3>
+                                    <strong>Fecha informe:</strong>
+                                       <p t-esc="get_date()"/>
+                                </div>
+                        </div>
+                        <table class="table table-condensed">
+                            <thead>
+                                <tr >
+                                    <th style="background-color:#9b9da0 !important;">Referencia</th>
+                                    <th style="background-color:#9b9da0 !important;">Imagen</th>
+                                    <th style="background-color:#9b9da0 !important;">Producto</th>
+                                    <th style="background-color:#9b9da0 !important;">Cantidad</th>
+				                    <th style="background-color:#9b9da0 !important;">Unidad</th>
+                                    <th style="background-color:#9b9da0 !important;">Costo unitario</th>
+				                    <th style="background-color:#9b9da0 !important;">Costo prod.</th>
+                                    <th style="background-color:#9b9da0 !important;">Responsable</th>
+                                    <th style="background-color:#9b9da0 !important;">Fecha inicio</th>
+                                    <th style="background-color:#9b9da0 !important;">Estado</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                <t t-foreach="get_details(data)" t-as="o">
+
+                                    <tr>
+                                        <td>
+                                            <span t-esc="o.name"/>
+                                        </td>
+                                        <td>
+                               <img t-if="o.product_id.image_medium" t-att-src="'data:image/png;base64,%s' % o.product_id.image_medium" style="max-height: 40px;"/>
+                            </td>
+                                        <td>
+                                            <span t-esc="o.product_id.name"/>
+                                        </td>
+                                        <td>
+                                           <span t-esc="o.product_qty"/>
+                                        </td>
+                                        <td>
+                                            <span t-esc="o.product_uom.name"/>
+                                        </td>
+ 					<td>
+                                           <span t-esc="o.prod_price_unit"/>
+                                        </td>
+ 					<td>
+                                           <span t-esc="o.product_price"/>
+                                        </td>
+
+                                        <td>
+                                            <span t-esc="o.user_id.name"/>
+                                        </td>
+                                        <td>
+                                            <span t-esc="o.date_planned"/>
+                                        </td>
+                                        <td>
+                                            <span t-esc="o.state"/>
+                                        </td>
+                                    </tr>
+
+                                </t>
+                            </tbody>
+                        </table>
+                    </div>
+                </t>
+            </t>
+        </template>
+    </data>
+</openerp>

+ 56 - 0
views/eirumrp_wizard_view.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<openerp>
+     <data>
+
+        <record id="eirumrp_wizard_view" model="ir.ui.view">
+            <field name="name">MRP Reporte</field>
+            <field name="model">mrp.report</field>
+            <field name="arch" type="xml">
+                  <form string="MRP Reporte">
+                        <group>
+                            <group>
+                                <field name="product" widget="many2many_tags" />
+                                <field name="filter"/>
+                                <field name="date_from" attrs="{'invisible': [('filter','=',False)], 'required': [('filter', '=', True)]}"/>
+                                <field name="date_to" attrs="{'invisible': [('filter','=',False)], 'required': [('filter', '=', True)]}"/>
+                            </group>
+                            <group>
+                                <field name="stage"/>
+                                <field name="filter_user"/>
+                                <field name="responsible" widget="many2many_tags" attrs="{'invisible': [('filter_user','=',False)], 'required': [('filter_user', '=', True)]}"/>
+                            </group>
+                        </group>
+
+                        <footer>
+                            <button name="check_report" string="Exportar xls" type="object"
+                                     class="oe_highlight"  style="margin: 0 5px;"
+                                     context="{'xls_export':1}" icon='gtk-print' />
+                            <button name="print_pdf" string="Imprimir Pdf" type="object"
+                                     class="oe_highlight"  style="margin: 0 5px;"
+                                    icon='gtk-print' />
+                             or
+                        <button string="Cancelar" class="oe_link" special="cancel" />
+                        </footer>
+                </form>
+            </field>
+
+        </record>
+
+         <record model="ir.actions.act_window" id="mrp_wizard_action">
+            <field name="name">MRP Report</field>
+            <field name="res_model">mrp.report</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+             <field name="target">new</field>
+
+        </record>
+
+
+          <menuitem id="mrp_report_menu" name="Imprimir Reporte"
+                  parent="base.menu_mrp_root"/>
+         <menuitem id="mrp_pdf$xls_menu" name="PDF y XLS"
+                  parent="eirumrp_reports.mrp_report_menu"
+                  action="mrp_wizard_action"/>
+         </data>
+
+</openerp>

+ 15 - 0
wizards/__init__.py

@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import eirumrp_report_wizard

二进制
wizards/__init__.pyc


+ 55 - 0
wizards/eirumrp_report_wizard.py

@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+
+#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
+#
+#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
+#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
+#    If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp import models, fields
+
+
+class MrpReportWizard (models.Model):
+    _name = "mrp.report"
+
+    filter = fields.Boolean('Habilitar filtro por fecha')
+    date_from = fields.Date("Fecha Desde")
+    date_to = fields.Date("Fecha Hasta")
+    filter_user = fields.Boolean("Filtrar por Responsable")
+    responsible = fields.Many2many('res.users', string='Responsable')
+    product = fields.Many2many('product.product', string='Producto')
+    stage = fields.Selection([
+        ('confirmed', 'Confirmado'),
+        ('planned', 'Planeado'),
+        ('progress', 'En progreso'),
+        ('done', 'Hecho'),
+        ('cancel', 'Cancelado')], string="Filtrar por estado")
+
+    def check_report(self, cr, uid, ids, context):
+        data = self.read(cr, uid, ids, ['filter_user',
+                                        'filter', 'date_from', 'responsible',
+                                        'date_to', 'product', 'stage'], context=context)[0]
+        return {'type': 'ir.actions.report.xml',
+                'report_name': 'eirumrp_reports_xls',
+                'datas': data}
+
+    def print_pdf(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids, ['filter_user',
+                                        'filter', 'date_from', 'responsible',
+                                        'date_to', 'product', 'stage'], context=context)[0]
+        datas = {
+            'ids': context.get('active_ids', []),
+            'model': 'mrp.report',
+            'form': data
+        }
+        datas['form']['active_ids'] = context.get('active_ids', False)
+        return self.pool['report'].get_action(cr, uid, [], 'eirumrp_reports.mrp_pdf', data=data,
+                                              context=context)

二进制
wizards/eirumrp_report_wizard.pyc