[FIX] barcodes,point_of_sale,stock,base: minor changes from code review
[odoo/odoo.git] / addons / stock / test / move.yml
1 -
2   I first create a new product
3 -
4     !record {model: product.product, id: move_product}:
5          name: move prod
6          type: product
7 -
8   In order to test the negative quants, I create a move of 5 products from stock to customer
9 -
10   !record {model: stock.move, id: move_test0}:
11     name: Move Products
12     product_id: move_product
13     product_uom_qty: 5
14     product_uom: product.product_uom_unit
15     product_uos_qty: 5
16     product_uos: product.product_uom_unit
17     location_id: stock.stock_location_stock
18     location_dest_id: stock.stock_location_customers
19 -
20   I confirm the move to be processed in the future
21 -
22   !python {model: stock.move}: |
23     self.action_confirm(cr, uid, [ref('move_test0')], context=context)
24 -
25   I check that the quantity on hand is 0 and virtual is -5
26 -
27   !python {model: product.product}: |
28     context['location'] = False
29     product = self.browse(cr, uid, ref('move_product'), context=context)
30     assert product.qty_available == 0, 'Expecting 0 products in stock, got %.2f!' % (product.qty_available,)
31     assert product.virtual_available == -5.0, 'Expecting -5 products in virtual stock, got %.2f!' % (product.virtual_available,)
32 -
33   I validate the move
34 -
35   !python {model: stock.move}: |
36     self.action_done(cr, uid, [ref('move_test0')], context=context)
37 -
38   I check that the quantity on hand is -5 and 5 products are at customer location
39 -
40   !python {model: product.product}: |
41     context['location'] = False
42     product = self.browse(cr, uid, ref('move_product'), context=context)
43     assert product.qty_available == -5, 'Expecting -5 products in stock, got %.2f!' % (product.qty_available,)
44
45     context['location'] = ref('stock.stock_location_customers')
46     product = self.browse(cr, uid, ref('move_product'), context=context)
47     assert product.qty_available == 5, 'Expecting 5 products in customer location, got %.2f!' % (product.qty_available,)
48 -
49   To compensate negative quants, I will receive 15 products from the supplier
50 -
51   !record {model: stock.move, id: move_test2}:
52     name: Move 15 Products
53     product_id: move_product
54     product_uom_qty: 15
55     product_uom: product.product_uom_unit
56     product_uos_qty: 15
57     product_uos: product.product_uom_unit
58     location_id: stock.stock_location_suppliers
59     location_dest_id: stock.stock_location_stock
60 -
61   I confirm and validate the move
62 -
63   !python {model: stock.move}: |
64     self.action_confirm(cr, uid, [ref('move_test2')], context=context)
65     self.action_done(cr, uid, [ref('move_test2')], context=context)
66 -
67   I check that the quantity on hand is 10
68 -
69   !python {model: product.product}: |
70     context['location'] = False
71     product = self.browse(cr, uid, ref('move_product'), context=context)
72     assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
73     assert product.virtual_available == 10.0, 'Expecting 10 products in virtual stock, got %.2f!' % (product.virtual_available,)
74 -
75   I create a move of 2 products from stock to customer
76 -
77   !record {model: stock.move, id: move_test1}:
78     name: Move Products
79     product_id: move_product
80     product_uom_qty: 2
81     product_uom: product.product_uom_unit
82     product_uos_qty: 2
83     product_uos: product.product_uom_unit
84     location_id: stock.stock_location_stock
85     location_dest_id: stock.stock_location_customers
86 -
87   I confirm the move to be processed in the future
88 -
89   !python {model: stock.move}: |
90     self.action_confirm(cr, uid, [ref('move_test1')], context=context)
91 -
92   I check that the quantity on hand is 10 and virtual is 8
93 -
94   !python {model: product.product}: |
95     context['location'] = False
96     product = self.browse(cr, uid, ref('move_product'), context=context)
97     assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
98     assert product.virtual_available == 8.0, 'Expecting 8 products in virtual stock, got %.2f!' % (product.virtual_available,)
99 -
100   I validate the move
101 -
102   !python {model: stock.move}: |
103     self.action_done(cr, uid, [ref('move_test1')], context=context)
104 -
105   I check that the quantity on hand is 8 and 7 products are at customer location
106 -
107   !python {model: product.product}: |
108     context['location'] = False
109     product = self.browse(cr, uid, ref('move_product'), context=context)
110     assert product.qty_available == 8, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
111
112     context['location'] = ref('stock.stock_location_customers')
113     product = self.browse(cr, uid, ref('move_product'), context=context)
114     assert product.qty_available == 7, 'Expecting 7 products in customer location, got %.2f!' % (product.qty_available,)