[ADD]purchase:Add Yml file which has product price Costing Method is Average Price
[odoo/odoo.git] / addons / purchase / test / purchase_on_average_price.yml
1 -
2   In order to test Checking of Cost price of product if the product price "Costing Method" 
3   is "Average Price" and we change value of product on incoming shipment
4   
5 -        
6   I create  product.
7 -
8   !record {model: product.product, id: product_product_pen0 }:
9     categ_id: product.product_category_3
10     cost_method: average
11     name: Pen drive
12     procure_method: make_to_stock
13     supply_method: buy
14     type: product
15     standard_price: 1500.0
16     list_price: 1500.0
17     supply_method: buy
18     uom_id: product.product_uom_unit
19     uom_po_id: product.product_uom_unit
20     volume: 0.0
21     warranty: 0.0
22     weight: 0.0
23
24 -
25   Update Starting Real Stock And Virtual Stock threw Wizard
26 -
27   !record {model: stock.change.product.qty , id: stock_change_product_id }:
28     product_id: product_product_pen0 
29     new_quantity: 2.0
30     location_id: stock.stock_location_stock
31 -
32   Then, Click on "Update Price" button of this wizard.
33 -
34   !python {model: stock.change.product.qty }: |
35     self.change_product_qty(cr, uid, [ref('stock_change_product_id')], {'active_id': ref('product_product_pen0')})
36 -
37   I create purchase order for Pen drive.
38
39   !record {model: purchase.order, id: purchase_order_po11}:
40     company_id: base.main_company
41     date_order: '2010-05-11'
42     invoice_method: order
43     location_id: stock.stock_location_stock
44     order_line:
45       - date_planned: '2010-05-13'
46         name: Pen drive
47         price_unit: 1500.0
48         product_id: 'product_product_pen0'
49         product_qty: 2.0
50         product_uom: product.product_uom_unit
51         state: draft
52     partner_address_id: base.res_partner_address_7
53     partner_id: base.res_partner_4
54     pricelist_id: purchase.list0
55 -
56   PO Initially in Draft State .
57 -
58   !assert {model: purchase.order, id: purchase_order_po11}:
59     - state == 'draft'  
60 -  
61   PO Going to Draft To Confirm State
62 -
63   !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po11}
64 -
65   I check that the Order has transit from draft state to confirm state.
66 -
67   !assert {model: purchase.order, id: purchase_order_po11}:
68     - state == 'approved'  
69 -   
70   I receive the order of the supplier the Incoming Shipments menu.
71 -   
72   !python {model: stock.picking }: |
73     import time
74     procurement_obj = self.pool.get('procurement.order')
75     proc_ids = procurement_obj.browse(cr, uid, [ref('purchase_order_po11')])[0]
76     picking_ids = self.search(cr, uid, [('purchase_id', '=', proc_ids.id),('type','=','in')])
77     pickings = self.browse(cr, uid, picking_ids)
78     for picking in pickings:
79        move = picking.move_lines[0]
80        partial_datas = {
81             'partner_id': picking.address_id.partner_id.id,
82             'address_id': picking.address_id.id,
83             'delivery_date' : time.strftime('%Y-%m-%d')
84            }
85        partial_datas['move%s'%(move.id)]= {
86            'product_id': move.product_id,
87            'product_qty': move.product_qty,
88            'product_uom': move.product_uom.id,
89            'product_price' : 1000.0,
90        } 
91        self.do_partial(cr, uid, [picking.id], partial_datas)
92 -
93   I confirm the Reservation.
94 -
95   !python {model: stock.move }: |
96     procurement_obj = self.pool.get('procurement.order')
97     picking_obj = self.pool.get('stock.picking')
98     proc_ids = procurement_obj.browse(cr, uid, [ref('purchase_order_po11')])[0]
99     picking_ids = picking_obj.search(cr, uid, [('purchase_id', '=', proc_ids.id),('type','=','in')])
100     move_ids = self.search(cr, uid, [('picking_id', '=', picking_ids)])
101     self.action_done(cr,uid,move_ids)
102 -
103   Compare With Avarage Price Has Been Updated that is Correct
104 -
105   !assert {model: product.product, id: product_product_pen0 ,string: Updated Avarage Price Has not been Correct}:
106     - standard_price == 1250  
107