[FIX] stock: fixing the redbot: outdated references to 'do_partial' + security access rights for new object stock.move.operation.link

bzr revid: qdp-launchpad@openerp.com-20131118134701-is7gp517r3q5nex2
This commit is contained in:
Quentin (OpenERP) 2013-11-18 14:47:01 +01:00
parent 436b46bf77
commit 9c0381416d
17 changed files with 51 additions and 48 deletions

View File

@ -125,7 +125,7 @@
-
!python {model: stock.picking}: |
picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001")).picking_ids[0]
picking_id.do_partial(context=context)
picking_id.do_transfer(context=context)
-
I check the Stock Interim account (Received) is credited successfully.
-
@ -218,7 +218,7 @@
-
!python {model: stock.picking}: |
picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
picking.do_partial(context=context)
picking.do_transfer(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-

View File

@ -133,7 +133,7 @@
-
!python {model: stock.picking}: |
picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo")).picking_ids[0]
picking_id.do_partial(context=context)
picking_id.do_transfer(context=context)
-
I check the Stock Interim account (Received) is credit successfully.
-
@ -218,7 +218,7 @@
-
!python {model: stock.picking}: |
picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001_fifo"))
picking.do_partial(context=context)
picking.do_transfer(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-

View File

@ -40,7 +40,7 @@
-
!python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average1")).picking_ids
self.do_partial(cr, uid, [pick_ids[0].id])
self.do_transfer(cr, uid, [pick_ids[0].id])
-
Check the standard price of the product (average icecream).
-
@ -70,7 +70,7 @@
-
!python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average2")).picking_ids
self.do_partial(cr, uid, [pick_ids[0].id])
self.do_transfer(cr, uid, [pick_ids[0].id])
-
Check the standard price
-
@ -96,7 +96,7 @@
-
!python {model: stock.picking}: |
self.action_assign(cr, uid, [ref("outgoing_average_shipment")])
self.do_partial(cr, uid, [ref("outgoing_average_shipment")])
self.do_transfer(cr, uid, [ref("outgoing_average_shipment")])
-
Check the standard price (60 * 10 + 30 * 80) / 40 = 75.0 did not change
-
@ -125,7 +125,7 @@
-
!python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average3")).picking_ids
self.do_partial(cr, uid, [pick_ids[0].id])
self.do_transfer(cr, uid, [pick_ids[0].id])
-
Check price is (75.0*20 + 200*0.5) / 20.5 = 78.04878
-

View File

@ -59,7 +59,7 @@
!python {model: stock.partial.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_variable1")).picking_ids
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
self.do_partial(cr, uid, [partial_id])
self.do_transfer(cr, uid, [partial_id])
-
Check the standard price of the product (variable icecream).
-
@ -73,7 +73,7 @@
!python {model: stock.partial.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_variable2")).picking_ids
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
self.do_partial(cr, uid, [partial_id])
self.do_transfer(cr, uid, [partial_id])
-
Check the standard price and change the product's cost method towards fifo
-
@ -103,7 +103,7 @@
-
!python {model: stock.partial.picking}: |
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_variable_shipment")], 'default_type':'out'})
self.do_partial(cr, uid, [partial_id])
self.do_transfer(cr, uid, [partial_id])
-
Check the standard price (60 * 10 + 30 * 80) / 40 = 75.0 did not change
-
@ -133,10 +133,10 @@
!python {model: stock.partial.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_variable3")).picking_ids
partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
self.do_partial(cr, uid, [partial_id])
self.do_transfer(cr, uid, [partial_id])
-
Change the cost method back to average and check price on product changed back to 70.0 = (20*60 + 10*60 + 30*80) / 60
-
!python {model: product.product}: |
self.write(cr, uid, [ref("product_variable_icecream")], {'cost_method': 'average'}, context=context)
assert self.browse(cr, uid, ref("product_variable_icecream")).standard_price == 70.0, 'After third reception and changing to average again, we should have an average price of 70.0 on the product'
assert self.browse(cr, uid, ref("product_variable_icecream")).standard_price == 70.0, 'After third reception and changing to average again, we should have an average price of 70.0 on the product'

View File

@ -42,7 +42,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo1")).picking_ids[0]
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
Check the standard price of the product (fifo icecream), that should have not changed because the standard price is supposed to be updated only when goods are going out of the stock
-
@ -70,7 +70,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo2")).picking_ids[0]
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
Check the standard price of the product, that should have not changed because the standard price is supposed to be updated only when goods are going out of the stock
-
@ -102,7 +102,7 @@
-
!python {model: stock.picking}: |
pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment"))
pick_obj.do_partial(context=context)
pick_obj.do_transfer(context=context)
-
Check product standard price changed to 65.0 (because last outgoing shipment was made of 10 kg at 50€ and 10 kg at 80€)
-
@ -134,7 +134,7 @@
-
!python {model: stock.picking}: |
pick_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_uom"))
pick_obj.do_partial(context=context)
pick_obj.do_transfer(context=context)
-
Check product price changed to 80.0 (because last outgoing shipment was made of 0.5 kg at 80€)
-
@ -191,7 +191,7 @@
-
!python {model: stock.picking}: |
pick_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_usd")).picking_ids[0]
pick_obj.do_partial(context=context)
pick_obj.do_transfer(context=context)
-
We create delivery order of 49.5 kg
-
@ -218,7 +218,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_cur"))
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
Check rounded price is 102 euro (because last outgoing shipment was made of 19.5kg at 80€ and 30kg at $150 (rate=1.2834)
-
@ -250,7 +250,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_ret"))
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
Check rounded price is 150.0 / 1.2834
-
@ -296,7 +296,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg"))
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
The behavior of fifo/lifo is not garantee if the quants are created at the same second, so i just wait one second
-
@ -324,7 +324,7 @@
-
!python {model: stock.picking}: |
picking_obj1 = self.browse(cr, uid, ref("outgoing_fifo_shipment_neg2"))
picking_obj1.do_partial(context=context)
picking_obj1.do_transfer(context=context)
-
Receive purchase order with 50 kg FIFO Ice Cream at 50 euro/kg
@ -348,7 +348,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg")).picking_ids[0]
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
Assert price on product is still the old price as the out move has not been received fully yet
-
@ -377,7 +377,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo_neg2")).picking_ids[0]
picking_obj.do_partial(context=context)
picking_obj.do_transfer(context=context)
-
The price of the product should have changed back to 65.0
-

View File

@ -49,7 +49,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet1")).picking_ids[0]
self.do_partial(cr,uid,[picking_obj.id], context=context)
self.do_transfer(cr,uid,[picking_obj.id], context=context)
-
Check the standard price of the product (fifo icecream)
-
@ -64,7 +64,7 @@
-
!python {model: stock.picking}: |
picking_obj = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids[0]
self.do_partial(cr,uid,[picking_obj.id], context=context)
self.do_transfer(cr,uid,[picking_obj.id], context=context)
-
Return the goods of purchase order 2
-
@ -72,7 +72,7 @@
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fiforet2")).picking_ids
return_id = self.create(cr, uid, {}, context={'active_model':'stock.picking', 'active_id': pick_ids[0].id})
return_picking_id, dummy = self._create_returns(cr, uid, [return_id], context={'active_id': pick_ids[0].id})
self.pool.get('stock.picking').do_partial(cr, uid, [return_picking_id])
self.pool.get('stock.picking').do_transfer(cr, uid, [return_picking_id])
-
Check the standard price of the product changed to 70.0 (as returns to supplier are processed as normal outgoing shipment we have sent 10kg at 50€ and 20kg at 80€, because of FIFO, so the average to store on the product is 70€)
-

View File

@ -47,7 +47,7 @@
-
!python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_1")).picking_ids[0]
pick_ids.do_partial(context=context)
pick_ids.do_transfer(context=context)
-
I check that purchase order is shipped.
-

View File

@ -22,7 +22,7 @@
'product_uom_id': ref('product.product_uom_unit'),
'product_qty': 1
})
pick.do_partial(context=context)
pick.do_transfer(context=context)
-
I test that I have two pickings, one done and one backorder to do
-

View File

@ -96,7 +96,7 @@
for pick in order.picking_ids:
data = pick.force_assign()
if data == True:
pick.do_partial(context=context)
pick.do_transfer(context=context)
-
I run the scheduler.
-

View File

@ -66,3 +66,6 @@ access_stock_pack_operation_all,stock.pack.operation all users,model_stock_pack_
access_stock_putaway_all,stock.putaway all users,model_stock_move_putaway,base.group_user,1,0,0,0
access_product_putaway_all,product.putaway all users,model_product_putaway,base.group_user,1,0,0,0
access_stock_removal_all,product.removal all users,model_product_removal,base.group_user,1,0,0,0
access_stock_move_operation_link_manager,stock.move.operation.link manager,model_stock_move_operation_link,stock.group_stock_manager,1,1,1,1
access_stock_move_operation_link_user,stock.move.operation.link user,model_stock_move_operation_link,stock.group_stock_user,1,1,1,1
access_stock_move_operation_link_all,stock.move.operation.link all users,model_stock_move_operation_link,base.group_user,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
66 access_stock_putaway_all stock.putaway all users model_stock_move_putaway base.group_user 1 0 0 0
67 access_product_putaway_all product.putaway all users model_product_putaway base.group_user 1 0 0 0
68 access_stock_removal_all product.removal all users model_product_removal base.group_user 1 0 0 0
69 access_stock_move_operation_link_manager stock.move.operation.link manager model_stock_move_operation_link stock.group_stock_manager 1 1 1 1
70 access_stock_move_operation_link_user stock.move.operation.link user model_stock_move_operation_link stock.group_stock_user 1 1 1 1
71 access_stock_move_operation_link_all stock.move.operation.link all users model_stock_move_operation_link base.group_user 1 0 0 0

View File

@ -63,7 +63,7 @@
Transfer the reception
-
!python {model: stock.picking}: |
self.do_partial(cr, uid, [ref('pick1')], context=context)
self.do_transfer(cr, uid, [ref('pick1')], context=context)
-
Check the system created 3 quants one with 120 pieces on pallet 1, one with 120 pieces on pallet 2 with lot A and 60 pieces on pallet 3
-
@ -121,7 +121,7 @@
Process this picking
-
!python {model: stock.picking}: |
self.do_partial(cr, uid, [ref('delivery_order1')], context=context)
self.do_transfer(cr, uid, [ref('delivery_order1')], context=context)
-
Check the quants that you have 120 pieces pallet 1 in customers, 100 pieces pallet 2 in stock and 20 with customers and 50 in stock, 10 in customers from pallet 3
-
@ -158,7 +158,7 @@
backorder = self.search(cr, uid, [('backorder_id.id', '=', picking.id)], context=context)
backorder_id = self.browse(cr, uid, backorder, context=context)
self.rereserve(cr, uid, [backorder_id[0].id], context=context)
self.do_partial(cr, uid, [backorder_id[0].id], context=context)
self.do_transfer(cr, uid, [backorder_id[0].id], context=context)
-
Check there are still 0 pieces in stock
-
@ -169,4 +169,4 @@
total_qty += rec.qty
product = self.pool.get("product.product").browse(cr, uid, ref('product1'))
assert total_qty == 0, "Total quantity in stock should be 0 as the backorder took everything out of stock"
assert product.qty_available == 0, "Quantity available should be 0 too"
assert product.qty_available == 0, "Quantity available should be 0 too"

View File

@ -55,7 +55,7 @@
Transfer the reception
-
!python {model: stock.picking}: |
self.do_partial(cr, uid, [ref('pick_neg')], context=context)
self.do_transfer(cr, uid, [ref('pick_neg')], context=context)
-
Make a delivery order of 300 pieces to the customer
-
@ -91,7 +91,7 @@
Process this picking
-
!python {model: stock.picking}: |
self.do_partial(cr, uid, [ref('delivery_order_neg')], context=context)
self.do_transfer(cr, uid, [ref('delivery_order_neg')], context=context)
-
Check the quants that you have 120 pieces pallet 1 in customers, -20 pieces pallet 2 in stock and 120 and 20 with customers and 20/30 in stock, 10 in customers from pallet 3
-
@ -136,7 +136,7 @@
lot_ids = self.pool.get("stock.production.lot").search(cr, uid, [('product_id', '=', ref('product_neg')), ('name','=','Lot neg')])
pack_ids = pack_obj.search(cr, uid, [('name', '=', 'Palneg 2')])
ops_obj.write(cr, uid, [pick.pack_operation_ids[0].id], {'lot_id': lot_ids[0], 'result_package_id': pack_ids[0]})
self.do_partial(cr, uid, [ref("delivery_reconcile")])
self.do_transfer(cr, uid, [ref("delivery_reconcile")])
-
Check the negative quant was reconciled and the 20 pieces of lot neg at customers have the incoming shipments in the history_ids
-
@ -146,4 +146,4 @@
pick = self.pool.get('stock.picking').browse(cr, uid, ref('delivery_reconcile'))
customer_quant = self.search(cr, uid, [('product_id', '=', ref('product_neg')), ('location_id', '=', ref('stock_location_customers')), ('lot_id.name','=', 'Lot neg'), ('qty','=', 20)])
assert pick.move_lines[0].id in [x.id for x in self.browse(cr, uid, customer_quant[0]).history_ids]

View File

@ -21,7 +21,7 @@
'product_qty': 40
})
context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]})
pick.do_partial(context=context)
pick.do_transfer(context=context)
-
I check backorder shipment after received partial shipment and check remaining shipment.
-
@ -48,7 +48,7 @@
'product_uom_id': ref('product.product_uom_kgm'),
'product_qty': 10
})
backorder.do_partial(context=context)
backorder.do_transfer(context=context)
-
I check incomming shipment after reception.
-

