[ADD] Sale_margin: YAML
authorMTR(OpenERP) <>
Fri, 6 Aug 2010 05:21:01 +0000 (10:51 +0530)
committerMustufa Rangwala <mra@mra-laptop>
Fri, 6 Aug 2010 05:21:01 +0000 (10:51 +0530)
bzr revid: mra@mra-laptop-20100806052101-lf4m6fay3gfpf6x9

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

index 3a59a69..1f10066 100644 (file)
@@ -29,6 +29,7 @@
     "author":"OpenERP SA",
     "depends":["sale"],
     "demo_xml":[],
+    'test': ['test/sale_margin.yml'],
     "update_xml":["security/ir.model.access.csv","sale_margin_view.xml","report/report_margin_view.xml"],
     "active": False,
     "installable": True,
diff --git a/addons/sale_margin/test/sale_margin.yml b/addons/sale_margin/test/sale_margin.yml
new file mode 100644 (file)
index 0000000..19a4f4a
--- /dev/null
@@ -0,0 +1,66 @@
+-
+  In order to test the sale_margin module in OpenERP,
+  I create a sale order and verify its margin
+-
+   I place a sale order for product keyboard, quantity 50
+-
+  !record {model: sale.order, id: sale_order_so11}:
+    date_order: '2010-08-04'
+    invoice_quantity: order
+    name: Test_SO011
+    order_line:
+      - name: '[KEYA] Keyboard - AZERTY'
+        price_unit: 7.0
+        product_uom: product.product_uom_unit
+        product_uom_qty: 100.0
+        state: draft
+        delay: 7.0
+        product_id: product.product_product_24
+        product_uos_qty: 100.0
+        th_weight: 0.0
+        type: make_to_stock
+    order_policy: manual
+    partner_id: base.res_partner_4
+    partner_invoice_id: base.res_partner_address_7
+    partner_order_id: base.res_partner_address_7
+    partner_shipping_id: base.res_partner_address_7
+    picking_policy: direct
+    pricelist_id: product.list0
+    shop_id: sale.shop
+-
+  I confirm the sale order
+-
+  !workflow {model: sale.order, action: order_confirm, ref: sale_order_so11}
+-
+  I verify that margin field gets bind with the value
+-
+  !python {model: sale.order}: |
+    so = self.browse(cr, uid, ref("sale_order_so11"))
+    assert so.margin, "No margin !" 
+-
+  I verify that the picking has been generated for the sale order
+-
+  !python {model: sale.order}: |
+    so = self.browse(cr, uid, ref("sale_order_so11"))
+    assert so.picking_ids,"Picking has not been generated"
+-
+  Then I click on the 'Create Invoice' button of 'Outgoing Orders'
+-
+  !python {model: stock.picking}: |
+    sale_order_obj = self.pool.get('sale.order')
+    so = sale_order_obj.browse(cr, uid, ref("sale_order_so11"))
+    ids = self.search(cr, uid, [('origin', '=', so.name),('type', '=', 'out')])
+    self.create_invoice(cr, uid, ids, {"lang": "en_US", "search_default_available":
+      1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
+      "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
+      })
+-
+  I verify that an invoice has been generated from picking
+-
+  !python {model: stock.picking}: |
+    sale_order_obj = self.pool.get('sale.order')
+    so = sale_order_obj.browse(cr, uid, ref("sale_order_so11"))
+    pick_ids = self.search(cr, uid, [('origin', '=', so.name)])
+    pick_brw = self.browse(cr, uid, pick_ids[0])
+    assert pick_brw.invoice_ids,"Invoice has not been created"
+    
\ No newline at end of file