diff --git a/stock_cycle_count/README.rst b/stock_cycle_count/README.rst index 03287eaaf..743f0114a 100644 --- a/stock_cycle_count/README.rst +++ b/stock_cycle_count/README.rst @@ -32,6 +32,15 @@ To install this module, you need to: * Download this module to your addons path. * Install the module in your database. +Recommendations +--------------- + +It is highly recommended to use this module in conjunction with: + +* `stock_inventory_verification_request`: Adds the capability to request Slot + Verifications. +* `stock_inventory_lockdown`: Lock down locations during inventories. + Configuration ============= diff --git a/stock_cycle_count/models/stock_cycle_count.py b/stock_cycle_count/models/stock_cycle_count.py index a74da9703..ebd8f86d0 100644 --- a/stock_cycle_count/models/stock_cycle_count.py +++ b/stock_cycle_count/models/stock_cycle_count.py @@ -3,7 +3,8 @@ # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models +from openerp import api, fields, models, _ +from openerp.exceptions import UserError class StockCycleCount(models.Model): @@ -71,6 +72,10 @@ class StockCycleCount(models.Model): @api.one def action_create_inventory_adjustment(self): + if self.state != 'draft': + raise UserError(_( + "You can only confirm cycle counts in state 'Planned'." + )) data = self._prepare_inventory_adjustment() self.env['stock.inventory'].create(data) self.state = 'open' diff --git a/stock_cycle_count/views/stock_cycle_count_view.xml b/stock_cycle_count/views/stock_cycle_count_view.xml index 598534cbe..9d544ee1e 100644 --- a/stock_cycle_count/views/stock_cycle_count_view.xml +++ b/stock_cycle_count/views/stock_cycle_count_view.xml @@ -127,4 +127,26 @@ name="Cycle Counts" parent="stock.menu_stock_inventory_control" action="action_stock_cycle_count" /> + + + Confirm Cycle Counts + True + ir.actions.server + + code + self.action_create_inventory_adjustment(cr, uid, context.get('active_ids', []), context=context) + + + + confirm several cycle counts + + + action + + stock.cycle.count + client_action_multi + +