[MERGE] forward port of branch 8.0 up to 591e329
[odoo/odoo.git] / addons / stock / stock_demo.yml
1 -
2   !python {model: ir.model.data}: |
3     chicago_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock_warehouse_shop0'), context=context)
4
5     #create xml ids for demo data that are widely used in tests or in other codes, for more convenience
6     xml_references = [
7         {'name':'chi_picking_type_in','module':'stock', 'model':'stock.picking.type','res_id': chicago_warehouse.in_type_id.id},
8         {'name':'chi_picking_type_out','module':'stock', 'model':'stock.picking.type','res_id': chicago_warehouse.out_type_id.id},
9         {'name':'stock_location_shop0','module':'stock', 'model':'stock.location','res_id': chicago_warehouse.lot_stock_id.id},
10     ]
11     for xml_record in xml_references:
12         xml_ids = self.search(cr, uid, [('module', '=', xml_record['module']), ('model', '=', xml_record['model']), ('name', '=', xml_record['name'])], context=context)
13         if not xml_ids:
14             self.create(cr, uid, xml_record, context=context)
15         #avoid the xml id and the associated resource being dropped by the orm by manually making a hit on it
16         self._update_dummy(cr, uid, xml_record['model'], xml_record['module'], xml_record['name'])
17 -
18  !record {model: stock.location, id: location_refrigerator_small}:
19     name: Small Refrigerator
20     usage: internal
21     location_id: stock_location_14
22 -
23  !record {model: product.product, id: product_icecream}:
24     default_code: 001
25     name: Ice Cream
26     type: product
27     categ_id: product.product_category_1
28     list_price: 100.0
29     standard_price: 70.0
30     uom_id: product.product_uom_kgm
31     property_stock_inventory: location_inventory
32     description: Ice cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
33 -
34  !record {model: stock.production.lot, id: lot_icecream_0}:
35     name: Lot0 for Ice cream
36     product_id: product_icecream
37 -
38  !record {model: stock.production.lot, id: lot_icecream_1}:
39     name: Lot1 for Ice cream
40     product_id: product_icecream
41 -
42  !record {model: stock.inventory, id: stock_inventory_icecream}:
43     name: Inventory for icecream
44     filter: 'product'
45     product_id: product_icecream
46 -
47  !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot0}:
48     product_id: product_icecream
49     product_uom_id: product.product_uom_kgm
50     inventory_id: stock_inventory_icecream
51     product_qty: 50.0
52     prod_lot_id: lot_icecream_0
53     location_id: stock_location_14
54 -
55  !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot1}:
56     product_id: product_icecream
57     product_uom_id: product.product_uom_kgm
58     inventory_id: stock_inventory_icecream
59     product_qty: 40.0
60     prod_lot_id: lot_icecream_1
61     location_id: stock_location_14
62 -
63     Create STOCK_MOVE for OUT
64 -
65  !record {model: stock.picking, id: outgoing_shipment_main_warehouse}:
66     picking_type_id: stock.picking_type_out
67     origin: 'outgoing shipment main_warehouse'
68     partner_id: base.res_partner_6
69     move_lines:
70       - product_id: product.product_product_27
71         product_uom: product.product_uom_unit
72         product_uom_qty: 15.0
73         picking_type_id: stock.picking_type_out
74         location_id: stock.stock_location_stock
75         location_dest_id: stock.stock_location_customers
76 -
77  !record {model: stock.picking, id: outgoing_shipment_main_warehouse1}:
78     picking_type_id: stock.picking_type_out
79     origin: 'outgoing shipment'
80     partner_id: base.res_partner_6
81     date: !eval "'%s-%s-15' %((datetime.now()-timedelta(days=60)).year, (datetime.now()-timedelta(days=60)).month)"
82     move_lines:
83       - product_id: product.product_product_6
84         product_uom: product.product_uom_unit
85         product_uom_qty: 180.0
86         picking_type_id: stock.picking_type_out
87         location_id: stock.stock_location_stock
88         location_dest_id: stock.stock_location_customers
89     pack_operation_ids:
90       - product_id: product.product_product_6
91         product_qty: 100
92         product_uom_id: product.product_uom_unit
93         location_id: stock.stock_location_stock
94         location_dest_id: stock.stock_location_customers
95 -
96  !record {model: stock.picking, id: outgoing_shipment_main_warehouse2}:
97     picking_type_id: stock.picking_type_out
98     origin: 'outgoing shipment your_company warehouse'
99     partner_id: base.res_partner_6
100     date: !eval "'%s-%s-15' % ((datetime.now()-timedelta(days=30)).month,(datetime.now()-timedelta(days=30)).month)"
101     move_lines:
102       - product_id: product.product_product_31
103         product_uom: product.product_uom_unit
104         product_uom_qty: 45.0
105         picking_type_id: stock.picking_type_out
106         location_id: stock.stock_location_stock
107         location_dest_id: stock.stock_location_customers
108 -
109  !record {model: stock.picking, id: outgoing_shipment_main_warehouse3}:
110     picking_type_id: stock.picking_type_out
111     origin: 'your company warehouse'
112     partner_id: base.res_partner_6
113     move_lines:
114       - product_id: product.product_product_5
115         product_uom: product.product_uom_unit
116         product_uom_qty: 75.0
117         picking_type_id: stock.picking_type_out
118         location_id: stock.stock_location_stock
119         location_dest_id: stock.stock_location_customers
120 -
121     Create STOCK_PICKING for IN
122 -
123  !record {model: stock.picking, id: incomming_shipment}:
124     picking_type_id: stock.picking_type_in
125     origin: 'incoming_shipment for test'
126 -
127  !record {model: stock.move, id: incomming_shipment_icecream}:
128     picking_id: stock.incomming_shipment
129     product_id: product_icecream
130     product_uom: product.product_uom_kgm
131     product_uom_qty: 50.0
132     picking_type_id: stock.picking_type_in
133     location_id: stock_location_suppliers
134     location_dest_id: stock_location_14
135 -
136  !record {model: stock.picking, id: incomming_shipment1}:
137     picking_type_id: stock.picking_type_in
138     origin: 'incoming_shipment'
139     partner_id: base.res_partner_6
140     move_lines:
141       - product_id: product.product_product_48
142         product_uom: product.product_uom_unit
143         product_uom_qty: 35.0
144         picking_type_id: stock.picking_type_in
145         location_id: stock.stock_location_suppliers
146         location_dest_id: stock.stock_location_stock
147 -
148  !record {model: stock.picking, id: incomming_shipment2}:
149     picking_type_id: stock.picking_type_in
150     origin: 'incoming_shipment main_warehouse'
151     partner_id: base.res_partner_6
152     move_lines:
153       - product_id: product.product_product_22
154         product_uom: product.product_uom_unit
155         product_uom_qty: 125.0
156         picking_type_id: stock.picking_type_in
157         location_id: stock.stock_location_suppliers
158         location_dest_id: stock.stock_location_stock
159 -
160  !record {model: stock.picking, id: incomming_shipment3}:
161     picking_type_id: stock.picking_type_in
162     origin: 'incoming_shipment your_company warehouse'
163     partner_id: base.res_partner_6
164     move_lines:
165       - product_id: product.product_product_10
166         product_uom: product.product_uom_unit
167         product_uom_qty: 120.0
168         picking_type_id: stock.picking_type_in
169         location_id: stock.stock_location_suppliers
170         location_dest_id: stock.stock_location_stock
171 -
172  !record {model: stock.picking, id: incomming_shipment4}:
173     picking_type_id: stock.picking_type_in
174     origin: 'incoming_shipment_main_warehouse'
175     partner_id: base.res_partner_6
176     move_lines:
177       - product_id: product.product_product_31
178         product_uom: product.product_uom_unit
179         product_uom_qty: 50.0
180         picking_type_id: stock.picking_type_in
181         location_id: stock.stock_location_suppliers
182         location_dest_id: stock.stock_location_stock
183 -
184    Create STOCK_PICKING_IN for Chicago Warehouse
185 -
186  !record {model: stock.picking, id: incomming_chicago_warehouse}:
187     picking_type_id: chi_picking_type_in
188     origin: 'incoming_chicago_warehouse'
189     partner_id: base.res_partner_6
190     move_lines:
191       - product_id: product.product_product_9
192         product_uom: product.product_uom_unit
193         product_uom_qty: 25.0
194         picking_type_id: chi_picking_type_in
195         location_id: stock.stock_location_suppliers
196         location_dest_id: stock.stock_location_shop0
197 -
198  !record {model: stock.picking, id: incomming_chicago_warehouse1}:
199     picking_type_id: chi_picking_type_in
200     origin: 'incoming_shipment_chicago_warehouse'
201     partner_id: base.res_partner_6
202     move_lines:
203       - product_id: product.product_product_48
204         product_uom: product.product_uom_unit
205         product_uom_qty: 180.0
206         picking_type_id: chi_picking_type_in
207         location_id: stock.stock_location_suppliers
208         location_dest_id: stock.stock_location_shop0
209         state: done
210     pack_operation_ids:
211       - product_id: product.product_product_48
212         product_qty: 100
213         product_uom_id: product.product_uom_unit
214         location_id: stock.stock_location_suppliers
215         location_dest_id: stock.stock_location_shop0
216 -
217  !record {model: stock.picking, id: incomming_chicago_warehouse2}:
218     picking_type_id: chi_picking_type_in
219     origin: 'incoming_shipment chicago_warehouse'
220     partner_id: base.res_partner_6
221     move_lines:
222       - product_id: product.product_product_32
223         product_uom: product.product_uom_unit
224         product_uom_qty: 45.0
225         picking_type_id: chi_picking_type_in
226         location_id: stock.stock_location_suppliers
227         location_dest_id: stock.stock_location_shop0
228 -
229  !record {model: stock.picking, id: incomming_chicago_warehouse3}:
230     picking_type_id: chi_picking_type_in
231     origin: 'chicago_warehouse'
232     partner_id: base.res_partner_6
233     date: !eval "'%s-%s-2' % ((datetime.now()-timedelta(days=30)).month,(datetime.now()-timedelta(days=30)).month)"
234     move_lines:
235       - product_id: product.product_product_22
236         product_uom: product.product_uom_unit
237         product_uom_qty: 75.0
238         picking_type_id: chi_picking_type_in
239         location_id: stock.stock_location_suppliers
240         location_dest_id: stock.stock_location_shop0
241 -
242    Create STOCK_PICKING_OUT for Chicago Warehouse
243 -
244  !record {model: stock.picking, id: outgoing_chicago_warehouse}:
245     picking_type_id: chi_picking_type_out
246     origin: 'outgoing_chicago_warehouse'
247     partner_id: base.res_partner_6
248     move_lines:
249       - product_id: product.product_product_27
250         product_uom: product.product_uom_unit
251         product_uom_qty: 15.0
252         picking_type_id: chi_picking_type_out
253         location_id: stock.stock_location_shop0
254         location_dest_id: stock.stock_location_customers
255 -
256  !record {model: stock.picking, id: outgoing_chicago_warehouse1}:
257     picking_type_id: chi_picking_type_out
258     origin: 'outgoing_shipment_chicago_warehouse'
259     partner_id: base.res_partner_6
260     move_lines:
261       - product_id: product.product_product_6
262         product_uom: product.product_uom_unit
263         product_uom_qty: 180.0
264         picking_type_id: chi_picking_type_out
265         location_id: stock.stock_location_shop0
266         location_dest_id: stock.stock_location_customers
267     pack_operation_ids:
268       - product_id: product.product_product_6
269         product_qty: 100
270         product_uom_id: product.product_uom_unit
271         location_id: stock.stock_location_shop0
272         location_dest_id: stock.stock_location_customers
273 -
274  !record {model: stock.picking, id: outgoing_chicago_warehouse2}:
275     picking_type_id: chi_picking_type_out
276     origin: 'chicago_warehouse'
277     partner_id: base.res_partner_6
278     move_lines:
279       - product_id: product.product_product_31
280         product_uom: product.product_uom_unit
281         product_uom_qty: 45.0
282         picking_type_id: chi_picking_type_out
283         location_id: stock.stock_location_shop0
284         location_dest_id: stock.stock_location_customers
285 -
286  !record {model: stock.picking, id: outgoing_chicago_warehouse3}:
287     picking_type_id: chi_picking_type_out
288     origin: 'outgoing chicago warehouse'
289     partner_id: base.res_partner_6
290     move_lines:
291       - product_id: product.product_product_5
292         product_uom: product.product_uom_unit
293         product_uom_qty: 75.0
294         picking_type_id: chi_picking_type_out
295         location_id: stock.stock_location_shop0
296         location_dest_id: stock.stock_location_customers
297 -
298  !python {model: stock.picking}: |
299     self.action_confirm(cr, uid, [ref('outgoing_shipment_main_warehouse'),ref('outgoing_shipment_main_warehouse1'),ref('incomming_shipment2'),ref('incomming_shipment1'),ref('incomming_shipment3'),ref('outgoing_chicago_warehouse3'),ref('outgoing_chicago_warehouse2'),ref('outgoing_chicago_warehouse1'),ref('incomming_chicago_warehouse1'),ref('incomming_chicago_warehouse2'),ref('incomming_chicago_warehouse3')], context=context)
300     record = self.browse(cr, uid, ref('outgoing_shipment_main_warehouse1'), context=context)
301     record_chi_in = self.browse(cr, uid, ref('incomming_chicago_warehouse1'), context=context)
302     record_chi_out = self.browse(cr, uid, ref('outgoing_chicago_warehouse1'), context=context)
303     if record.state != 'done' and record_chi_in.state != 'done' and record_chi_out.state != 'done':
304       self.force_assign(cr, uid, [ref('outgoing_shipment_main_warehouse'),ref('outgoing_chicago_warehouse3'),ref('outgoing_shipment_main_warehouse2')], context=context)
305       self.do_transfer(cr, uid, [ref('outgoing_shipment_main_warehouse1'),ref('incomming_chicago_warehouse1'),ref('outgoing_chicago_warehouse1')], context=context)