Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] mrp_bom_current_stock: multiple quantity and available check #1

Open
wants to merge 5 commits into
base: 16.0-mig-mrp_bom_current_stock
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mrp_bom_current_stock/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ MRP BoM Current Stock
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9e70f385aaedd487bffcc8b7fdf5f682f96785b0df31ef7e49a8d474d2d3266d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -23,7 +25,7 @@ MRP BoM Current Stock
:target: https://runbot.odoo-community.org/runbot/131/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

This modules extend the Manufacturing App adding a report that explodes the
bill of materials and show the stock available in the source location.
Expand Down Expand Up @@ -68,6 +70,7 @@ Contributors
* Lois Rilo <[email protected]>
* Héctor Villarreal <[email protected]>
* Dhara Solanki <[email protected]>
* Bernat Puig <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion mrp_bom_current_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"website": "https://github.com/OCA/manufacture-reporting",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["mrp_bom_location", "report_xlsx"],
"depends": ["mrp", "report_xlsx", "stock_helper"],
"data": [
"security/ir.model.access.csv",
"reports/report_mrpcurrentstock.xml",
Expand Down
2 changes: 1 addition & 1 deletion mrp_bom_current_stock/i18n/mrp_bom_current_stock.pot
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ msgid "Explode"
msgstr ""

#. module: mrp_bom_current_stock
#: model:ir.model.fields,field_description:mrp_bom_current_stock.field_mrp_bom_current_stock_line__explosion_id
#: model:ir.model.fields,field_description:mrp_bom_current_stock.field_mrp_bom_current_stock_line__wizard_id
msgid "Explosion"
msgstr ""

Expand Down
1 change: 1 addition & 0 deletions mrp_bom_current_stock/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Lois Rilo <[email protected]>
* Héctor Villarreal <[email protected]>
* Dhara Solanki <[email protected]>
* Bernat Puig <[email protected]>
14 changes: 11 additions & 3 deletions mrp_bom_current_stock/reports/report_mrpcurrentstock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
<th>Level</th>
<th>Product</th>
<th>Quantity</th>
<th>Location</th>
<th>Qty Available (Location)</th>
<th>Potential Qty</th>
<th>Location</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -58,15 +59,22 @@
/>
</td>
<td>
<span t-field="l.location_id.display_name" />
<span t-field="l.qty_available_in_source_loc" />
<span
t-esc="l.product_uom_id.name"
groups="uom.group_uom"
/>
</td>
<td>
<span t-field="l.qty_available_in_source_loc" />
<span t-field="l.potential_qty" />
<span
t-esc="l.product_uom_id.name"
groups="uom.group_uom"
/>
</td>
<td>
<span t-field="l.location_id.display_name" />
</td>
</tr>
</tbody>
</table>
Expand Down
27 changes: 15 additions & 12 deletions mrp_bom_current_stock/reports/report_mrpcurrentstock_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class ReportMrpBomCurrentStockXlsx(models.AbstractModel):
def _print_bom_children(ch, sheet, row):
i = row
sheet.write(i, 0, ch.bom_level or "")
sheet.write(i, 1, ch.bom_line.bom_id.code or "")
sheet.write(i, 1, ch.bom_id.code or "")
sheet.write(i, 2, ch.product_id.product_tmpl_id.display_name or "")
sheet.write(i, 3, ch.product_qty or "")
sheet.write(i, 4, ch.qty_available_in_source_loc or 0.0)
sheet.write(i, 5, ch.product_uom_id.name or "")
sheet.write(i, 6, ch.location_id.name or "")
sheet.write(i, 7, ch.bom_id.code or "")
sheet.write(i, 8, ch.bom_id.product_tmpl_id.display_name or "")
sheet.write(i, 5, ch.potential_qty or 0.0)
sheet.write(i, 6, ch.product_uom_id.name or "")
sheet.write(i, 7, ch.location_id.name or "")
sheet.write(i, 8, ch.parent_bom_id.code or "")
sheet.write(i, 9, ch.parent_bom_id.product_tmpl_id.display_name or "")
i += 1
return i

Expand All @@ -40,10 +41,10 @@ def generate_xlsx_report(self, workbook, data, objects):
sheet.set_column(0, 0, 5)
sheet.set_column(1, 2, 40)
sheet.set_column(3, 3, 10)
sheet.set_column(4, 4, 20)
sheet.set_column(5, 5, 7)
sheet.set_column(6, 6, 20)
sheet.set_column(7, 8, 40)
sheet.set_column(4, 5, 20)
sheet.set_column(6, 6, 7)
sheet.set_column(7, 7, 20)
sheet.set_column(8, 9, 40)

title_style = workbook.add_format(
{"bold": True, "bg_color": "#FFFFCC", "bottom": 1}
Expand All @@ -54,6 +55,7 @@ def generate_xlsx_report(self, workbook, data, objects):
_("Product Reference"),
_("Quantity"),
_("Qty Available (Location)"),
_("Potential Qty"),
_("UoM"),
_("Location"),
_("Parent BoM Ref"),
Expand All @@ -69,10 +71,11 @@ def generate_xlsx_report(self, workbook, data, objects):
sheet.write(i, 0, "0", bold)
sheet.write(i, 1, o.bom_id.code or "", bold)
sheet.write(i, 2, o.product_tmpl_id.name or "", bold)

sheet.write(i, 3, o.product_qty or "", bold)
sheet.write(i, 5, o.product_uom_id.name or "", bold)
sheet.write(i, 6, o.location_id.name or "", bold)
sheet.write(i, 4, o.qty_available_in_source_loc or 0.0, bold)
sheet.write(i, 5, o.potential_qty or 0.0, bold)
sheet.write(i, 6, o.product_uom_id.name or "", bold)
sheet.write(i, 7, o.location_id.name or "", bold)
i += 1
for ch in o.line_ids:
i = self._print_bom_children(ch, sheet, i)
6 changes: 6 additions & 0 deletions mrp_bom_current_stock/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ <h1 class="title">MRP BoM Current Stock</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
<<<<<<< HEAD
=======
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9e70f385aaedd487bffcc8b7fdf5f682f96785b0df31ef7e49a8d474d2d3266d
>>>>>>> c7f1ac1 ([FIX] mrp_bom_current_stock: Remove mrp_bom_location dependency)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture-reporting/tree/15.0/mrp_bom_current_stock"><img alt="OCA/manufacture-reporting" src="https://img.shields.io/badge/github-OCA%2Fmanufacture--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-reporting-15-0/manufacture-reporting-15-0-mrp_bom_current_stock"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/131/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This modules extend the Manufacturing App adding a report that explodes the
Expand Down Expand Up @@ -416,6 +421,7 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Héctor Villarreal &lt;<a class="reference external" href="mailto:hector.villarreal&#64;forgeflow.com">hector.villarreal&#64;forgeflow.com</a>&gt;</li>
<li>Dhara Solanki &lt;<a class="reference external" href="mailto:dhara.solanki&#64;initos.com">dhara.solanki&#64;initos.com</a>&gt;</li>
<li>Bernat Puig &lt;<a class="reference external" href="mailto:bernat.puig&#64;forgeflow.com">bernat.puig&#64;forgeflow.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Loading