Skip to content

Commit

Permalink
[MIG][10.0] stock_split_picking module
Browse files Browse the repository at this point in the history
  • Loading branch information
cubells committed May 25, 2017
1 parent 9ab1ff6 commit 2f00303
Show file tree
Hide file tree
Showing 13 changed files with 222 additions and 348 deletions.
45 changes: 36 additions & 9 deletions stock_split_picking/README.rst
@@ -1,45 +1,72 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=============
Split picking
-------------
=============

This module adds a "Split" button on the outgoing pickings form.

It works like the classical picking Transfer but it leaves both
pickings (picking and its backorder) as confirmed without
processing the transfer.
It works like the classical picking Transfer but it leaves both pickings
(picking and its backorder) as confirmed without processing the transfer.

Installation
============

This module only needs `stock` module.

Usage
=====

To use this module, you need to:

#. Go to ...

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/154/10.0

Known issues / Roadmap
======================

* When splitting a picking in an unassigned state, wizard won't
be auto completed with picking lines.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/stock-logistics-workflow/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======
Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Nicolas Bessi <nicolas.bessi@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.
24 changes: 4 additions & 20 deletions stock_split_picking/__init__.py
@@ -1,21 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import model
# Copyright 2013-2015 Camptocamp SA - Nicolas Bessi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
60 changes: 24 additions & 36 deletions stock_split_picking/__manifest__.py
@@ -1,37 +1,25 @@
# -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi, Guewen Baconnier, Yannick Vaucher
# Copyright 2013-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
{'name': 'Split picking',
'summary': 'Split a picking in two unconfirmed pickings',
'version': '8.0.1.0.0',
'author': "Camptocamp,Odoo Community Association (OCA)",
'maintainer': 'Camptocamp',
'license': 'AGPL-3',
'category': 'Warehouse Management',
'complexity': "normal", # easy, normal, expert
'depends': ['stock'],
'website': 'http://www.camptocamp.com',
'data': ['view/stock_partial_picking.xml'],
'demo': [],
'test': ['test/test_picking_split.yml',
'test/test_assigned_picking_split.yml'],
'installable': False,
'auto_install': False,
}
# Copyright 2013-2015 Camptocamp SA - Nicolas Bessi
# Copyright 2013-2015 Camptocamp SA - Guewen Baconnier
# Copyright 2013-2015 Camptocamp SA - Yannick Vaucher
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Split picking',
'summary': 'Split a picking in two unconfirmed pickings',
'version': '10.0.1.0.0',
'category': 'Warehouse Management',
'author': "Camptocamp, "
"Tecnativa, "
"Odoo Community Association (OCA)",
'license': 'AGPL-3',
'website': 'http://www.camptocamp.com',
'depends': [
'stock',
],
'data': [
'views/stock_partial_picking.xml',
],
'installable': True,
'auto_install': False,
}
21 changes: 0 additions & 21 deletions stock_split_picking/model/__init__.py

This file was deleted.

86 changes: 0 additions & 86 deletions stock_split_picking/model/stock.py

This file was deleted.

5 changes: 5 additions & 0 deletions stock_split_picking/models/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2015 Camptocamp SA - Nicolas Bessi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import stock
58 changes: 58 additions & 0 deletions stock_split_picking/models/stock.py
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2015 Camptocamp SA - Nicolas Bessi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, models
from odoo.exceptions import UserError


class StockPicking(models.Model):
"""Adds picking split without done state."""

_inherit = "stock.picking"

@api.multi
def split_process(self):
"""Use to trigger the wizard from button with correct context"""
for pick in self:
if pick.state == 'draft':
raise UserError(_('Mark as todo this picking please.'))
if all([x.qty_done == 0.0 for x in pick.pack_operation_ids]):
raise UserError(
_('You must enter done quantity in order to split your '
'picking in several ones.'))
ctx = {
'active_model': self._name,
'active_ids': self.ids,
'active_id': len(self.ids) and self.ids[0] or False,
'do_only_split': True,
'default_picking_id': len(self.ids) and self.ids[0] or False,
}

view = self.env.ref('stock.view_backorder_confirmation')
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.backorder.confirmation',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'context': ctx,
}


class StockMove(models.Model):

_inherit = 'stock.move'

@api.multi
def split(self, qty, restrict_lot_id=False, restrict_partner_id=False):
for pack in self.picking_id.pack_operation_ids:
if pack.qty_done > 0:
new_move_id = super(StockMove, self).split(
qty,
restrict_lot_id=restrict_lot_id,
restrict_partner_id=restrict_partner_id,
)
return new_move_id

0 comments on commit 2f00303

Please sign in to comment.