[ADD] Added the test for MRP Issue where producing a BoM with a component of Service...
authorParamjit Singh Sahota <psa@tinyerp.com>
Thu, 22 Aug 2013 11:08:48 +0000 (16:38 +0530)
committerParamjit Singh Sahota <psa@tinyerp.com>
Thu, 22 Aug 2013 11:08:48 +0000 (16:38 +0530)
bzr revid: psa@tinyerp.com-20130822110848-kg8g2s3gfhbgxsg9

addons/mrp/__openerp__.py
addons/mrp/test/bom_with_service_type_product.yml [new file with mode: 0644]

index 6e025ae..d712926 100644 (file)
@@ -77,6 +77,7 @@ Dashboard / Reports for MRP will include:
     #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company
     # so the ymls are too complex to change at this stage
     'test': [
+#         'test/bom_with_service_type_product.yml',
 #         'test/order_demo.yml',
 #         'test/order_process.yml',
 #         'test/cancel_order.yml',
diff --git a/addons/mrp/test/bom_with_service_type_product.yml b/addons/mrp/test/bom_with_service_type_product.yml
new file mode 100644 (file)
index 0000000..34c3505
--- /dev/null
@@ -0,0 +1,60 @@
+-
+  I create Bill of Materials with one service type product and one consumable product.
+-
+  !record {model: mrp.bom, id: mrp_bom_test1}:
+    company_id: base.main_company
+    name: BOM with Service type products
+    product_id: product.product_product_4
+    product_qty: 1.0
+    type: normal
+    bom_lines:
+      - company_id: base.main_company
+        name: On Site Assistance
+        product_id: product.product_product_3
+        product_qty: 1.0
+      - company_id: base.main_company
+        name: GrapWorks Software
+        product_id: product.product_product_45
+        product_qty: 1.0
+-
+  I make the production order for BoM having one service type product and one consumable product.
+-
+  !record {model: mrp.production, id: mrp_production_servicetype_mo1}:
+    product_id: product.product_product_6
+    product_qty: 1.0
+    bom_id: mrp_bom_test1
+    date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+-
+  I compute the data of production order.
+-
+  !python {model: mrp.production}: |
+    self.action_compute(cr, uid, [ref("mrp_production_servicetype_mo1")], {"lang": "en_US", "tz": False, "search_default_Current":
+      1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
+      "active_id": ref("mrp.menu_mrp_production_action"), })
+-
+  I confirm the production order.
+-
+  !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_mo1}
+-
+  I confirm the Consume Products.
+-
+  !python {model: mrp.production}: |
+    order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
+    assert order.state == 'confirmed', "Production order should be confirmed."
+    for move_line in order.move_lines:
+        move_line.action_consume(move_line.product_qty)
+-
+  I processed the Product Entirely.
+-
+  !python {model: mrp.production}: |
+    order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
+    assert order.state == 'in_production', 'Production order should be in production State.'
+    for move_created in order.move_created_ids:
+        move_created.action_done()
+-
+  I check production order after produced.
+-
+  !python {model: mrp.production}: |
+    order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
+    assert order.state == 'done', "Production order should be closed."
+