diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 9c2a672caf7..d548495d972 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -114,7 +114,7 @@
-
@@ -1234,8 +1234,8 @@ - - + + diff --git a/addons/stock/wizard/stock_fill_inventory.py b/addons/stock/wizard/stock_fill_inventory.py index 11907b674a1..1d3b8dd450d 100644 --- a/addons/stock/wizard/stock_fill_inventory.py +++ b/addons/stock/wizard/stock_fill_inventory.py @@ -60,9 +60,6 @@ class stock_fill_inventory(osv.osv_memory): if context.get('active_id', False): stock = self.pool.get('stock.inventory').browse(cr, uid, context.get('active_id', False)) - - if stock.state == 'done': - raise osv.except_osv(_('Warning!'), _('Stock Inventory is already Validated.')) return True def fill_inventory(self, cr, uid, ids, context=None): @@ -126,22 +123,23 @@ class stock_fill_inventory(osv.osv_memory): res[location] = datas if not flag: - raise osv.except_osv(_('Warning!'), _('No product in this location.')) + raise osv.except_osv(_('Warning!'), _('No product in this location. Please select a location in the product form.')) for stock_move in res.values(): for stock_move_details in stock_move.values(): stock_move_details.update({'inventory_id': context['active_ids'][0]}) domain = [] - - if fill_inventory.set_stock_zero: - stock_move_details.update({'product_qty': 0}) - for field, value in stock_move_details.items(): + if field == 'product_qty' and fill_inventory.set_stock_zero: + domain.append((field, 'in', [value,'0'])) + continue domain.append((field, '=', value)) line_ids = inventory_line_obj.search(cr, uid, domain, context=context) if not line_ids: + if fill_inventory.set_stock_zero: + stock_move_details.update({'product_qty': 0}) inventory_line_obj.create(cr, uid, stock_move_details, context=context) return {'type': 'ir.actions.act_window_close'}