From 3824f673d70c35d6709b1d3444ed8a8c1b4a13ca Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 11 Nov 2010 16:16:37 +0530 Subject: [PATCH] [IMP]: task-1773 in periodical inventories apply missing features bzr revid: ksa@tinyerp.co.in-20101111104637-joynixq8piezhqla --- addons/stock/stock.py | 8 ++++++-- addons/stock/stock_view.xml | 28 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index e6737ae31bb..7473de0adc1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2376,7 +2376,7 @@ class stock_inventory(osv.osv): 'date_done': fields.datetime('Date done'), 'inventory_line_id': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', states={'done': [('readonly', True)]}), 'move_ids': fields.many2many('stock.move', 'stock_inventory_move_rel', 'inventory_id', 'move_id', 'Created Moves'), - 'state': fields.selection( (('draft', 'Draft'), ('done', 'Done'), ('cancel','Cancelled')), 'State', readonly=True, select=True), + 'state': fields.selection( (('draft', 'Draft'), ('done', 'Done'), ('confirm','Confirmed'),('cancel','Cancelled')), 'State', readonly=True, select=True), 'company_id': fields.many2one('res.company','Company',required=True,select=True), } _defaults = { @@ -2394,6 +2394,10 @@ class stock_inventory(osv.osv): return self.pool.get('stock.move').create(cr, uid, move_vals) def action_done(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state':'done'} ,context=context) + return True + + def action_confirm(self, cr, uid, ids, context=None): """ Finishes the inventory and writes its finished date @return: True """ @@ -2444,7 +2448,7 @@ class stock_inventory(osv.osv): move_ids.append(self._inventory_line_hook(cr, uid, line, value)) message = _('Inventory') + " '" + inv.name + "' "+ _("is done.") self.log(cr, uid, inv.id, message) - self.write(cr, uid, [inv.id], {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S'), 'move_ids': [(6, 0, move_ids)]}) + self.write(cr, uid, [inv.id], {'state': 'confirm', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S'), 'move_ids': [(6, 0, move_ids)]}) return True def action_cancel(self, cr, uid, ids, context=None): diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 3bdb3a840ac..ec3082a1611 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -118,12 +118,27 @@ - + +