Skip to content

Commit

Permalink
[IMP] mrp_multi_level:
Browse files Browse the repository at this point in the history
* Main Supplier computation (v13 requires explicit False definitions)
  • Loading branch information
HviorForgeFlow committed Mar 11, 2020
1 parent 232dab1 commit 5f3ca42
Show file tree
Hide file tree
Showing 4 changed files with 9 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.
* Main Supplier computation (v13 requires 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
2 changes: 1 addition & 1 deletion mrp_multi_level/wizards/mrp_inventory_procure.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class MrpInventoryProcureItem(models.TransientModel):
("push", "Push To"),
("pull_push", "Pull & Push"),
],
readonly=True,
)

def _prepare_procurement_values(self, group=False):
Expand All @@ -133,7 +134,6 @@ def _prepare_procurement_values(self, group=False):
fields.Date.from_string(self.date_planned)
),
"warehouse_id": self.warehouse_id,
# 'company_id': self.company_id, # TODO: consider company
"group_id": group,
"planned_order_id": self.planned_order_id.id,
}
Expand Down

0 comments on commit 5f3ca42

Please sign in to comment.