Skip to content

Commit

Permalink
[MIG] stock_request_mrp: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelZilli committed Sep 14, 2022
1 parent 12480b2 commit 21289c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion stock_request_mrp/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Stock Request MRP",
"summary": "Manufacturing request for stock",
"version": "13.0.1.0.0",
"version": "15.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "ForgeFlow, Odoo Community Association (OCA)",
Expand Down
24 changes: 7 additions & 17 deletions stock_request_mrp/tests/test_stock_request_mrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def setUp(self):

# common models
self.stock_request = self.env["stock.request"]
self.produce_wiz = self.env["mrp.product.produce"]

# refs
self.stock_request_user_group = self.env.ref(
Expand Down Expand Up @@ -68,7 +67,7 @@ def _update_qty_in_location(self, location, product, quantity):
def _create_user(self, name, group_ids, company_ids):
return (
self.env["res.users"]
.with_context({"no_reset_password": True})
.with_context(no_reset_password=True)
.create(
{
"name": name,
Expand Down Expand Up @@ -110,15 +109,6 @@ def _create_mrp_bom(self, product_id, raw_materials):

return bom

def _produce(self, mo, qty=0.0):
wiz = Form(
self.produce_wiz.with_context({"active_id": mo.id, "active_ids": [mo.id]})
)
wiz.qty_producing = qty or mo.product_qty
produce_wizard = wiz.save()
produce_wizard.do_produce()
return True

def test_create_request_01(self):
"""Single Stock request with buy rule"""
expected_date = fields.Datetime.now()
Expand Down Expand Up @@ -156,18 +146,18 @@ def test_create_request_01(self):

order.refresh()

self.assertEqual(len(order.production_ids), 1)
self.assertEqual(len(order.stock_request_ids.production_ids), 1)
self.assertEqual(order.stock_request_ids.qty_in_progress, 5.0)

manufacturing_order = order.production_ids[0]
self.assertEqual(
manufacturing_order.company_id, order.stock_request_ids[0].company_id
)

self._produce(manufacturing_order, 5.0)
self.assertEqual(len(order.production_ids), 1)
self.assertEqual(len(order.stock_request_ids.production_ids), 1)
manufacturing_order.action_confirm()
self.assertEqual(order.stock_request_ids.qty_in_progress, 5.0)
self.assertEqual(order.stock_request_ids.qty_done, 0.0)

manufacturing_order.action_confirm()
manufacturing_order.write({"product_qty": manufacturing_order.qty_producing})

manufacturing_order.button_mark_done()
self.assertEqual(order.stock_request_ids.qty_in_progress, 0.0)
Expand Down

0 comments on commit 21289c5

Please sign in to comment.