Skip to content

Commit

Permalink
[IMP] mrp_multi_level:
Browse files Browse the repository at this point in the history
* Fixup! Main Supplier computation (v13 required explicit False definitions)
  • Loading branch information
HviorForgeFlow committed Mar 10, 2020
1 parent 8cb60f7 commit 31e1fed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mrp_multi_level/models/product_mrp_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,14 @@ def _compute_main_supplier(self):
and (not r.company_id or r.company_id == rec.company_id)
)
if not suppliers:
rec.main_supplierinfo_id = False
rec.main_supplier_id = False
continue
rec.main_supplierinfo_id = suppliers[0]
rec.main_supplier_id = suppliers[0].name
for rec in self.filtered(lambda r: r.supply_method != "buy"):
rec.main_supplierinfo_id = False
rec.main_supplier_id = False

def _adjust_qty_to_order(self, qty_to_order):
self.ensure_one()
Expand Down
1 change: 1 addition & 0 deletions mrp_multi_level/readme/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Link Manufacturing Orders with Planned Orders.
* Allow Mrp Inventory Procure Wizard to be used from other models.
* Make MRP Inventory creation more extensible.
* Fixup! Main Supplier computation (v13 required explicit False definitions)

13.0.1.2.0 (2020-02-20)
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions mrp_multi_level/tests/test_mrp_multi_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def test_02_product_mrp_area(self):
[("product_id", "=", self.sf_1.id)]
)
self.assertEqual(product_mrp_area.supply_method, "manufacture")
self.assertFalse(product_mrp_area.main_supplier_id)
self.assertFalse(product_mrp_area.main_supplierinfo_id)

def test_03_mrp_moves(self):
"""Tests for mrp moves generated."""
Expand Down
3 changes: 2 additions & 1 deletion mrp_multi_level/views/product_mrp_area_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
<button string="Update Min Qty" type="object"
name="update_min_qty_from_main_supplier"
attrs="{'invisible':[('supply_method', '!=', 'buy'), ('main_supplierinfo_id', '=', False)]}"
class="oe_link pt-0 oe_inline"/>
class="oe_link pt-0 oe_inline"
help="Get Minimum Quantity from Main Supplier."/>
</span>
</div>
<field name="mrp_maximum_order_qty"/>
Expand Down

0 comments on commit 31e1fed

Please sign in to comment.