mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
@@ -13,8 +13,7 @@
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"depends": [
|
||||
"mrp",
|
||||
"sale",
|
||||
"sale_mrp",
|
||||
"sale_stock",
|
||||
],
|
||||
"data": [
|
||||
|
||||
@@ -21,9 +21,15 @@ class TestMrpSaleInfo(common.SavepointCase):
|
||||
],
|
||||
}
|
||||
)
|
||||
cls.product_to_use = cls.env["product.product"].create(
|
||||
{"name": "Material", "type": "product"}
|
||||
)
|
||||
cls.bom = cls.env["mrp.bom"].create(
|
||||
{
|
||||
"product_tmpl_id": cls.product.product_tmpl_id.id,
|
||||
"bom_line_ids": [
|
||||
(0, 0, {"product_id": cls.product_to_use.id, "product_qty": 1.0}),
|
||||
],
|
||||
}
|
||||
)
|
||||
cls.partner = cls.env["res.partner"].create({"name": "Test client"})
|
||||
@@ -56,3 +62,24 @@ class TestMrpSaleInfo(common.SavepointCase):
|
||||
self.assertEqual(self.sale_order.mrp_production_count, 1)
|
||||
sale_action = self.sale_order.action_view_mrp_production()
|
||||
self.assertEqual(sale_action["res_id"], production.id)
|
||||
production.action_confirm()
|
||||
|
||||
def test_orderpoint(self):
|
||||
"""Test if orderpoint MO generation still works well"""
|
||||
prev_productions = self.env["mrp.production"].search([])
|
||||
warehouse = self.env["stock.warehouse"].search([], limit=1)
|
||||
orderpoint = self.env["stock.warehouse.orderpoint"].create(
|
||||
{
|
||||
"name": "replenish product",
|
||||
"location_id": warehouse.lot_stock_id.id,
|
||||
"product_id": self.product.id,
|
||||
"product_min_qty": 10,
|
||||
"product_max_qty": 100,
|
||||
}
|
||||
)
|
||||
orderpoint._procure_orderpoint_confirm(
|
||||
company_id=orderpoint.company_id, raise_user_error=False
|
||||
)
|
||||
production = self.env["mrp.production"].search([]) - prev_productions
|
||||
self.assertEqual(len(production), 1)
|
||||
production.action_confirm()
|
||||
|
||||
Reference in New Issue
Block a user