Skip to content

Commit

Permalink
Merge PR #62 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by lreficent
  • Loading branch information
OCA-git-bot committed Oct 7, 2019
2 parents 6b1fea4 + 4ea6cb8 commit 953add8
Show file tree
Hide file tree
Showing 15 changed files with 370 additions and 0 deletions.
63 changes: 63 additions & 0 deletions mrp_bom_structure_report_level_1/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

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

This module adds a PDF report in BoM's to print just the first level of
components. So, will not explode into the subcomponents.

Usage
=====

To use this module, you need to:

#. Go to 'Manufacturing / Master Data / Bill of Materials'
#. Select a BoM and
#. Go to 'Print > BoM Structure (Level 1)'


.. 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/12.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://odoo-community.org/logo.png>`_.

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

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

Do not contact contributors directly about support or help with technical issues.

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.
3 changes: 3 additions & 0 deletions mrp_bom_structure_report_level_1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 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_report_level_1/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# © 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": "MRP BOM Structure Report Level 1",
"version": "12.0.1.0.0",
"author": "Eficent, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture-reporting",
"category": "Manufacture",
"depends": ["mrp"],
"data": [
"report/mrp_report_bom_structure_level_1.xml",
"views/mrp_bom_view.xml",
],
"license": "AGPL-3",
'installable': True,
}
57 changes: 57 additions & 0 deletions mrp_bom_structure_report_level_1/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_bom_structure_report_level_1
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Rudolf Schnapka <rs@techno-flex.de>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-28 05:21+0000\n"
"PO-Revision-Date: 2017-03-28 05:21+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Name"
msgstr "SL-Name"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Ref"
msgstr "SL-Ref"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Structure"
msgstr "Struktur-SL"

#. module: mrp_bom_structure_report_level_1
#: model:ir.actions.report,name:mrp_bom_structure_report_level_1.action_report_bom_structure_level_1
msgid "BOM Structure (Level 1)"
msgstr "SL-Hierarchie (Stufe 1)"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "Quantity"
msgstr "Menge"

#~ msgid "Display Name"
#~ msgstr "Anzeigebezeichnung"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Zuletzt geändert am"

#~ msgid "report.mrp_bom_structure_report_level_1.report_mrp_bs_l1"
#~ msgstr "report.mrp_bom_structure_report_level_1.report_mrp_bs_l1"
44 changes: 44 additions & 0 deletions mrp_bom_structure_report_level_1/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_bom_structure_report_level_1
#
# Translators:
# Quentin THEURET <odoo@kerpeo.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-22 12:13+0000\n"
"PO-Revision-Date: 2018-02-22 12:13+0000\n"
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2018\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Name"
msgstr "Nom de la nomenclature"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Ref"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Structure"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.actions.report,name:mrp_bom_structure_report_level_1.action_report_bom_structure_level_1
msgid "BOM Structure (Level 1)"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "Quantity"
msgstr "Quantité"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_bom_structure_report_level_1
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Name"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Ref"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "BOM Structure"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.actions.report,name:mrp_bom_structure_report_level_1.action_report_bom_structure_level_1
msgid "BOM Structure (Level 1)"
msgstr ""

#. module: mrp_bom_structure_report_level_1
#: model:ir.ui.view,arch_db:mrp_bom_structure_report_level_1.mrp_bs_l1
msgid "Quantity"
msgstr ""

2 changes: 2 additions & 0 deletions mrp_bom_structure_report_level_1/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Jordi Ballester <jordi.ballester@eficent.com>
* Miquel Raïch <miquel.raich@eficent.com>
2 changes: 2 additions & 0 deletions mrp_bom_structure_report_level_1/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds a PDF report in BoM's to print just the first level of
components. So, will not explode into the subcomponents.
5 changes: 5 additions & 0 deletions mrp_bom_structure_report_level_1/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

#. Go to 'Manufacturing / Master Data / Bill of Materials'
#. Select a BoM and
#. Go to 'Print > BoM Structure (Level 1)'
3 changes: 3 additions & 0 deletions mrp_bom_structure_report_level_1/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import mrp_report_bom_structure_level_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# © 2017-2019 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 odoo import _, models


class MRPBomStructureReportLevel1(models.AbstractModel):
_name = 'report.mrp_bom_structure_report_level_1.mrp_bs_l1'
_inherit = 'report.mrp.report_bom_structure'
_description = 'BOM Structure Report Level 1'

def _get_pdf_line(self, bom_id, product_id=False, qty=1,
child_bom_ids=None, unfolded=False):

if child_bom_ids is None:
child_bom_ids = []

data = self._get_bom(
bom_id=bom_id, product_id=product_id.id, line_qty=qty)

def get_sub_lines(bom, product_id, line_qty, line_id, level):
data = self._get_bom(bom_id=bom.id, product_id=product_id.id,
line_qty=line_qty, line_id=line_id,
level=level)
bom_lines = data['components']
lines = []
for bom_line in bom_lines:
lines.append({
'name': bom_line['prod_name'],
'type': 'bom',
'quantity': bom_line['prod_qty'],
'uom': bom_line['prod_uom'],
'prod_cost': bom_line['prod_cost'],
'bom_cost': bom_line['total'],
'level': bom_line['level'],
'code': bom_line['code']
})
if data['operations']:
lines.append({
'name': _('Operations'),
'type': 'operation',
'quantity': data['operations_time'],
'uom': _('minutes'),
'bom_cost': data['operations_cost'],
'level': level,
})
return lines

bom = self.env['mrp.bom'].browse(bom_id)
product = product_id or bom.product_id or \
bom.product_tmpl_id.product_variant_id
pdf_lines = get_sub_lines(bom, product, qty, False, 1)
data['components'] = []
data['lines'] = pdf_lines
return data
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2019 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo>

<template id="mrp_bs_l1">
<t t-call="mrp.report_bom_structure"/>
</template>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions mrp_bom_structure_report_level_1/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">MRP BOM Structure Report Level 1</h2>
<p>
This module adds a PDF report in BOM's to print just the first level of
components. So, will not explode into the subcomponents.
</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">
To use this module, you need to:

Go to the Bill of Materials form or list views, press 'Print >
BOM Structure (Level 1)'.
</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>Miquel Ra&iuml;ch &lt;<a
href="mailto:miquel.raich@eficent.com">miquel.raich@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>
16 changes: 16 additions & 0 deletions mrp_bom_structure_report_level_1/views/mrp_bom_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017-2019 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo>

<report
string="BoM Structure (Level 1)"
id="action_report_bom_structure_level_1"
model="mrp.bom"
name="mrp_bom_structure_report_level_1.mrp_bs_l1"
file="mrp_bom_structure_report_level_1.mrp_bs_l1"
report_type="qweb-pdf"
print_report_name="'BoM Structure - %s' % object.display_name"
/>

</odoo>

0 comments on commit 953add8

Please sign in to comment.