self.pool.get('stock.move').force_assign(cr, uid, move_ids)
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
return True
+
+ def button_cancel(self, cr, uid, ids, *args):
+ """ Changes state of picking to cancel.
+ @return: True
+ """
+ wf_service = netsvc.LocalService("workflow")
+ for pick in self.browse(cr, uid, ids):
+ wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
+ return True
def draft_force_assign(self, cr, uid, ids, *args):
""" Confirms picking directly from draft state.
for move in pick.move_lines:
if move.state not in ('cancel','done'):
return False
- if move.state=='done':
+ if move.state=='done' and not move.scrapped:
ok = True
return ok
if not pick.move_lines:
return True
for move in pick.move_lines:
- if move.state == 'done':
+ if move.state == 'done' and not move.scrapped:
raise osv.except_osv(_('Error!'), _('You cannot cancel picking because stock move is in done state!'))
return True
def unlink(self, cr, uid, ids, context=None):
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '<>', 'service')]),
'date': fields.datetime('Creation Date', required=True),
'stock_available': fields.function(_get_stock, fnct_search=_stock_search, type="float", string="Available", select=True,
- help="Current quantity of products with this Production Lot Number available in company warehouses",
+ help="Current quantity of products with this Serial Number available in company warehouses",
digits_compute=dp.get_precision('Product Unit of Measure')),
'revisions': fields.one2many('stock.production.lot.revision', 'lot_id', 'Revisions'),
'company_id': fields.many2one('res.company', 'Company', select=True),
warning = {}
if (location.usage == 'internal') and (product_qty > (amount_actual or 0.0)):
warning = {
- 'title': _('Insufficient Stock in Lot !'),
- 'message': _('You are moving %.2f %s products but only %.2f %s available in this lot.') % (product_qty, uom.name, amount_actual, uom.name)
+ 'title': _('Insufficient Stock in Serial Number !'),
+ 'message': _('You are moving %.2f %s products but only %.2f %s available in this serial number.') % (product_qty, uom.name, amount_actual, uom.name)
}
return {'warning': warning}