diff --git a/stock_request_mrp/__manifest__.py b/stock_request_mrp/__manifest__.py index 39d50aa0dbc2..3f7d2af8c0ba 100644 --- a/stock_request_mrp/__manifest__.py +++ b/stock_request_mrp/__manifest__.py @@ -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)", diff --git a/stock_request_mrp/models/mrp_production.py b/stock_request_mrp/models/mrp_production.py index c2ab9249c2d2..e03424aa5f52 100644 --- a/stock_request_mrp/models/mrp_production.py +++ b/stock_request_mrp/models/mrp_production.py @@ -39,20 +39,22 @@ def action_view_stock_request(self): action["res_id"] = requests.id return action - def _get_finished_move_value( + def _get_move_finished_values( self, product_id, product_uom_qty, product_uom, operation_id=False, byproduct_id=False, + cost_share=0, ): - res = super()._get_finished_move_value( + res = super()._get_move_finished_values( product_id, product_uom_qty, product_uom, operation_id=operation_id, byproduct_id=byproduct_id, + cost_share=cost_share, ) if self.stock_request_ids: res["allocation_ids"] = [ diff --git a/stock_request_mrp/tests/test_stock_request_mrp.py b/stock_request_mrp/tests/test_stock_request_mrp.py index 94d997623d4e..4421eac0f843 100644 --- a/stock_request_mrp/tests/test_stock_request_mrp.py +++ b/stock_request_mrp/tests/test_stock_request_mrp.py @@ -2,7 +2,7 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0). from odoo import fields -from odoo.tests import Form, common +from odoo.tests import common class TestStockRequestMrp(common.TransactionCase): @@ -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( @@ -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, @@ -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() @@ -164,12 +154,13 @@ def test_create_request_01(self): self.assertEqual( manufacturing_order.company_id, order.stock_request_ids[0].company_id ) + manufacturing_order.action_confirm() + manufacturing_order.write( + {"qty_producing": manufacturing_order.product_uom_qty} + ) + manufacturing_order._set_qty_producing() - self._produce(manufacturing_order, 5.0) - self.assertEqual(order.stock_request_ids.qty_in_progress, 5.0) - self.assertEqual(order.stock_request_ids.qty_done, 0.0) - - manufacturing_order.button_mark_done() + manufacturing_order.with_context(skip_immediate=True).button_mark_done() self.assertEqual(order.stock_request_ids.qty_in_progress, 0.0) self.assertEqual(order.stock_request_ids.qty_done, 5.0)