Skip to content

Commit

Permalink
Merge PR #98 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Nov 18, 2024
2 parents 3079f9b + 259e8d3 commit 1856d48
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 91 deletions.
3 changes: 2 additions & 1 deletion mrp_bom_current_stock/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MRP BoM Current Stock
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a758367d719d80a03cc4e0f8bdebf4a565bcd256d60a4ca7f86e507545656c39
!! source digest: sha256:0d4a33388dea8f7e38fda18342bed56a3f53bde3e2dc6098bf6e8e5a2445143b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -70,6 +70,7 @@ Contributors

* Lois Rilo <[email protected]>
* Héctor Villarreal <[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 @@ -87,7 +87,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,2 +1,3 @@
* Lois Rilo <[email protected]>
* Héctor Villarreal <[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)
3 changes: 2 additions & 1 deletion mrp_bom_current_stock/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">MRP BoM Current Stock</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a758367d719d80a03cc4e0f8bdebf4a565bcd256d60a4ca7f86e507545656c39
!! source digest: sha256:0d4a33388dea8f7e38fda18342bed56a3f53bde3e2dc6098bf6e8e5a2445143b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/manufacture-reporting/tree/14.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 image-reference" href="https://translation.odoo-community.org/projects/manufacture-reporting-14-0/manufacture-reporting-14-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture-reporting&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This modules extend the Manufacturing App adding a report that explodes the
Expand Down Expand Up @@ -417,6 +417,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<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>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
2 changes: 1 addition & 1 deletion mrp_bom_current_stock/tests/test_mrp_bom_current_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_wizard(self):
self.wizard.do_explode()
sol = (1, 1, 200, 0.01, 1, 2.4)
lines = self.wizard.line_ids
self.assertEquals(self.wizard.location_id, self.stock_loc)
self.assertEqual(self.wizard.location_id, self.stock_loc)
for i, line in enumerate(lines):
self.assertEqual(line.product_qty, sol[i])
self._product_change_qty(line.product_id, line.product_qty)
Expand Down
Loading

0 comments on commit 1856d48

Please sign in to comment.