[FIX] stock: fixed error in yaml test. sale, purchase: fixed error on module installation with a temporary workaround that duplicates the reference of new fields on stock.picking.in/out classes (these lines should be removed as soon as the bug in the framework that prevent the orm of knowing the new columns on inhertied class is fired)

bzr revid: qdp-launchpad@openerp.com-20120508163204-hjg6ztjr38m1cydl
This commit is contained in:
Quentin (OpenERP)
2012-05-08 18:32:04 +02:00
parent c60663e742
commit 7e84b4c1ce
5 changed files with 29 additions and 9 deletions
+9
View File
@@ -126,4 +126,13 @@ class stock_partial_picking(osv.osv_memory):
'currency': move.picking_id.purchase_id.pricelist_id.currency_id.id}
return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
# Redefinition of the new field in order to update the model stock.picking.in in the orm
# FIXME: this is a temporary workaround because of a framework bug (ref: lpxxxx). It should be removed as soon as
# the bug is fixed
class stock_picking_in(osv.osv):
_inherit = 'stock.picking.in'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Purchase Order',
ondelete='set null', select=True),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+9
View File
@@ -186,4 +186,13 @@ class stock_picking(osv.osv):
})
return result
# Redefinition of the new field in order to update the model stock.picking.out in the orm
# FIXME: this is a temporary workaround because of a framework bug (ref: lpxxxx). It should be removed as soon as
# the bug is fixed
class stock_picking_out(osv.osv):
_inherit = 'stock.picking.out'
_columns = {
'sale_id': fields.many2one('sale.order', 'Sale Order',
ondelete='set null', select=True),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+4 -4
View File
@@ -874,7 +874,7 @@ class stock_picking(osv.osv):
def _get_partner_to_invoice(self, cr, uid, picking, context=None):
""" Gets the partner that will be invoiced
Note that this function is inherited in the sale module
Note that this function is inherited in the sale and purchase modules
@param picking: object of the picking for which we are selecting the partner to invoice
@return: object of the partner to invoice
"""
@@ -2119,11 +2119,11 @@ class stock_move(osv.osv):
return True
if context is None:
context = {}
pickings = {}
pickings = []
for move in self.browse(cr, uid, ids, context=context):
if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
if move.picking_id:
pickings[move.picking_id.id] = True
pickings += [move.picking_id.id]
if move.move_dest_id and move.move_dest_id.state == 'waiting':
self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'})
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
@@ -2131,7 +2131,7 @@ class stock_move(osv.osv):
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
if not context.get('call_unlink',False):
for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()):
for pick in self.pool.get('stock.picking').browse(cr, uid, pickings, context=context):
if all(move.state == 'cancel' for move in pick.move_lines):
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
-3
View File
@@ -18,10 +18,7 @@
-
!record {model: stock.location, id: location_convenience_shop}:
name: Convenient Store
chained_auto_packing: auto
chained_location_type: fixed
usage: supplier
location_id: stock_location_suppliers
-
!record {model: stock.warehouse, id: warehouse_icecream}:
name: Ice Cream Shop
+7 -2
View File
@@ -73,6 +73,7 @@
assert shipment.state == 'done', "shipment should be close after received."
for move_line in shipment.move_lines:
assert move_line.product_qty == 10, "Qty does not correspond."
assert move_line.product_id.virtual_available == 20, "Virtual stock does not correspond."
assert move_line.state == 'done', "Move line should be closed."
-
@@ -82,11 +83,15 @@
invoice_state: none
-
!python {model: stock.return.picking }: |
# this work without giving the id of the picking to return, magically, thanks to the context
self.create_returns(cr, uid, [ref('return_incomming')], context=context)
-
I cancel incomming shipment after return it.
-
!python {model: stock.picking}: |
# the cancel is not on the return, but on the incomming shipment (which now has a quantity of 10, thanks to the
# backorder). This situation is a little weird as we returned a move that we finally cancelled... As result, only
# 30Kg from the original 50Kg will be counted in the stock (50 - 10 (cancelled quantity) - 10 (returned quantity))
self.action_cancel(cr, uid, [ref("incomming_shipment")], context=context)
-
I make invoice of backorder of incomming shipment.
@@ -107,12 +112,12 @@
shipment = self.browse(cr, uid, ref("incomming_shipment"))
assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not upadted.'
-
I check availabile stock after received incomming shipping.
I check available stock after received incomming shipping.
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_icecream'), context=context)
assert product.qty_available == 140, "Stock does not correspond."
assert product.virtual_available == 10, "Vitual stock does not correspond."
assert product.virtual_available == 0, "Vitual stock does not correspond."
-
I split incomming shipment into lots. each lot contain 10 kgm Ice-cream.
-