From 5e45084f1aa044773e615270e2a3d13ebcb4ea0c Mon Sep 17 00:00:00 2001 From: Hitesh Trivedi Date: Wed, 7 Jan 2015 16:23:41 +0530 Subject: [PATCH] [ADD] stock_picking_wave: chatter in picking waves Useful if you want to the pickings to be done to your carrier by sending her the picking list. --- addons/stock_picking_wave/__openerp__.py | 1 + addons/stock_picking_wave/stock_picking_wave.py | 13 +++++++++++-- .../stock_picking_wave/stock_picking_wave_data.xml | 10 ++++++++++ .../stock_picking_wave/stock_picking_wave_view.xml | 10 ++++++---- 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 addons/stock_picking_wave/stock_picking_wave_data.xml diff --git a/addons/stock_picking_wave/__openerp__.py b/addons/stock_picking_wave/__openerp__.py index d6a14d7b23c..ea1c25940a3 100644 --- a/addons/stock_picking_wave/__openerp__.py +++ b/addons/stock_picking_wave/__openerp__.py @@ -32,6 +32,7 @@ This module adds the picking wave option in warehouse management. 'depends': ['stock'], 'data': ['security/ir.model.access.csv', 'stock_picking_wave_view.xml', + 'stock_picking_wave_data.xml', 'stock_picking_wave_sequence.xml', 'wizard/picking_to_wave_view.xml', ], diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py index dcae78761e1..5cda64f2ed7 100644 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ b/addons/stock_picking_wave/stock_picking_wave.py @@ -4,14 +4,15 @@ from openerp.tools.translate import _ from openerp.exceptions import UserError class stock_picking_wave(osv.osv): + _inherit = "mail.thread" _name = "stock.picking.wave" _description = "Picking Wave" _order = "name desc" _columns = { 'name': fields.char('Picking Wave Name', required=True, help='Name of the picking wave', copy=False), - 'user_id': fields.many2one('res.users', 'Responsible', help='Person responsible for this wave'), + 'user_id': fields.many2one('res.users', 'Responsible', track_visibility='onchange', help='Person responsible for this wave'), 'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'), - 'state': fields.selection([('draft', 'Draft'), ('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], string="State", required=True, copy=False), + 'state': fields.selection([('draft', 'Draft'), ('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], string="State", track_visibility='onchange', required=True, copy=False), } _defaults = { @@ -56,11 +57,19 @@ class stock_picking_wave(osv.osv): continue if picking.state != 'assigned': raise UserError(_('Some pickings are still waiting for goods. Please check or force their availability before setting this wave to done.')) + message_body = "%s: %s %s" % (_("Transferred by"), _("Picking Wave"), wave.id, wave.name) + picking.message_post(body=message_body) 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) + def _track_subtype(self, cr, uid, ids, init_values, context=None): + record = self.browse(cr, uid, ids[0], context=context) + if 'state' in init_values and record.state != 'draft': + return 'stock_picking_wave.state' + return super(stock_picking_wave, self)._track_subtype(cr, uid, ids, init_values, context=context) + class stock_picking(osv.osv): _inherit = "stock.picking" diff --git a/addons/stock_picking_wave/stock_picking_wave_data.xml b/addons/stock_picking_wave/stock_picking_wave_data.xml new file mode 100644 index 00000000000..cf465635c3e --- /dev/null +++ b/addons/stock_picking_wave/stock_picking_wave_data.xml @@ -0,0 +1,10 @@ + + + + + Stage Changed + stock.picking.wave + + Stage Changed + + diff --git a/addons/stock_picking_wave/stock_picking_wave_view.xml b/addons/stock_picking_wave/stock_picking_wave_view.xml index 2825914a8cc..b9101aa8a10 100644 --- a/addons/stock_picking_wave/stock_picking_wave_view.xml +++ b/addons/stock_picking_wave/stock_picking_wave_view.xml @@ -1,5 +1,4 @@ - - + picking.wave.form stock.picking.wave @@ -38,6 +37,10 @@ +
+ + +
@@ -123,5 +126,4 @@ -
-
+