diff --git a/manufacturing_reports/README.rst b/manufacturing_reports/README.rst new file mode 100644 index 000000000..bf1891715 --- /dev/null +++ b/manufacturing_reports/README.rst @@ -0,0 +1,22 @@ +Manufacturing Reports +===================== +Manufacturing Reports is a free mrp software helps to generate advanced +report for MRP module(Material requirements planning).This allows both PDF & XLS report for MRP systems. +Also you can view the product image in the report.This works well for large and small business MRP systems. + +Installation +============ + +To install this module, you need to install : +Report Xls located in : https://github.com/OCA/reporting-engine + +Features +======== +* Filter manufacturing orders based on Product +* Set start and end date, to print the orders between this date +* Filter orders based on the status of the production +* Enable filter for responsible for the production + +Credits +======= +Cybrosys Technologies, odoo@cybrosys.com \ No newline at end of file diff --git a/manufacturing_reports/__init__.py b/manufacturing_reports/__init__.py new file mode 100644 index 000000000..86a127236 --- /dev/null +++ b/manufacturing_reports/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +import report +import wizards + diff --git a/manufacturing_reports/__openerp__.py b/manufacturing_reports/__openerp__.py new file mode 100644 index 000000000..1311521f0 --- /dev/null +++ b/manufacturing_reports/__openerp__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## +{ + 'name': 'Manufacturing Reports', + 'version': '8.0.1.0.0', + 'summary': 'PDF & XLS Reports For Manufacturing Module.', + 'description': 'PDF & XLS reports for manufacturing module with advanced filters.', + 'category': 'Manufacturing', + 'author': 'Cybrosys Techno Solutions', + 'website': "http://www.cybrosys.com", + 'company': 'Cybrosys Techno Solutions', + 'depends': ['base', 'mrp', 'report_xls'], + 'data': [ + 'views/mrp_wizard_view.xml', + 'views/mrp_report_template.xml' + ], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/manufacturing_reports/report/__init__.py b/manufacturing_reports/report/__init__.py new file mode 100644 index 000000000..64bef82a4 --- /dev/null +++ b/manufacturing_reports/report/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +import mrp_parser +import mrp_report_xls diff --git a/manufacturing_reports/report/mrp_parser.py b/manufacturing_reports/report/mrp_parser.py new file mode 100644 index 000000000..5d6c97096 --- /dev/null +++ b/manufacturing_reports/report/mrp_parser.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +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.manufacturing_reports.mrp_pdf' + _inherit = 'report.abstract_report' + _template = 'manufacturing_reports.mrp_pdf' + _wrapped_report_class = MrpReport diff --git a/manufacturing_reports/report/mrp_report_xls.py b/manufacturing_reports/report/mrp_report_xls.py new file mode 100644 index 000000000..392dce6c6 --- /dev/null +++ b/manufacturing_reports/report/mrp_report_xls.py @@ -0,0 +1,301 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +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, + '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['user_id']), + (6, 1, 0, 'text', getvals['date_planned']), + (7, 1, 0, 'text', getvals['state']), + ] + return templist1 + + +class MrpXlsReport(report_xls): + + def generate_xls_report(self, _p, _xs, data, objects, wb): + report_name = "Manufacturing Orders" + 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 = "Date Of Report :" + 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', 'Reference'), + (2, 3, 0, 'text', 'Product'), + (3, 2, 0, 'text', 'Quantity'), + (4, 2, 0, 'text', 'Unit'), + (5, 2, 0, 'text', 'Responsible'), + (6, 1, 0, 'text', 'Start Date'), + (7, 1, 0, 'text', 'State'), ] + 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.mrp_reports_xls', 'mrp.production') diff --git a/manufacturing_reports/static/description/banner.jpg b/manufacturing_reports/static/description/banner.jpg new file mode 100644 index 000000000..fecf92b6f Binary files /dev/null and b/manufacturing_reports/static/description/banner.jpg differ diff --git a/manufacturing_reports/static/description/cybro_logo.png b/manufacturing_reports/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/manufacturing_reports/static/description/cybro_logo.png differ diff --git a/manufacturing_reports/static/description/icon.png b/manufacturing_reports/static/description/icon.png new file mode 100644 index 000000000..6955882a2 Binary files /dev/null and b/manufacturing_reports/static/description/icon.png differ diff --git a/manufacturing_reports/static/description/index.html b/manufacturing_reports/static/description/index.html new file mode 100644 index 000000000..4eb2a844b --- /dev/null +++ b/manufacturing_reports/static/description/index.html @@ -0,0 +1,94 @@ +
+
+

Manufacturing Reports

+

PDF & XLS Reports For Manufacturing Module

+

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+

Manufacturing Reports is a free Cybrosys MRP software which helps to generate advanced + report for MRP module(Material requirements planning).This allows both PDF & XLS report for MRP systems. + Also you can view the product image in the report.This works well for large and small business MRP systems.

