2 !python {model: ir.model.data}: |
3 chicago_warehouse = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock_warehouse_shop0'), context=context)
5 #create xml ids for demo data that are widely used in tests or in other codes, for more convenience
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},
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)
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'])
18 !record {model: stock.location, id: location_refrigerator_small}:
19 name: Small Refrigerator
21 location_id: stock_location_14
23 !record {model: product.product, id: product_icecream}:
27 categ_id: product.product_category_1
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.
34 !record {model: stock.production.lot, id: lot_icecream_0}:
35 name: Lot0 for Ice cream
36 product_id: product_icecream
38 !record {model: stock.production.lot, id: lot_icecream_1}:
39 name: Lot1 for Ice cream
40 product_id: product_icecream
42 !record {model: stock.inventory, id: stock_inventory_icecream}:
43 name: Inventory for icecream
45 product_id: product_icecream
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
52 prod_lot_id: lot_icecream_0
53 location_id: stock_location_14
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
60 prod_lot_id: lot_icecream_1
61 location_id: stock_location_14
63 Create STOCK_MOVE for OUT
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
70 - product_id: product.product_product_27
71 product_uom: product.product_uom_unit
73 picking_type_id: stock.picking_type_out
74 location_id: stock.stock_location_stock
75 location_dest_id: stock.stock_location_customers
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)"
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
90 - product_id: product.product_product_6
92 product_uom_id: product.product_uom_unit
93 location_id: stock.stock_location_stock
94 location_dest_id: stock.stock_location_customers
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)"
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
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
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
121 Create STOCK_PICKING for IN
123 !record {model: stock.picking, id: incomming_shipment}:
124 picking_type_id: stock.picking_type_in
125 origin: 'incomming_shipment for test'
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
136 !record {model: stock.picking, id: incomming_shipment1}:
137 picking_type_id: stock.picking_type_in
138 origin: 'incomming_shipment'
139 partner_id: base.res_partner_6
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
148 !record {model: stock.picking, id: incomming_shipment2}:
149 picking_type_id: stock.picking_type_in
150 origin: 'incomming_shipment main_warehouse'
151 partner_id: base.res_partner_6
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
160 !record {model: stock.picking, id: incomming_shipment3}:
161 picking_type_id: stock.picking_type_in
162 origin: 'incomming_shipment your_company warehouse'
163 partner_id: base.res_partner_6
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
172 !record {model: stock.picking, id: incomming_shipment4}:
173 picking_type_id: stock.picking_type_in
174 origin: 'incomming_shipment_main_warehouse'
175 partner_id: base.res_partner_6
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
184 Create STOCK_PICKING_IN for Chicago Warehouse
186 !record {model: stock.picking, id: incomming_chicago_warehouse}:
187 picking_type_id: chi_picking_type_in
188 origin: 'incomming_chicago_warehouse'
189 partner_id: base.res_partner_6
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
198 !record {model: stock.picking, id: incomming_chicago_warehouse1}:
199 picking_type_id: chi_picking_type_in
200 origin: 'incomming_shipment_chicago_warehouse'
201 partner_id: base.res_partner_6
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
211 - product_id: product.product_product_48
213 product_uom_id: product.product_uom_unit
214 location_id: stock.stock_location_suppliers
215 location_dest_id: stock.stock_location_shop0
217 !record {model: stock.picking, id: incomming_chicago_warehouse2}:
218 picking_type_id: chi_picking_type_in
219 origin: 'incomming_shipment chicago_warehouse'
220 partner_id: base.res_partner_6
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
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)"
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
242 Create STOCK_PICKING_OUT for Chicago Warehouse
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
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
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
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
268 - product_id: product.product_product_6
270 product_uom_id: product.product_uom_unit
271 location_id: stock.stock_location_shop0
272 location_dest_id: stock.stock_location_customers
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
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
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
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
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)