"""
result['arch'] = _moves_arch_lst
- result['fields'] = _moves_fields
+ result['fields'] = _moves_fields
return result
def default_get(self, cr, uid, fields, context=None):
- """
+ """
To get default values for the object.
-
+
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param fields: List of fields for which we want default values
- @param context: A standard dictionary
-
- @return: A dictionary which of fields with values.
-
- """
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+
+ @return: A dictionary which of fields with values.
+
+ """
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
- move_obj = self.pool.get('stock.move')
+ move_obj = self.pool.get('stock.move')
if not context:
context={}
moveids = []
if 'date' in fields:
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
- for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
+ for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if m.state in ('done', 'cancel'):
continue
if 'move%s_product_id'%(m.id) in fields:
@@ -178,23 +173,21 @@ class stock_partial_move(osv.osv_memory):
currency = False
if hasattr(m.picking_id, 'purchase_id') and m.picking_id.purchase_id:
currency = m.picking_id.purchase_id.pricelist_id.currency_id.id
-
+
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
res['move%s_product_currency'%(m.id)] = currency
- return res
+ return res
- def do_partial(self, cr, uid, ids, context):
- move_obj = self.pool.get('stock.move')
+ def do_partial(self, cr, uid, ids, context):
+ move_obj = self.pool.get('stock.move')
move_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
partial_datas = {
- 'partner_id' : partial.partner_id and partial.partner_id.id or False,
- 'address_id' : partial.address_id and partial.address_id.id or False,
- 'delivery_date' : partial.date
+ 'delivery_date' : partial.date
}
- for m in move_obj.browse(cr, uid, move_ids):
+ for m in move_obj.browse(cr, uid, move_ids):
if m.state in ('done', 'cancel'):
continue
partial_datas['move%s'%(m.id)] = {
@@ -203,15 +196,14 @@ class stock_partial_move(osv.osv_memory):
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
}
- if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
- partial_datas['move%s'%(m.id)].update({
+ if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
+ partial_datas['move%s'%(m.id)].update({
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
- })
-
+ })
+
res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
return {}
-
-stock_partial_move()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+stock_partial_move()