Browse Source

[ADD] Initial Commit

pull/11/merge
SHEREEF PT 8 years ago
parent
commit
008b6bf544
  1. 22
      manufacturing_reports/README.rst
  2. 26
      manufacturing_reports/__init__.py
  3. 42
      manufacturing_reports/__openerp__.py
  4. 25
      manufacturing_reports/report/__init__.py
  5. 207
      manufacturing_reports/report/mrp_parser.py
  6. 301
      manufacturing_reports/report/mrp_report_xls.py
  7. BIN
      manufacturing_reports/static/description/banner.jpg
  8. BIN
      manufacturing_reports/static/description/cybro_logo.png
  9. BIN
      manufacturing_reports/static/description/icon.png
  10. 94
      manufacturing_reports/static/description/index.html
  11. 93
      manufacturing_reports/static/description/index.html~
  12. BIN
      manufacturing_reports/static/description/material requirements planning.png
  13. BIN
      manufacturing_reports/static/description/mrp_pdf_report.png
  14. BIN
      manufacturing_reports/static/description/mrp_xls_report.png
  15. 74
      manufacturing_reports/views/mrp_report_template.xml
  16. 56
      manufacturing_reports/views/mrp_wizard_view.xml
  17. 24
      manufacturing_reports/wizards/__init__.py
  18. 64
      manufacturing_reports/wizards/mrp_report_wizard.py

22
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

26
manufacturing_reports/__init__.py

@ -0,0 +1,26 @@
# -*- 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import report
import wizards

42
manufacturing_reports/__openerp__.py

@ -0,0 +1,42 @@
# -*- 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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,
}

25
manufacturing_reports/report/__init__.py

@ -0,0 +1,25 @@
# -*- 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import mrp_parser
import mrp_report_xls

207
manufacturing_reports/report/mrp_parser.py

@ -0,0 +1,207 @@
# -*- 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.
#
# 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 <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.manufacturing_reports.mrp_pdf'
_inherit = 'report.abstract_report'
_template = 'manufacturing_reports.mrp_pdf'
_wrapped_report_class = MrpReport

301
manufacturing_reports/report/mrp_report_xls.py

@ -0,0 +1,301 @@
# -*- 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.
#
# 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 <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,
'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')

BIN
manufacturing_reports/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
manufacturing_reports/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
manufacturing_reports/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

94
manufacturing_reports/static/description/index.html

@ -0,0 +1,94 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h1 class="oe_slogan">Manufacturing Reports</h1>
<h2 class="oe_slogan">PDF & XLS Reports For Manufacturing Module</h2>
<h3 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h3>
<div>
<h4><p class="oe_mt32">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.</p></h4>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Filter MRP Orders</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<h4>Go to Manufacturing -> Print Report </h4>
<img class="oe_picture oe_screenshot" src="material requirements planning.png">
</div>
</div>
<div class="oe_span12">
<p></p>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Filter manufacturing orders based on Product</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Set start and end date, to print the orders between this date</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Filter orders based on the status of the production</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Enable filter based on the responsible person for production</li>
</ul>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">PDF Report</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="mrp_pdf_report.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">XLS Report</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="mrp_xls_report.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

93
manufacturing_reports/static/description/index.html~

@ -0,0 +1,93 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h1 class="oe_slogan">Manufacturing Reports</h1>
<h2 class="oe_slogan">PDF & XLS Reports For Manufacturing Module</h2>
<h3 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h3>
<div>
<h4><p class="oe_mt32">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.</p></h4>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Filter MRP Orders</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<h4>Go to Manufacturing -> Print Report </h4>
<img class="oe_picture oe_screenshot" src="material requirements planning.png">
</div>
</div>
<div class="oe_span12">
<p></p>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Filter manufacturing orders based on Product</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Set start and end date, to print the orders between this date</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Filter orders based on the status of the production</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Enable filter for responsible for the production</li>
</ul>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">PDF Report</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="mrp_pdf_report.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">XLS Report</h2>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="mrp_xls_report.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
manufacturing_reports/static/description/material requirements planning.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
manufacturing_reports/static/description/mrp_pdf_report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
manufacturing_reports/static/description/mrp_xls_report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

74
manufacturing_reports/views/mrp_report_template.xml

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<report id="action_report_claims"
model="mrp.report"
string="MRP Report"
report_type="qweb-pdf"
file="manufacturing_reports.mrp_pdf"
name="manufacturing_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>MRP Order Report</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>Date of report:</strong>
<p t-esc="get_date()"/>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr >
<th style="background-color:#9b9da0 !important;">Reference</th>
<th style="background-color:#9b9da0 !important;">Image</th>
<th style="background-color:#9b9da0 !important;">Product</th>
<th style="background-color:#9b9da0 !important;">Quantity</th>
<th style="background-color:#9b9da0 !important;">Unit</th>
<th style="background-color:#9b9da0 !important;">Responsible</th>
<th style="background-color:#9b9da0 !important;">Start Date</th>
<th style="background-color:#9b9da0 !important;">State</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.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
manufacturing_reports/views/mrp_wizard_view.xml

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<record id="mrp_wizard_view" model="ir.ui.view">
<field name="name">MRP Report</field>
<field name="model">mrp.report</field>
<field name="arch" type="xml">
<form string="MRP Report">
<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="Export xls" type="object"
class="oe_highlight" style="margin: 0 5px;"
context="{'xls_export':1}" icon='gtk-print' />
<button name="print_pdf" string="Print Pdf" type="object"
class="oe_highlight" style="margin: 0 5px;"
icon='gtk-print' />
or
<button string="Cancel" 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="Print Report"
parent="base.menu_mrp_root"/>
<menuitem id="mrp_pdf$xls_menu" name="PDF and XLS"
parent="manufacturing_reports.mrp_report_menu"
action="mrp_wizard_action"/>
</data>
</openerp>

24
manufacturing_reports/wizards/__init__.py

@ -0,0 +1,24 @@
# -*- 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import mrp_report_wizard

64
manufacturing_reports/wizards/mrp_report_wizard.py

@ -0,0 +1,64 @@
# -*- 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.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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)
Loading…
Cancel
Save