49
46
Creating a product.nomenclature record
51
48
!record {model: product.nomenclature, id: product_nomenclature_test3}:
55
51
parent_id: product_nomenclature_test2
55
Creating a product.category record
57
!record {model: product.category, id: product_category_test1}:
59
family_id: product_nomenclature_test2
59
61
Creating a product.product record
61
63
!record {model: product.product, id: product_product_testproduct0}:
63
65
categ_id: product.cat0
64
66
cost_method: standard
69
71
name_template: test product
71
nomen_c_manda_1: test1
72
nomen_c_manda_2: test2
73
nomen_c_manda_3: test3
74
72
nomen_manda_0: product_nomenclature_test0
75
73
nomen_manda_1: product_nomenclature_test1
76
74
nomen_manda_2: product_nomenclature_test2
119
118
amount_total: 1.0
120
119
amount_untaxed: 1.0
122
121
company_id: base.main_company
123
date_order: '2011-08-29'
124
delivery_requested_date: '2011-08-31'
122
date_order: !eval "'%s-08-29'%(time.strftime('%Y'),)"
123
delivery_requested_date: !eval "'%s-08-31'%(time.strftime('%Y'),)"
125
124
est_transport_lead_time: 0.0
126
125
invoice_method: order
127
126
location_id: stock.stock_location_stock
128
minimum_planned_date: '2011-08-29'
127
minimum_planned_date: !eval "'%s-08-29'%(time.strftime('%Y'),)"
130
129
order_type: regular
131
130
partner_address_id: res_partner_address_0
140
139
!record {model: purchase.order.line, id: purchase_order_line_testproduct0}:
141
140
company_id: base.main_company
142
date_planned: '2011-08-29'
141
date_planned: !eval "'%s-08-29'%(time.strftime('%Y'),)"
144
143
default_name: test product
145
144
internal_code: test
146
145
internal_name: test product
182
181
pick_ids = self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_po0"))], context=context)
183
182
assert len(pick_ids) == 1, 'wrong number of IN stock picking'
184
183
context.update(active_ids=pick_ids)
186
184
# process incoming shipment with a new expiry date
187
185
# create wizard objects
188
186
wizard_obj = self.pool.get('stock.partial.picking')
189
187
wizard_id = self.action_process(cr, uid, pick_ids, context=context)['res_id']
191
188
# enter the new expiry date value - memory_out because product cost method is standard price
192
189
the_date = time.strftime('%Y-%m-%d')
193
190
the_date = '2022-01-01'
194
191
for memory_out in wizard_obj.browse(cr, uid, wizard_id, context=context).product_moves_out:
196
193
memory_out.write({'expiry_date': the_date}, context=context)
198
195
# validate the processing
197
c.update({'wizard_ids': [wizard_id], 'wizard_id': wizard_id, 'wizard_name': 'name','model': 'stock.partial.picking','step': 'step'})
198
wizard_obj.copy_all(cr,uid,[wizard_id], context=c)
199
199
wizard_obj.do_partial(cr, uid, [wizard_id], context=context)
201
200
# check a new production lot has been created with corresponding expiry date
202
201
prodlot_obj = self.pool.get('stock.production.lot')
203
202
assert len(prodlot_obj.search(cr, uid, [('life_date', '=', the_date), ('type', '=', 'internal')], context=context)), 'prodlots wrong'
244
243
prodlot_obj = self.pool.get('stock.production.lot')
245
244
ids = prodlot_obj.search(cr, uid, [('product_id', '=', ref("product_product_testproduct0")), ('life_date', '=', '2011-10-04'),])
246
245
assert len(ids) == 1, 'the number of production lot is wrong - 1 - %s'%len(ids)
248
test new onchange functions
250
product - product_product_testproduct0
251
location_id - stock.stock_location_stock
255
!python {model: stock.inventory.line}: |
257
self.change_lot(cr, uid, [ref("stock_inventory_line0")], ref("stock.stock_location_stock"), ref("product_product_testproduct0"), prod_lot_id=False, uom=False, to_date=False,)
258
# on_change_location_id
259
self.on_change_location_id(cr, uid, [ref("stock_inventory_line0")], ref("stock.stock_location_stock"), ref("product_product_testproduct0"), prod_lot_id=False, uom=False, to_date=False,)
260
# on_change_product_id_specific_rules
261
self.on_change_product_id_specific_rules(cr, uid, [ref("stock_inventory_line0")], ref("stock.stock_location_stock"), ref("product_product_testproduct0"), prod_lot_id=False, uom=False, to_date=False,)
b'\\ No newline at end of file'
264
Try to create a Min/Max stock rules with an UoM which
265
has a different category than the standard product UoM
267
!python {model: stock.warehouse.orderpoint}: |
269
self.create(cr, uid, {'product_id': ref("product_product_testproduct0"),
270
'location_id': ref("stock.stock_location_stock"),
271
'warehouse_id': ref("stock.warehouse0"),
272
'product_min_qty': 1.00,
273
'product_max_qty': 1.00,
274
'qty_multiple': 1.00,
275
'product_uom': ref("product.product_uom_kgm")})
276
assert False, "No error raised when the Min/Max rule has a non-compatible UoM"