--- /dev/null
+-
+ 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