View File

@ -73,7 +73,7 @@
po_id = self.pool.get('purchase.order').search(cr, uid, [('partner_id', '=', ref('supplier_dropship'))])
assert po_id and len(po_id) == 1, 'Problem with the Purchase Order detected'
picking_ids = [pick.id for pick in self.pool.get('purchase.order').browse(cr, uid, po_id[0]).picking_ids]
self.do_partial(cr, uid, picking_ids)
self.do_transfer(cr, uid, picking_ids)
-
Check one quant was created in Customers location with 200 pieces and one move in the history_ids
-

View File

@ -63,7 +63,7 @@
-
!python {model: stock.picking}: |
order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo1")).picking_ids[0]
order.do_partial(context=context)
order.do_transfer(context=context)
-
Check the standard price of the product (lifo icecream)
-
@ -78,7 +78,7 @@
-
!python {model: stock.picking}: |
order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo2")).picking_ids[0]
order.do_partial(context=context)
order.do_transfer(context=context)
-
Check the standard price should not have changed
-
@ -110,7 +110,7 @@
-
!python {model: stock.picking}: |
pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_lifo_shipment"))
pick_order.do_partial(context=context)
pick_order.do_transfer(context=context)
-
Check standard price became 80 euro
-

View File

@ -35,7 +35,7 @@
-
!python {model: stock.picking}: |
partial_id = ref("stock_picking_out0")
self.do_partial(cr, uid, [partial_id])
self.do_transfer(cr, uid, [partial_id])
-
As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
@ -54,4 +54,4 @@
picking = picking_obj.browse(cr, uid, [ref('stock_picking_out0')])
partner = picking[0].partner_id.id
inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner)])
assert inv_ids, 'No Invoice is generated!'
assert inv_ids, 'No Invoice is generated!'

View File

@ -24,12 +24,12 @@ from openerp.osv import fields, osv
# class invoice_directly(osv.osv_memory):
# _inherit = 'stock.partial.picking'
#
# def do_partial(self, cr, uid, ids, context=None):
# def do_transfer(self, cr, uid, ids, context=None):
# """Launch Create invoice wizard if invoice state is To be Invoiced,
# after processing the partial picking.
# """
# if context is None: context = {}
# result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
# result = super(invoice_directly, self).do_transfer(cr, uid, ids, context)
# partial = self.browse(cr, uid, ids[0], context)
# context.update(active_model='stock.picking',
# active_ids=[partial.picking_id.id])