2
Creating a res.partner record
4
!record {model: res.partner, id: res_partner_testsupplier0}:
13
Creating a res.partner.address record
15
!record {model: res.partner.address, id: res_partner_address_0}:
16
partner_id: res_partner_testsupplier0
21
Creating a product.nomenclature record
23
!record {model: product.nomenclature, id: product_nomenclature_test0}:
29
Creating a product.nomenclature record
31
!record {model: product.nomenclature, id: product_nomenclature_test1}:
35
parent_id: product_nomenclature_test0
39
Creating a product.nomenclature record
41
!record {model: product.nomenclature, id: product_nomenclature_test2}:
45
parent_id: product_nomenclature_test1
49
Creating a product.nomenclature record
51
!record {model: product.nomenclature, id: product_nomenclature_test3}:
55
parent_id: product_nomenclature_test2
59
Creating a product.product record
61
!record {model: product.product, id: product_product_testproduct0}:
63
categ_id: product.cat0
69
name_template: test product
71
nomen_c_manda_1: test1
72
nomen_c_manda_2: test2
73
nomen_c_manda_3: test3
74
nomen_manda_0: product_nomenclature_test0
75
nomen_manda_1: product_nomenclature_test1
76
nomen_manda_2: product_nomenclature_test2
77
nomen_manda_3: product_nomenclature_test3
78
procure_method: make_to_stock
86
uom_id: product.product_uom_unit
87
uom_po_id: product.product_uom_unit
89
valuation: manual_periodic
97
Creating a ir.sequence record
99
!record {model: ir.sequence, id: ir_sequence_purchaseorder0}:
108
Creating a ir.sequence.type record
110
!record {model: ir.sequence.type, id: ir_sequence_type_purchaseorder0}:
115
Creating a purchase.order record
117
!record {model: purchase.order, id: purchase_order_po0}:
122
company_id: base.main_company
123
date_order: '2011-08-29'
124
delivery_requested_date: '2011-08-31'
125
est_transport_lead_time: 0.0
126
invoice_method: order
127
location_id: stock.stock_location_stock
128
minimum_planned_date: '2011-08-29'
131
partner_address_id: res_partner_address_0
132
partner_id: res_partner_testsupplier0
133
pricelist_id: purchase.list0
134
sequence_id: ir_sequence_purchaseorder0
138
Creating a purchase.order.line record
140
!record {model: purchase.order.line, id: purchase_order_line_testproduct0}:
141
company_id: base.main_company
142
date_planned: '2011-08-29'
144
default_name: test product
146
internal_name: test product
149
order_id: purchase_order_po0
150
partner_id: res_partner_testsupplier0
152
product_id: product_product_testproduct0
154
product_uom: product.product_uom_unit
160
!python {model: purchase.order}: |
162
#print self.search(cr, uid, [('name', '=', 'PO test')])
165
We confirm the purchase_order_po0
167
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0}
171
We confirm the purchase_order_po0 (double validation)
173
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po0}
177
Check incoming Creation
179
!python {model: stock.picking}: |
182
pick_ids = self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_po0"))], context=context)
183
assert len(pick_ids) == 1, 'wrong number of IN stock picking'
184
context.update(active_ids=pick_ids)
186
# process incoming shipment with a new expiry date
187
# create wizard objects
188
wizard_obj = self.pool.get('stock.partial.picking')
189
wizard_id = self.action_process(cr, uid, pick_ids, context=context)['res_id']
191
# enter the new expiry date value - memory_out because product cost method is standard price
192
the_date = time.strftime('%Y-%m-%d')
193
the_date = '2022-01-01'
194
for memory_out in wizard_obj.browse(cr, uid, wizard_id, context=context).product_moves_out:
196
memory_out.write({'expiry_date': the_date}, context=context)
198
# validate the processing
199
wizard_obj.do_partial(cr, uid, [wizard_id], context=context)
201
# check a new production lot has been created with corresponding expiry date
202
prodlot_obj = self.pool.get('stock.production.lot')
203
assert len(prodlot_obj.search(cr, uid, [('life_date', '=', the_date), ('type', '=', 'internal')], context=context)), 'prodlots wrong'
206
We create a inventory control
210
!record {model: stock.inventory, id: stock_inventory0}:
217
!record {model: stock.reason.type, id: stock_reasontype0}:
218
name: testreasontype01
225
!record {model: stock.inventory.line, id: stock_inventory_line0}:
226
location_id: stock.stock_location_stock
227
product_id: product_product_testproduct0
228
reason_type_id: stock_reasontype0
229
product_uom: product.product_uom_unit
230
expiry_date: 2011-10-04
231
inventory_id: stock_inventory0
233
hidden_perishable_mandatory: True
236
Confirm and validate the inventory - check the new production lot
239
!python {model: stock.inventory}: |
240
self.action_confirm(cr, uid, [ref("stock_inventory0")])
241
self.action_done(cr, uid, [ref("stock_inventory0")])
243
# check the new production lot
244
prodlot_obj = self.pool.get('stock.production.lot')
245
ids = prodlot_obj.search(cr, uid, [('product_id', '=', ref("product_product_testproduct0")), ('life_date', '=', '2011-10-04'),])
246
assert len(ids) == 1, 'the number of production lot is wrong - 1 - %s'%len(ids)
b'\\ No newline at end of file'