toreserve.append(quant.id)
return self.write(cr, uid, toreserve, {'reservation_id': move.id}, context=context)
- # add location_dest_id in parameters (False=use the desitnation of the move)
+ # add location_dest_id in parameters (False=use the destination of the move)
def quants_move(self, cr, uid, quants, move, context=None):
for quant, qty in quants:
self.move_single_quant(cr, uid, quant, qty, move, context=context)
+ def check_preferred_location(self, cr, uid, move, context=None):
+ return move.location_dest_id
+
def move_single_quant(self, cr, uid, quant, qty, move, context=None):
if not quant:
quant = self._quant_create(cr, uid, qty, move, context=context)
self._quant_split(cr, uid, quant, qty, context=context)
# FP Note: improve this using preferred locations
location_to = move.location_dest_id
-
+ location_to = self.check_preferred_location(cr, uid, move, context=context)
self.write(cr, uid, [quant.id], {
'location_id': location_to.id,
'reservation_id': move.move_dest_id and move.move_dest_id.id or False,
elif removal_strategy=='lifo':
result += self._quants_get_lifo(cr, uid, location, product, qty, domain, prefered_order=prefered_order, context=context)
else:
+ print removal_strategy
raise osv.except_osv(_('Error!'), _('Removal strategy %s not implemented.' % (removal_strategy,)))
-
return result
_table = "stock_picking"
_description = "Incoming Shipments"
- def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- return self.pool.get('stock.picking').search(cr, user, args, offset, limit, order, context, count)
-
- def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
- return self.pool.get('stock.picking').read(cr, uid, ids, fields=fields, context=context, load=load)
+# def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
+# return self.pool.get('stock.picking').search(cr, user, args, offset, limit, order, context, count)
+#
+# def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
+# return self.pool.get('stock.picking').read(cr, uid, ids, fields=fields, context=context, load=load)
def check_access_rights(self, cr, uid, operation, raise_exception=True):
#override in order to redirect the check of acces rights on the stock.picking object
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
- def create_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').create_workflow(cr, uid, ids, context=context)
-
- def delete_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').delete_workflow(cr, uid, ids, context=context)
-
- def step_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').step_workflow(cr, uid, ids, context=context)
-
- def signal_workflow(self, cr, uid, ids, signal, context=None):
- # overridden in order to fire the workflow signal on given stock.picking workflow instance
- # instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
-
_columns = {
'backorder_id': fields.many2one('stock.picking.in', 'Back Order of', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
'state': fields.selection(
_table = "stock_picking"
_description = "Delivery Orders"
- def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- return self.pool.get('stock.picking').search(cr, user, args, offset, limit, order, context, count)
-
- def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
- return self.pool.get('stock.picking').read(cr, uid, ids, fields=fields, context=context, load=load)
+# def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
+# return self.pool.get('stock.picking').search(cr, user, args, offset, limit, order, context, count)
+#
+# def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
+# return self.pool.get('stock.picking').read(cr, uid, ids, fields=fields, context=context, load=load)
def check_access_rights(self, cr, uid, operation, raise_exception=True):
#override in order to redirect the check of acces rights on the stock.picking object
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
- def create_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').create_workflow(cr, uid, ids, context=context)
-
- def delete_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').delete_workflow(cr, uid, ids, context=context)
-
- def step_workflow(self, cr, uid, ids, context=None):
- # overridden in order to trigger the workflow of stock.picking at the end of create,
- # write and unlink operation instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').step_workflow(cr, uid, ids, context=context)
-
- def signal_workflow(self, cr, uid, ids, signal, context=None):
- # overridden in order to fire the workflow signal on given stock.picking workflow instance
- # instead of its own workflow (which is not existing)
- return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
-
_columns = {
'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
'state': fields.selection(
_columns = {
'product_categ_id':fields.many2one('product.category', 'Product Category', required=True),
'location_id': fields.many2one('stock.location','Parent Location', help="Parent Destination Location from which a child bin location needs to be chosen", required=True), #domain=[('type', '=', 'parent')],
- 'method': fields.selection([('empty', 'Empty'), ('fixed', 'Fixed Location')], "Method", required = True),
+ 'method': fields.selection([('fixed', 'Fixed Location')], "Method", required = True),
+ 'location_spec_id': fields.many2one('stock.location','Specific Location', help="When the location is specific, it will be put over there"), #domain=[('type', '=', 'parent')],
}
# TODO: move this on stock module
_description = 'Removal Strategy'
_order = 'sequence'
_columns = {
- 'product_categ_id': fields.many2one('product.removal', 'Category', required=True),
+ 'product_categ_id': fields.many2one('product.category', 'Category', required=True),
'sequence': fields.integer('Sequence'),
+ 'method': fields.selection([('fifo', 'FIFO'), ('lifo', 'LIFO')], "Method", required = True),
'location_id': fields.many2one('stock.location', 'Locations', required=True),
}
'quantity': fields.float('Quantity', required=True),
}
+
+class stock_quant(osv.osv):
+ _inherit = "stock.quant"
+ def check_preferred_location(self, cr, uid, move, context=None):
+ # moveputaway_obj = self.pool.get('stock.move.putaway')
+ if move.putaway_ids and move.putaway_ids[0]:
+ #Take only first suggestion for the moment
+ return move.putaway_ids[0].location_id
+ else:
+ return super(stock_quant, self).check_preferred_location(cr, uid, move, context=context)
+
+
class stock_move(osv.osv):
_inherit = 'stock.move'
_columns = {
# Create the stock.move.putaway records
def _putaway_apply(self,cr, uid, ids, context=None):
+ moveputaway_obj = self.pool.get('stock.move.putaway')
for move in self.browse(cr, uid, ids, context=context):
- res = self.pool.get('stock.location').get_putaway_strategy(cr, uid, move.location_dest_id, move.product_id, context=context)
- if res:
- raise 'put away strategies not implemented yet!'
+ putaway = self.pool.get('stock.location').get_putaway_strategy(cr, uid, move.location_dest_id, move.product_id, context=context)
+ if putaway:
+ # Should call different methods here in later versions
+ # TODO: take care of lots
+ if putaway.method == 'fixed' and putaway.location_id:
+ moveputaway_obj.create(cr, uid, {'move_id': move.id,
+ 'location_id': putaway.location_id.id,
+ 'quantity': move.product_uom_qty}, context=context)
return True
def action_assign(self, cr, uid, ids, context=None):