+ + +
+
+
+ + +
+
+

Filter MRP Orders

+
+
+
+

Go to Manufacturing -> Print Report

+ +
+
+
+

+
    +
  •    Filter manufacturing orders based on Product
  • +
  •    Set start and end date, to print the orders between this date
  • +
  •    Filter orders based on the status of the production
  • +
  •    Enable filter based on the responsible person for production
  • +
+
+ +
+
+
+ +
+
+

PDF Report

+
+
+
+ +
+
+ +
+
+
+
+
+

XLS Report

+
+
+
+ +
+
+ +
+
+
+ + +
+

Need Any Help?

+ +
+ diff --git a/manufacturing_reports/static/description/index.html~ b/manufacturing_reports/static/description/index.html~ new file mode 100644 index 000000000..6dc8d916e --- /dev/null +++ b/manufacturing_reports/static/description/index.html~ @@ -0,0 +1,93 @@ +
+
+

Manufacturing Reports

+

PDF & XLS Reports For Manufacturing Module

+

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+

Manufacturing Reports is a free Cybrosys mrp software helps to generate advanced + report for MRP module(Material requirements planning).This allows both PDF & XLS report for MRP systems. + Also you can view the product image in the report.This works well for large and small business MRP systems.

+ + +
+
+
+ + +
+
+

Filter MRP Orders

+
+
+
+

Go to Manufacturing -> Print Report

+ +
+
+
+

+
    +
  •    Filter manufacturing orders based on Product
  • +
  •    Set start and end date, to print the orders between this date
  • +
  •    Filter orders based on the status of the production
  • +
  •    Enable filter for responsible for the production
  • +
+
+ +
+
+
+ +
+
+

PDF Report

+
+
+
+ +
+
+ +
+
+
+
+
+

XLS Report

+
+
+
+ +
+
+ +
+
+
+ + +
+

Need Any Help?

+ +
diff --git a/manufacturing_reports/static/description/material requirements planning.png b/manufacturing_reports/static/description/material requirements planning.png new file mode 100644 index 000000000..9873f1edb Binary files /dev/null and b/manufacturing_reports/static/description/material requirements planning.png differ diff --git a/manufacturing_reports/static/description/mrp_pdf_report.png b/manufacturing_reports/static/description/mrp_pdf_report.png new file mode 100644 index 000000000..75b465353 Binary files /dev/null and b/manufacturing_reports/static/description/mrp_pdf_report.png differ diff --git a/manufacturing_reports/static/description/mrp_xls_report.png b/manufacturing_reports/static/description/mrp_xls_report.png new file mode 100644 index 000000000..474ec99d6 Binary files /dev/null and b/manufacturing_reports/static/description/mrp_xls_report.png differ diff --git a/manufacturing_reports/views/mrp_report_template.xml b/manufacturing_reports/views/mrp_report_template.xml new file mode 100644 index 000000000..484d39eb6 --- /dev/null +++ b/manufacturing_reports/views/mrp_report_template.xml @@ -0,0 +1,74 @@ + + + + + + + \ No newline at end of file diff --git a/manufacturing_reports/views/mrp_wizard_view.xml b/manufacturing_reports/views/mrp_wizard_view.xml new file mode 100644 index 000000000..ccb073b7d --- /dev/null +++ b/manufacturing_reports/views/mrp_wizard_view.xml @@ -0,0 +1,56 @@ + + + + + + MRP Report + mrp.report + +
+ + + + + + + + + + + + + + +
+
+
+
+ +
+ + + MRP Report + mrp.report + form + form + new + + + + + + +
+ +
\ No newline at end of file diff --git a/manufacturing_reports/wizards/__init__.py b/manufacturing_reports/wizards/__init__.py new file mode 100644 index 000000000..4808c79f2 --- /dev/null +++ b/manufacturing_reports/wizards/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +import mrp_report_wizard diff --git a/manufacturing_reports/wizards/mrp_report_wizard.py b/manufacturing_reports/wizards/mrp_report_wizard.py new file mode 100644 index 000000000..c0095c3cc --- /dev/null +++ b/manufacturing_reports/wizards/mrp_report_wizard.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2012-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 . +# +############################################################################## + +from openerp import models, fields + + +class MrpReportWizard (models.Model): + _name = "mrp.report" + + filter = fields.Boolean('Enable filter by date') + date_from = fields.Date("Start Date") + date_to = fields.Date("End Date") + filter_user = fields.Boolean("Filter On Responsible") + responsible = fields.Many2many('res.users', string='Responsible') + product = fields.Many2many('product.product', string='Product') + stage = fields.Selection([ + ('confirmed', 'Confirmed'), + ('planned', 'Planned'), + ('progress', 'In Progress'), + ('done', 'Done'), + ('cancel', 'Cancelled')], string="Filter State") + + 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': 'mrp_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, [], 'manufacturing_reports.mrp_pdf', data=data, + context=context)