mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_request_mrp: Cancel production orders linked to stock.request records
TT39761
This commit is contained in:
@@ -43,6 +43,11 @@ class StockRequest(models.Model):
|
||||
)
|
||||
)
|
||||
|
||||
def action_cancel(self):
|
||||
res = super().action_cancel()
|
||||
self.mapped("production_ids").action_cancel()
|
||||
return res
|
||||
|
||||
def action_view_mrp_production(self):
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"mrp.mrp_production_action"
|
||||
|
||||
@@ -87,6 +87,14 @@ class TestStockRequestMrp(TestStockRequest):
|
||||
self.assertEqual(order.stock_request_ids.qty_in_progress, 0.0)
|
||||
self.assertEqual(order.stock_request_ids.qty_done, 5.0)
|
||||
|
||||
def test_stock_request_order_action_cancel(self):
|
||||
order = self._create_stock_request(self.stock_request_user, [(self.product, 5)])
|
||||
order.action_confirm()
|
||||
production = fields.first(order.stock_request_ids.production_ids)
|
||||
self.assertEqual(production.state, "confirmed")
|
||||
order.with_context(bypass_confirm_wizard=True).action_cancel()
|
||||
self.assertEqual(production.state, "cancel")
|
||||
|
||||
def test_view_actions(self):
|
||||
order = self._create_stock_request(self.stock_request_user, [(self.product, 5)])
|
||||
order.action_confirm()
|
||||
|
||||
Reference in New Issue
Block a user