From 030d25f0ded1c92fc5eafd6bd72c8abffe6007bc Mon Sep 17 00:00:00 2001 From: Virbhadrasinh Gohil Date: Wed, 5 Aug 2015 11:36:33 +0530 Subject: [MOV] stock_picking_wave: rearrange files Files are renamed and moved according to the guidelines. No change has been performed in this commit. No bug has been harmed. --- addons/stock_picking_wave/__init__.py | 2 +- addons/stock_picking_wave/__openerp__.py | 10 +- .../data/ir_sequence_data_picking_wave.xml | 13 +++ .../data/stock_picking_wave_data.xml | 10 ++ .../data/stock_picking_wave_demo.xml | 127 ++++++++++++++++++++ addons/stock_picking_wave/models/__init__.py | 3 + .../models/stock_picking_wave.py | 77 ++++++++++++ addons/stock_picking_wave/stock_picking_wave.py | 77 ------------ .../stock_picking_wave/stock_picking_wave_data.xml | 10 -- .../stock_picking_wave/stock_picking_wave_demo.xml | 127 -------------------- .../stock_picking_wave_sequence.xml | 13 --- .../stock_picking_wave/stock_picking_wave_view.xml | 129 --------------------- .../views/stock_picking_wave_views.xml | 129 +++++++++++++++++++++ addons/stock_picking_wave/wizard/__init__.py | 2 +- .../stock_picking_wave/wizard/picking_to_wave.py | 16 --- .../wizard/picking_to_wave_view.xml | 39 ------- .../wizard/stock_picking_to_wave.py | 16 +++ .../wizard/stock_picking_to_wave_views.xml | 39 +++++++ 18 files changed, 421 insertions(+), 418 deletions(-) create mode 100644 addons/stock_picking_wave/data/ir_sequence_data_picking_wave.xml create mode 100644 addons/stock_picking_wave/data/stock_picking_wave_data.xml create mode 100644 addons/stock_picking_wave/data/stock_picking_wave_demo.xml create mode 100644 addons/stock_picking_wave/models/__init__.py create mode 100644 addons/stock_picking_wave/models/stock_picking_wave.py delete mode 100644 addons/stock_picking_wave/stock_picking_wave.py delete mode 100644 addons/stock_picking_wave/stock_picking_wave_data.xml delete mode 100644 addons/stock_picking_wave/stock_picking_wave_demo.xml delete mode 100644 addons/stock_picking_wave/stock_picking_wave_sequence.xml delete mode 100644 addons/stock_picking_wave/stock_picking_wave_view.xml create mode 100644 addons/stock_picking_wave/views/stock_picking_wave_views.xml delete mode 100644 addons/stock_picking_wave/wizard/picking_to_wave.py delete mode 100644 addons/stock_picking_wave/wizard/picking_to_wave_view.xml create mode 100644 addons/stock_picking_wave/wizard/stock_picking_to_wave.py create mode 100644 addons/stock_picking_wave/wizard/stock_picking_to_wave_views.xml (limited to 'addons') diff --git a/addons/stock_picking_wave/__init__.py b/addons/stock_picking_wave/__init__.py index c3ad0a0f12c..11529f98733 100644 --- a/addons/stock_picking_wave/__init__.py +++ b/addons/stock_picking_wave/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import stock_picking_wave +import models import wizard diff --git a/addons/stock_picking_wave/__openerp__.py b/addons/stock_picking_wave/__openerp__.py index 704ecc1ebd7..7eef4a93889 100644 --- a/addons/stock_picking_wave/__openerp__.py +++ b/addons/stock_picking_wave/__openerp__.py @@ -12,13 +12,13 @@ This module adds the picking wave option in warehouse management. 'website': 'https://www.odoo.com/page/warehouse', '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', + 'views/stock_picking_wave_views.xml', + 'data/stock_picking_wave_data.xml', + 'data/ir_sequence_data_picking_wave.xml', + 'wizard/stock_picking_to_wave_views.xml', ], 'demo': [ - 'stock_picking_wave_demo.xml', + 'data/stock_picking_wave_demo.xml', ], 'installable': True, 'auto_install': False, diff --git a/addons/stock_picking_wave/data/ir_sequence_data_picking_wave.xml b/addons/stock_picking_wave/data/ir_sequence_data_picking_wave.xml new file mode 100644 index 00000000000..c38da83cc2f --- /dev/null +++ b/addons/stock_picking_wave/data/ir_sequence_data_picking_wave.xml @@ -0,0 +1,13 @@ + + + + + + Picking Wave + picking.wave + Wave/ + 5 + + + + diff --git a/addons/stock_picking_wave/data/stock_picking_wave_data.xml b/addons/stock_picking_wave/data/stock_picking_wave_data.xml new file mode 100644 index 00000000000..2927713f6b9 --- /dev/null +++ b/addons/stock_picking_wave/data/stock_picking_wave_data.xml @@ -0,0 +1,10 @@ + + + + + Stage Changed + stock.picking.wave + + Stage Changed + + diff --git a/addons/stock_picking_wave/data/stock_picking_wave_demo.xml b/addons/stock_picking_wave/data/stock_picking_wave_demo.xml new file mode 100644 index 00000000000..5e9cf4a785d --- /dev/null +++ b/addons/stock_picking_wave/data/stock_picking_wave_demo.xml @@ -0,0 +1,127 @@ + + + + + + Picking Dry for John + in_progress + + + + Picking Freeze for Mickael + in_progress + + + + + + Picking #1 + one + 2 + + + + + + + Picking #2 + one + assigned + 1 + + + + + + + Picking #3 + one + assigned + 1 + + + + + + + + + + Ice Cream Chocolate + IC-CHOCO + + 450.0 + 300.0 + consu + + + Ice Cream Chocolate with sticks + + + Ice Cream Vanilla + IC-VANI + + 450.0 + 300.0 + consu + + + Ice Cream Vanilla + + + Speculoos + DRY-SPEC + + 150.0 + 100.0 + consu + + + Speculoos - A belgian speciality + + + + + + + A first stock move + + + + + + + + A second stock move + + + + + + + + A third stock move + + + + + + + + + A fourth stock move + + + + + + + + + diff --git a/addons/stock_picking_wave/models/__init__.py b/addons/stock_picking_wave/models/__init__.py new file mode 100644 index 00000000000..2c858e134f3 --- /dev/null +++ b/addons/stock_picking_wave/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import stock_picking_wave \ No newline at end of file diff --git a/addons/stock_picking_wave/models/stock_picking_wave.py b/addons/stock_picking_wave/models/stock_picking_wave.py new file mode 100644 index 00000000000..95c85548f95 --- /dev/null +++ b/addons/stock_picking_wave/models/stock_picking_wave.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +from openerp.osv import fields, osv +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', 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", track_visibility='onchange', required=True, copy=False), + } + + _defaults = { + 'name': '/', + '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) + 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) + self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context) + return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) + + def print_picking(self, cr, uid, ids, context=None): + ''' + This function print the report for all picking_ids associated to the picking wave + ''' + context = dict(context or {}) + picking_ids = [] + for wave in self.browse(cr, uid, ids, context=context): + picking_ids += [picking.id for picking in wave.picking_ids] + if not picking_ids: + raise UserError(_('Nothing to print.')) + context['active_ids'] = picking_ids + context['active_model'] = 'stock.picking' + return self.pool.get("report").get_action(cr, uid, [], 'stock.report_picking', context=context) + + def create(self, cr, uid, vals, context=None): + if vals.get('name', '/') == '/': + vals['name'] = self.pool.get('ir.sequence').next_by_code(cr, uid, 'picking.wave') or '/' + return super(stock_picking_wave, self).create(cr, uid, vals, 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 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): + if 'state' in init_values: + return 'stock_picking_wave.mt_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" + _columns = { + 'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, help='Picking wave associated to this picking'), + } diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py deleted file mode 100644 index 95c85548f95..00000000000 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -from openerp.osv import fields, osv -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', 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", track_visibility='onchange', required=True, copy=False), - } - - _defaults = { - 'name': '/', - '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) - 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) - self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context) - return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) - - def print_picking(self, cr, uid, ids, context=None): - ''' - This function print the report for all picking_ids associated to the picking wave - ''' - context = dict(context or {}) - picking_ids = [] - for wave in self.browse(cr, uid, ids, context=context): - picking_ids += [picking.id for picking in wave.picking_ids] - if not picking_ids: - raise UserError(_('Nothing to print.')) - context['active_ids'] = picking_ids - context['active_model'] = 'stock.picking' - return self.pool.get("report").get_action(cr, uid, [], 'stock.report_picking', context=context) - - def create(self, cr, uid, vals, context=None): - if vals.get('name', '/') == '/': - vals['name'] = self.pool.get('ir.sequence').next_by_code(cr, uid, 'picking.wave') or '/' - return super(stock_picking_wave, self).create(cr, uid, vals, 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 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): - if 'state' in init_values: - return 'stock_picking_wave.mt_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" - _columns = { - 'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, help='Picking wave associated to this picking'), - } diff --git a/addons/stock_picking_wave/stock_picking_wave_data.xml b/addons/stock_picking_wave/stock_picking_wave_data.xml deleted file mode 100644 index 2927713f6b9..00000000000 --- a/addons/stock_picking_wave/stock_picking_wave_data.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Stage Changed - stock.picking.wave - - Stage Changed - - diff --git a/addons/stock_picking_wave/stock_picking_wave_demo.xml b/addons/stock_picking_wave/stock_picking_wave_demo.xml deleted file mode 100644 index 5e9cf4a785d..00000000000 --- a/addons/stock_picking_wave/stock_picking_wave_demo.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - Picking Dry for John - in_progress - - - - Picking Freeze for Mickael - in_progress - - - - - - Picking #1 - one - 2 - - - - - - - Picking #2 - one - assigned - 1 - - - - - - - Picking #3 - one - assigned - 1 - - - - - - - - - - Ice Cream Chocolate - IC-CHOCO - - 450.0 - 300.0 - consu - - - Ice Cream Chocolate with sticks - - - Ice Cream Vanilla - IC-VANI - - 450.0 - 300.0 - consu - - - Ice Cream Vanilla - - - Speculoos - DRY-SPEC - - 150.0 - 100.0 - consu - - - Speculoos - A belgian speciality - - - - - - - A first stock move - - - - - - - - A second stock move - - - - - - - - A third stock move - - - - - - - - - A fourth stock move - - - - - - - - - diff --git a/addons/stock_picking_wave/stock_picking_wave_sequence.xml b/addons/stock_picking_wave/stock_picking_wave_sequence.xml deleted file mode 100644 index c38da83cc2f..00000000000 --- a/addons/stock_picking_wave/stock_picking_wave_sequence.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Picking Wave - picking.wave - Wave/ - 5 - - - - diff --git a/addons/stock_picking_wave/stock_picking_wave_view.xml b/addons/stock_picking_wave/stock_picking_wave_view.xml deleted file mode 100644 index a2eb6e38d01..00000000000 --- a/addons/stock_picking_wave/stock_picking_wave_view.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - picking.wave.form - stock.picking.wave - -
-
-
- -
-
-
-

- -

-
- - - - - - - - - - - - -