Skip to content

Commit

Permalink
[FIX] mrp_bom_current_stock: Remove mrp_bom_location dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
BernatPForgeFlow committed Jun 12, 2024
1 parent ef7584e commit 259e8d3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 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", "stock_helper"],
"depends": ["mrp", "report_xlsx", "stock_helper"],
"data": [
"security/ir.model.access.csv",
"reports/report_mrpcurrentstock.xml",
Expand Down
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
12 changes: 1 addition & 11 deletions mrp_bom_current_stock/wizard/bom_route_current_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ def _onchange_product_id(self):
if self.product_id:
self.bom_id = self.env["mrp.bom"]._bom_find(product=self.product_id)

Check warning on line 75 in mrp_bom_current_stock/wizard/bom_route_current_stock.py

View check run for this annotation

Codecov / codecov/patch

mrp_bom_current_stock/wizard/bom_route_current_stock.py#L75

Added line #L75 was not covered by tests

@api.onchange("bom_id")
def _onchange_bom_id(self):
if self.bom_id.location_id:
self.location_id = self.bom_id.location_id

def _get_exclude_locations_qty(self, product_id, location_id):
qty = 0
for exclude_location_id in self.exclude_location_ids:
Expand Down Expand Up @@ -313,12 +308,7 @@ def _compute_qty_available_in_source_loc(self):
@api.depends("bom_line_id")
def _compute_bom_id(self):
for rec in self:
boms = (
rec.bom_line_id.product_id.bom_ids.filtered(
lambda bom: bom.location_id == rec.location_id
)
or rec.bom_line_id.product_id.bom_ids
)
boms = rec.bom_line_id.product_id.bom_ids
rec.bom_id = boms[0] if boms else None

@api.depends("product_qty", "qty_available_in_source_loc")
Expand Down
6 changes: 6 additions & 0 deletions mrp_bom_current_stock/wizard/bom_route_current_stock_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
('product_id','=',False)]"
/>
<field name="location_id" />
<field name="exclude_location_ids" widget="many2many_tags" />
<label for="desired_qty" />
<div class="o_row">
<field name="desired_qty" />
Expand Down Expand Up @@ -74,6 +75,11 @@
readonly="1"
attrs="{'invisible': [('location_id', '=', False)]}"
/>
<field
name="exclude_location_ids"
readonly="1"
widget="many2many_tags"
/>
<field name="product_uom_id" groups="uom.group_uom" />
</group>
<group>
Expand Down

0 comments on commit 259e8d3

Please sign in to comment.