diff --git a/addons/stock/res_config.py b/addons/stock/res_config.py
index 952407f59b3..b03bbedff68 100644
--- a/addons/stock/res_config.py
+++ b/addons/stock/res_config.py
@@ -87,6 +87,7 @@ This installs the module product_expiry."""),
'module_stock_dropshipping': fields.boolean("Manage dropshipping",
help='\nCreates the dropship route and add more complex tests'
'-This installs the module stock_dropshipping.'),
+ 'module_stock_picking_wave': fields.boolean('Manage picking wave', help='Install the picking wave module which will help you grouping your pickings and processing them in batch'),
}
def _default_company(self, cr, uid, context=None):
diff --git a/addons/stock/res_config_view.xml b/addons/stock/res_config_view.xml
index f8d154e3dd9..b83100e115b 100644
--- a/addons/stock/res_config_view.xml
+++ b/addons/stock/res_config_view.xml
@@ -82,6 +82,10 @@
+
+
+
+
diff --git a/addons/stock_picking_wave/security/ir.model.access.csv b/addons/stock_picking_wave/security/ir.model.access.csv
index c33f87685bc..40168055609 100644
--- a/addons/stock_picking_wave/security/ir.model.access.csv
+++ b/addons/stock_picking_wave/security/ir.model.access.csv
@@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_stock_picking_wave,stock.picking.wave stock users,model_stock_picking_wave,stock.group_stock_user,1,1,1,1
-access_stock_picking_wave_type,stock.picking.wave.type stock users,model_stock_picking_wave_type,stock.group_stock_user,1,1,1,1
+access_stock_picking_wave,stock.picking.wave stock users,model_stock_picking_wave,stock.group_stock_user,1,1,1,1
\ No newline at end of file
diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py
index 33148cac6f0..a6bef3ad32c 100644
--- a/addons/stock_picking_wave/stock_picking_wave.py
+++ b/addons/stock_picking_wave/stock_picking_wave.py
@@ -7,23 +7,23 @@ class stock_picking_wave(osv.osv):
_order = "name desc"
_columns = {
'name': fields.char('name', required=True, help='Name of the picking wave'),
- 'partner_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'),
+ 'user_id': fields.many2one('res.users', 'Responsible', help='Person responsible for this wave'),
'time': fields.float('Time', help='Time it will take to perform the wave'),
'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'),
'capacity': fields.float('Capacity', help='The capacity of the transport used to get the goods'),
'capacity_uom': fields.many2one('product.uom', 'Unit of Measure', help='The Unity Of Measure of the transport capacity'),
- 'wave_type_id': fields.many2one('stock.picking.wave.type', 'Picking Wave Type'),
- 'state': fields.selection([('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], required=True),
+ 'state': fields.selection([('draft', 'Draft'), ('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], required=True),
}
_defaults = {
'name': '/',
- 'state': 'in_progress',
+ 'state': 'draft',
}
def confirm_picking(self, cr, uid, ids, context=None):
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
- return self.pool.get('stock.picking').action_done(cr, uid, picking_todo, context=context)
+ self.write(cr, uid, ids, {'state': 'in_progress'}, context=context)
+ return self.pool.get('stock.picking').action_assign(cr, uid, picking_todo, context=context)
def cancel_picking(self, cr, uid, ids, context=None):
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
@@ -66,6 +66,16 @@ class stock_picking_wave(osv.osv):
return super(stock_picking_wave, self).copy(cr, uid, id, default=default, context=context)
def done(self, cr, uid, ids, context=None):
+ picking_todo = set()
+ for wave in self.browse(cr, uid, ids, context=context):
+ for picking in wave.picking_ids:
+ if picking.state in ('cancel', 'done'):
+ continue
+ if picking.state != 'assigned':
+ raise osv.except_osv(_('Warning'), _('Some pickings are still waiting for goods. Please check or force their availability before setting this wave to done.'))
+ picking_todo.add(picking.id)
+ if picking_todo:
+ self.pool.get('stock.picking').action_done(cr, uid, list(picking_todo), context=context)
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
@@ -73,17 +83,4 @@ class stock_picking(osv.osv):
_inherit = "stock.picking"
_columns = {
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', help='Picking wave associated to this picking'),
- 'wave_type_ids': fields.related('partner_id', 'wave_type_ids', type="many2many", relation='stock.picking.wave.type', string='Picking Wave Type'),
- }
-
-class res_partner(osv.osv):
- _inherit = 'res.partner'
- _columns = {
- 'wave_type_ids': fields.many2many('stock.picking.wave.type', 'stock_picking_wave_type_rel', 'wave_type_id', 'partner_id', 'Picking Wave Type'),
- }
-
-class stock_picking_wave_type(osv.osv):
- _name = 'stock.picking.wave.type'
- _columns = {
- 'name': fields.char('Type', required=True),
}
diff --git a/addons/stock_picking_wave/stock_picking_wave_demo.xml b/addons/stock_picking_wave/stock_picking_wave_demo.xml
index ffcdeb4462c..0ef026422ec 100644
--- a/addons/stock_picking_wave/stock_picking_wave_demo.xml
+++ b/addons/stock_picking_wave/stock_picking_wave_demo.xml
@@ -1,18 +1,6 @@
-
-
-
- Type Freeze
-
-
-
- Type Dry
-
-
@@ -20,17 +8,14 @@
Picking Dry for John15
- in_progress
-
-
+ in_progressPicking Freeze for Mickael600
- in_progress
-
+ in_progress