Skip to content

Commit

Permalink
[9.0][ADD] mrp_bom_structure_xlsx_level_1
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiBForgeFlow authored and MiquelRForgeFlow committed Feb 27, 2017
1 parent 4535d7d commit ff8b1d5
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 0 deletions.
61 changes: 61 additions & 0 deletions mrp_bom_structure_xlsx_level_1/README.rst
@@ -0,0 +1,61 @@
.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg
:target: https://www.gnu.org/licenses/agpl.html
:alt: License: AGPL-3

=====================================
MRP BOM Structure Report XLSX Level 1
=====================================

This module extends the functionality of the MRP capabilities of Odoo,
and allows you to export to level 1 of the BOM structure to MS Excel .XLSX format.


Usage
=====

To use this module, you need to:

1 - Go to 'Manufacturing / Products / Bill of Materials'
2 - Select a BOM or more BOMS
3 - Go to 'More / Export BOM Structure to Excel'.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/131/9.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/manufacture-reporting/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted it
first, help us smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Jordi Ballester <jordi.ballester@eficent.com>
* Miquel Raïch <miquel.raich@eficent.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
5 changes: 5 additions & 0 deletions mrp_bom_structure_xlsx_level_1/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import report
18 changes: 18 additions & 0 deletions mrp_bom_structure_xlsx_level_1/__openerp__.py
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': "Export BOM Structure (Level 1) to Excel .XLSX",
'version': '9.0.1.0.0',
'category': 'Manufacturing',
'author': "Eficent, Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/manufacture-reporting',
'license': 'AGPL-3',
"depends": ['mrp_bom_structure_xlsx'],
"data": [
'report/bom_structure_xlsx.xml',
],
"installable": True
}
5 changes: 5 additions & 0 deletions mrp_bom_structure_xlsx_level_1/report/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import bom_structure_xlsx
41 changes: 41 additions & 0 deletions mrp_bom_structure_xlsx_level_1/report/bom_structure_xlsx.py
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import logging

from openerp.addons.mrp.report.bom_structure import bom_structure
from openerp.addons.mrp_bom_structure_xlsx.report.bom_structure_xlsx import \
BomStructureXlsx

_logger = logging.getLogger(__name__)

try:
from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx
except ImportError:
_logger.debug("report_xlsx not installed, Excel export non functional")

class ReportXlsx(object):
def __init__(self, *args, **kwargs):
pass


class BomStructureXlsxL1(BomStructureXlsx):

def print_bom_children(self, ch, sheet, row, level):
i, j = row, level
j += 1
sheet.write(i, 1, '> '*j)
sheet.write(i, 2, ch.product_id.default_code or '')
sheet.write(i, 3, '[' + ch.product_id.default_code +
'] ' + ch.product_id.name or '')
sheet.write(i, 4, ch.product_qty)
sheet.write(i, 5, ch.product_uom.name or '')
sheet.write(i, 6, ch.bom_id.code or '')
i += 1
return i


BomStructureXlsxL1('report.bom.structure.xlsx.l1', 'mrp.bom',
parser=bom_structure)
25 changes: 25 additions & 0 deletions mrp_bom_structure_xlsx_level_1/report/bom_structure_xlsx.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp>
<data>

<record id="action_bom_structure_xlsx_l1" model="ir.actions.report.xml">
<field name="name">Export BOM Structure (Level 1) to Excel</field>
<field name="model">mrp.bom</field>
<field name="type">ir.actions.report.xml</field>
<field name="report_name">bom.structure.xlsx.l1</field>
<field name="report_type">xlsx</field>
<field name="auto" eval="False"/>
</record>

<record model="ir.values" id="action_bom_structure_xlsx_l1_values">
<field name="name">Export BOM Structure (Level 1) to Excel</field>
<field name="key2">client_action_multi</field>
<field name="value"
eval="'ir.actions.report.xml,' +str(ref('action_bom_structure_xlsx_l1'))" />
<field name="model">mrp.bom</field>
</record>

</data>
</openerp>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions mrp_bom_structure_xlsx_level_1/static/description/index.html
@@ -0,0 +1,82 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Export BOM Structure (Level 1) to Excel</h2>
<p>
This module extends the functionality of the MRP capabilities of Odoo,
and allows you to export to level 1 of the BOM structure to MS Excel .XLSX format.
</p>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Installation</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">No additional installation instructions are required.</p>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Configuration</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">This module does not require any additional configuration.</p>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Usage</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">
In the Bill of Materials form or list views, press 'More > Export BOM
Structure to Excel (Level 1)'.
</p>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Known issues / Roadmap</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">No issues have been identified.</p>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span12">
<h2 class="oe_slogan">Credits</h2>
</div>
<div class="oe_span12">
<h3>Contributors</h3>
<ul>
<li>Jordi Ballester Alomar &lt;<a
href="mailto:jordi.ballester@eficent.com">jordi.ballester@eficent.com</a>&gt;</li>
</ul>
</div>
<div class="oe_span12">
<h3>Maintainer</h3>
<p>
This module is maintained by the OCA.<br/>
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.<br/>
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/>
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a>
</p>
</div>
</div>
</section>

0 comments on commit ff8b1d5

Please sign in to comment.