[ADD] Sale_margin: YAML

bzr revid: mra@mra-laptop-20100806052101-lf4m6fay3gfpf6x9
This commit is contained in:
MTR(OpenERP)
2010-08-06 10:51:01 +05:30
committed by Mustufa Rangwala
parent bbe42aa1dc
commit 10cd234bd2
2 changed files with 67 additions and 0 deletions
+1
View 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,
+66
View File
@@ -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"