From d4e60a7e8cc3d92c08a5f32c1401007a1f18c224 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 21 Nov 2014 10:22:25 +0100 Subject: [PATCH 1/5] Add modules stock_packaging_usability and stock_packaging_usability_ul --- stock_packaging_usability/__init__.py | 23 +++++ stock_packaging_usability/__openerp__.py | 50 ++++++++++ stock_packaging_usability/i18n/fr.po | 64 +++++++++++++ .../i18n/stock_packaging_usability.pot | 64 +++++++++++++ stock_packaging_usability/wizard/__init__.py | 23 +++++ .../wizard/stock_transfer_details.py | 62 +++++++++++++ .../wizard/stock_transfer_details.xml | 41 ++++++++ stock_packaging_usability_ul/__init__.py | 23 +++++ stock_packaging_usability_ul/__openerp__.py | 46 +++++++++ stock_packaging_usability_ul/i18n/fr.po | 93 +++++++++++++++++++ .../i18n/stock_packaging_usability_ul.pot | 93 +++++++++++++++++++ .../wizard/__init__.py | 23 +++++ .../wizard/stock_select_ul.py | 55 +++++++++++ .../wizard/stock_select_ul.xml | 38 ++++++++ .../wizard/stock_transfer_details.xml | 33 +++++++ 15 files changed, 731 insertions(+) create mode 100644 stock_packaging_usability/__init__.py create mode 100644 stock_packaging_usability/__openerp__.py create mode 100644 stock_packaging_usability/i18n/fr.po create mode 100644 stock_packaging_usability/i18n/stock_packaging_usability.pot create mode 100644 stock_packaging_usability/wizard/__init__.py create mode 100644 stock_packaging_usability/wizard/stock_transfer_details.py create mode 100644 stock_packaging_usability/wizard/stock_transfer_details.xml create mode 100644 stock_packaging_usability_ul/__init__.py create mode 100644 stock_packaging_usability_ul/__openerp__.py create mode 100644 stock_packaging_usability_ul/i18n/fr.po create mode 100644 stock_packaging_usability_ul/i18n/stock_packaging_usability_ul.pot create mode 100644 stock_packaging_usability_ul/wizard/__init__.py create mode 100644 stock_packaging_usability_ul/wizard/stock_select_ul.py create mode 100644 stock_packaging_usability_ul/wizard/stock_select_ul.xml create mode 100644 stock_packaging_usability_ul/wizard/stock_transfer_details.xml diff --git a/stock_packaging_usability/__init__.py b/stock_packaging_usability/__init__.py new file mode 100644 index 00000000000..ac300d8daa6 --- /dev/null +++ b/stock_packaging_usability/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import wizard diff --git a/stock_packaging_usability/__openerp__.py b/stock_packaging_usability/__openerp__.py new file mode 100644 index 00000000000..89ccc8e68e1 --- /dev/null +++ b/stock_packaging_usability/__openerp__.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com). +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +{ + 'name': 'Stock Packaging Usability', + 'version': '1.0', + 'category': 'Warehouse Management', + 'license': 'AGPL-3', + 'summary': "Faster packaging process in Odoo", + 'description': """ +This module adds 2 buttons in the *Transfer* wizard of the picking: + +* *Put in current pack* (this button is native in v7 but not in v8) + +* *Put residual in new pack* : all the lines that are not in a package + will be put in a new package. + +So this module is a time saver when you use the packaging features of Odoo ! +For example, on a picking where all the products go in the same package, you +just have to click on the button *Put residual in new pack* and you're done: +no need to click on each line ! + +This module has been written by Alexis de Lattre from Akretion + + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['stock'], + 'data': ['wizard/stock_transfer_details.xml'], + 'installable': True, +} diff --git a/stock_packaging_usability/i18n/fr.po b/stock_packaging_usability/i18n/fr.po new file mode 100644 index 00000000000..c352ae1b1d8 --- /dev/null +++ b/stock_packaging_usability/i18n/fr.po @@ -0,0 +1,64 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_packaging_usability +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-21 08:57+0000\n" +"PO-Revision-Date: 2014-11-21 08:57+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_packaging_usability +#: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details +msgid "Picking wizard" +msgstr "Picking wizard" + +#. module: stock_packaging_usability +#: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details_items +msgid "Picking wizard items" +msgstr "Picking wizard items" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Products To Move" +msgstr "Produits à déplacer" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put Residual in New Pack" +msgstr "Mettre le reste dans un nouveau paquet" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put in current pack" +msgstr "Mettre dans le paquet actuel" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put in new pack" +msgstr "Mettre dans un nouveau paquet" + +#. module: stock_packaging_usability +#: code:addons/stock_packaging_usability/wizard/stock_transfer_details.py:58 +#, python-format +msgid "There is no current package" +msgstr "Il n'y a pas de paquet actuel" + +#. module: stock_packaging_usability +#: code:addons/stock_packaging_usability/wizard/stock_transfer_details.py:52 +#, python-format +msgid "This product is already in a package !" +msgstr "Ce produit est déjà dans un paquet !" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "terp-accessories-archiver+" +msgstr "terp-accessories-archiver+" + diff --git a/stock_packaging_usability/i18n/stock_packaging_usability.pot b/stock_packaging_usability/i18n/stock_packaging_usability.pot new file mode 100644 index 00000000000..b38719f355c --- /dev/null +++ b/stock_packaging_usability/i18n/stock_packaging_usability.pot @@ -0,0 +1,64 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_packaging_usability +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-21 08:57+0000\n" +"PO-Revision-Date: 2014-11-21 08:57+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_packaging_usability +#: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details +msgid "Picking wizard" +msgstr "" + +#. module: stock_packaging_usability +#: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details_items +msgid "Picking wizard items" +msgstr "" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Products To Move" +msgstr "" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put Residual in New Pack" +msgstr "" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put in current pack" +msgstr "" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "Put in new pack" +msgstr "" + +#. module: stock_packaging_usability +#: code:addons/stock_packaging_usability/wizard/stock_transfer_details.py:58 +#, python-format +msgid "There is no current package" +msgstr "" + +#. module: stock_packaging_usability +#: code:addons/stock_packaging_usability/wizard/stock_transfer_details.py:52 +#, python-format +msgid "This product is already in a package !" +msgstr "" + +#. module: stock_packaging_usability +#: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details +msgid "terp-accessories-archiver+" +msgstr "" + diff --git a/stock_packaging_usability/wizard/__init__.py b/stock_packaging_usability/wizard/__init__.py new file mode 100644 index 00000000000..63c910e4058 --- /dev/null +++ b/stock_packaging_usability/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import stock_transfer_details diff --git a/stock_packaging_usability/wizard/stock_transfer_details.py b/stock_packaging_usability/wizard/stock_transfer_details.py new file mode 100644 index 00000000000..b6eb2ba0b15 --- /dev/null +++ b/stock_packaging_usability/wizard/stock_transfer_details.py @@ -0,0 +1,62 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from openerp import models, api, _ +from openerp.exceptions import Warning + + +class StockTransferDetails(models.TransientModel): + _inherit = 'stock.transfer_details' + + @api.multi + def put_residual_in_new_pack(self): + for wiz in self: + items_to_update = wiz.item_ids + for item in wiz.item_ids: + if item.result_package_id: + items_to_update -= item + if not item.quantity: + items_to_update -= item + items_to_update.put_in_pack() + if self and self[0]: + return self[0].wizard_view() + + +class StockTransferDetailsItems(models.TransientModel): + _inherit = 'stock.transfer_details_items' + + @api.multi + def put_in_last_pack(self): + for packop in self: + if packop.result_package_id: + raise Warning( + _('This product is already in a package !')) + all_cur_packs_ids = [ + packop2.result_package_id.id for packop2 + in self.transfer_id.item_ids if packop2.result_package_id] + if not all_cur_packs_ids: + raise Warning( + _('There is no current package')) + all_cur_packs_ids.sort() + packop.result_package_id = all_cur_packs_ids[-1] + if self and self[0]: + return self[0].transfer_id.wizard_view() diff --git a/stock_packaging_usability/wizard/stock_transfer_details.xml b/stock_packaging_usability/wizard/stock_transfer_details.xml new file mode 100644 index 00000000000..0415dcfbb55 --- /dev/null +++ b/stock_packaging_usability/wizard/stock_transfer_details.xml @@ -0,0 +1,41 @@ + + + + + + + + + + stock_packaging_usability.stock.transfer_details + stock.transfer_details + + + + + + + + + + + + diff --git a/stock_packaging_usability_ul/__init__.py b/stock_packaging_usability_ul/__init__.py new file mode 100644 index 00000000000..396efbad196 --- /dev/null +++ b/stock_packaging_usability_ul/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability UL module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import wizard diff --git a/stock_packaging_usability_ul/__openerp__.py b/stock_packaging_usability_ul/__openerp__.py new file mode 100644 index 00000000000..71558176ba6 --- /dev/null +++ b/stock_packaging_usability_ul/__openerp__.py @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability UL module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com). +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +{ + 'name': 'Stock Packaging Usability UL', + 'version': '1.0', + 'category': 'Warehouse Management', + 'license': 'AGPL-3', + 'summary': "Faster packaging process with logistical units", + 'description': """ +This module modifies the behavior of the 2 buttons *Put in new pack* +(native button) and *Put residual in one pack* (provided by the module +*stock_packing_usability*) : it will ask the user to select the +logistical unit (object *product.ul*) of the package. + +This module has been written by Alexis de Lattre from Akretion + + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['stock_packaging_usability'], + 'data': [ + 'wizard/stock_select_ul.xml', + 'wizard/stock_transfer_details.xml', + ], + 'installable': True, +} diff --git a/stock_packaging_usability_ul/i18n/fr.po b/stock_packaging_usability_ul/i18n/fr.po new file mode 100644 index 00000000000..eb5212f72f6 --- /dev/null +++ b/stock_packaging_usability_ul/i18n/fr.po @@ -0,0 +1,93 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_packaging_usability_ul +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-21 09:06+0000\n" +"PO-Revision-Date: 2014-11-21 09:06+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_packaging_usability_ul +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Cancel" +msgstr "Annuler" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,create_uid:0 +msgid "Created by" +msgstr "Created by" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,create_date:0 +msgid "Created on" +msgstr "Created on" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,id:0 +msgid "ID" +msgstr "ID" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,write_uid:0 +msgid "Last Updated by" +msgstr "Last Updated by" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,write_date:0 +msgid "Last Updated on" +msgstr "Last Updated on" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,ul_id:0 +msgid "Logistic Unit" +msgstr "Unité logistique" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details +msgid "Picking wizard" +msgstr "Picking wizard" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details_items +msgid "Picking wizard items" +msgstr "Picking wizard items" + +#. module: stock_packaging_usability_ul +#: model:ir.actions.act_window,name:stock_packaging_usability_ul.stock_select_ul_action +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Select Logistical Unit" +msgstr "Sélectionnez l'unité logistique" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_select_ul +msgid "Select UL" +msgstr "Sélectionnez l'unité logistique" + +#. module: stock_packaging_usability_ul +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Validate" +msgstr "Valider" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "action" +msgstr "action" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "{'pack_function': 'put_in_pack'}" +msgstr "{'pack_function': 'put_in_pack'}" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "{'pack_function': 'put_residual_in_new_pack'}" +msgstr "{'pack_function': 'put_residual_in_new_pack'}" + diff --git a/stock_packaging_usability_ul/i18n/stock_packaging_usability_ul.pot b/stock_packaging_usability_ul/i18n/stock_packaging_usability_ul.pot new file mode 100644 index 00000000000..c98d3d4c65b --- /dev/null +++ b/stock_packaging_usability_ul/i18n/stock_packaging_usability_ul.pot @@ -0,0 +1,93 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_packaging_usability_ul +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-21 09:05+0000\n" +"PO-Revision-Date: 2014-11-21 09:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_packaging_usability_ul +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Cancel" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,create_uid:0 +msgid "Created by" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,create_date:0 +msgid "Created on" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,id:0 +msgid "ID" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,write_uid:0 +msgid "Last Updated by" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,write_date:0 +msgid "Last Updated on" +msgstr "" + +#. module: stock_packaging_usability_ul +#: field:stock.select.ul,ul_id:0 +msgid "Logistic Unit" +msgstr "" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details +msgid "Picking wizard" +msgstr "" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details_items +msgid "Picking wizard items" +msgstr "" + +#. module: stock_packaging_usability_ul +#: model:ir.actions.act_window,name:stock_packaging_usability_ul.stock_select_ul_action +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Select Logistical Unit" +msgstr "" + +#. module: stock_packaging_usability_ul +#: model:ir.model,name:stock_packaging_usability_ul.model_stock_select_ul +msgid "Select UL" +msgstr "" + +#. module: stock_packaging_usability_ul +#: view:stock.select.ul:stock_packaging_usability_ul.stock_select_ul_form +msgid "Validate" +msgstr "" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "action" +msgstr "" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "{'pack_function': 'put_in_pack'}" +msgstr "" + +#. module: stock_packaging_usability_ul +#: view:stock.transfer_details:stock_packaging_usability_ul.view_stock_enter_transfer_details +msgid "{'pack_function': 'put_residual_in_new_pack'}" +msgstr "" + diff --git a/stock_packaging_usability_ul/wizard/__init__.py b/stock_packaging_usability_ul/wizard/__init__.py new file mode 100644 index 00000000000..22eeac633d0 --- /dev/null +++ b/stock_packaging_usability_ul/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability UL module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import stock_select_ul diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.py b/stock_packaging_usability_ul/wizard/stock_select_ul.py new file mode 100644 index 00000000000..750964e12bc --- /dev/null +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.py @@ -0,0 +1,55 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Stock Packaging Usability UL module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from openerp import models, fields, api + + +class StockSelectUL(models.TransientModel): + _name = 'stock.select.ul' + _description = 'Select UL' + + ul_id = fields.Many2one('product.ul', string='Logistic Unit') + # required=False, because we accept that it can be left empty + + @api.multi + def validate(self): + assert len(self) == 1, 'Only 1 record' + ul = self[0].ul_id + assert self.env.context.get('pack_function') is not None, \ + 'missing context key pack_function' + self = self.with_context(default_ul_id=(ul and ul.id or False)) + action = False + if self.env.context.get('pack_function') == 'put_residual_in_new_pack': + assert self.env.context.get('active_model') == \ + 'stock.transfer_details', 'Wrong underlying model' + trf_wiz = self.env['stock.transfer_details'].browse( + self.env.context['active_id']) + trf_wiz.put_residual_in_new_pack() + action = trf_wiz.wizard_view() + elif self.env.context.get('pack_function') == 'put_in_pack': + assert self.env.context.get('active_model') == \ + 'stock.transfer_details_items', 'Wrong underlying model' + trf_line_wiz = self.env['stock.transfer_details_items'].browse( + self.env.context['active_id']) + trf_line_wiz.put_in_pack() + action = trf_line_wiz.transfer_id.wizard_view() + return action diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.xml b/stock_packaging_usability_ul/wizard/stock_select_ul.xml new file mode 100644 index 00000000000..c5201d55140 --- /dev/null +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.xml @@ -0,0 +1,38 @@ + + + + + + + + + + stock_packaging_usability_ul.stock_select_ul + stock.select.ul + +
+ + + +
+
+
+
+
+ + + Select Logistical Unit + stock.select.ul + form + new + + +
+
diff --git a/stock_packaging_usability_ul/wizard/stock_transfer_details.xml b/stock_packaging_usability_ul/wizard/stock_transfer_details.xml new file mode 100644 index 00000000000..e507582aa48 --- /dev/null +++ b/stock_packaging_usability_ul/wizard/stock_transfer_details.xml @@ -0,0 +1,33 @@ + + + + + + + + + + stock_packaging_usability_ul.stock.transfer_details + stock.transfer_details + + + + + + + + + + From 3d10a42ac85f9c7d8ab7e143aae1faee6677285c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 7 Jan 2015 14:33:42 +0100 Subject: [PATCH 2/5] Better use of the new API --- stock_packaging_usability_ul/wizard/stock_select_ul.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.py b/stock_packaging_usability_ul/wizard/stock_select_ul.py index 750964e12bc..46c4b10ce35 100644 --- a/stock_packaging_usability_ul/wizard/stock_select_ul.py +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.py @@ -26,13 +26,14 @@ class StockSelectUL(models.TransientModel): _name = 'stock.select.ul' _description = 'Select UL' + _rec_name = 'ul_id' ul_id = fields.Many2one('product.ul', string='Logistic Unit') # required=False, because we accept that it can be left empty @api.multi def validate(self): - assert len(self) == 1, 'Only 1 record' + self.ensure_one() ul = self[0].ul_id assert self.env.context.get('pack_function') is not None, \ 'missing context key pack_function' From fada9c35d33c8dc8dc33ce5c6e3160d046998586 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 8 Jan 2015 09:19:14 +0100 Subject: [PATCH 3/5] Go back to the Transfer wizard when the user click on Cancel --- .../wizard/stock_select_ul.py | 18 ++++++++++++++++++ .../wizard/stock_select_ul.xml | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.py b/stock_packaging_usability_ul/wizard/stock_select_ul.py index 46c4b10ce35..71061302b20 100644 --- a/stock_packaging_usability_ul/wizard/stock_select_ul.py +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.py @@ -54,3 +54,21 @@ def validate(self): trf_line_wiz.put_in_pack() action = trf_line_wiz.transfer_id.wizard_view() return action + + @api.multi + def cancel(self): + """We have to re-call the wizard when the user clicks on Cancel""" + self.ensure_one() + if self.env.context.get('pack_function') == 'put_residual_in_new_pack': + assert self.env.context.get('active_model') == \ + 'stock.transfer_details', 'Wrong underlying model' + trf_wiz = self.env['stock.transfer_details'].browse( + self.env.context['active_id']) + action = trf_wiz.wizard_view() + elif self.env.context.get('pack_function') == 'put_in_pack': + assert self.env.context.get('active_model') == \ + 'stock.transfer_details_items', 'Wrong underlying model' + trf_line_wiz = self.env['stock.transfer_details_items'].browse( + self.env.context['active_id']) + action = trf_line_wiz.transfer_id.wizard_view() + return action diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.xml b/stock_packaging_usability_ul/wizard/stock_select_ul.xml index c5201d55140..27d932b9963 100644 --- a/stock_packaging_usability_ul/wizard/stock_select_ul.xml +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.xml @@ -21,7 +21,8 @@
From 7780bc6848f06fe747e99e5e9d6ccc4c768c7d13 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 22 Jan 2015 12:48:08 +0100 Subject: [PATCH 4/5] Move module description in README.rst --- stock_packaging_usability/README.rst | 38 +++++++++++++++++++++ stock_packaging_usability/__openerp__.py | 16 --------- stock_packaging_usability_ul/README.rst | 32 +++++++++++++++++ stock_packaging_usability_ul/__openerp__.py | 9 ----- 4 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 stock_packaging_usability/README.rst create mode 100644 stock_packaging_usability_ul/README.rst diff --git a/stock_packaging_usability/README.rst b/stock_packaging_usability/README.rst new file mode 100644 index 00000000000..e616cf1c76a --- /dev/null +++ b/stock_packaging_usability/README.rst @@ -0,0 +1,38 @@ +Stock Packaging Usability +========================= + +Usage +===== + +This module adds 2 buttons in the *Transfer* wizard of the picking: + +* *Put in current pack* (this button is native in v7 but not in v8) + +* *Put residual in new pack* : all the lines that are not in a package + will be put in a new package. + +So this module is a time saver when you use the packaging features of Odoo ! +For example, on a picking where all the products go in the same package, you +just have to click on the button *Put residual in new pack* and you're done: +no need to click on each line ! + +Credits +======= + +Contributors +------------ + +* Alexis de Lattre + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/stock_packaging_usability/__openerp__.py b/stock_packaging_usability/__openerp__.py index 89ccc8e68e1..2cee01021ae 100644 --- a/stock_packaging_usability/__openerp__.py +++ b/stock_packaging_usability/__openerp__.py @@ -26,22 +26,6 @@ 'category': 'Warehouse Management', 'license': 'AGPL-3', 'summary': "Faster packaging process in Odoo", - 'description': """ -This module adds 2 buttons in the *Transfer* wizard of the picking: - -* *Put in current pack* (this button is native in v7 but not in v8) - -* *Put residual in new pack* : all the lines that are not in a package - will be put in a new package. - -So this module is a time saver when you use the packaging features of Odoo ! -For example, on a picking where all the products go in the same package, you -just have to click on the button *Put residual in new pack* and you're done: -no need to click on each line ! - -This module has been written by Alexis de Lattre from Akretion - - """, 'author': 'Akretion', 'website': 'http://www.akretion.com', 'depends': ['stock'], diff --git a/stock_packaging_usability_ul/README.rst b/stock_packaging_usability_ul/README.rst new file mode 100644 index 00000000000..f774af9b8d0 --- /dev/null +++ b/stock_packaging_usability_ul/README.rst @@ -0,0 +1,32 @@ +Stock Packaging Usability UL +============================ + +Usage +===== + +This module modifies the behavior of the buttons *Put in new pack* +(native button) and *Put residual in one pack* (provided by the module +*stock_packing_usability*) of the *Transfer* wizard : when you clicks +on those buttons, it will ask you to select the logistical unit (object +*product.ul*) of the package. + +Credits +======= + +Contributors +------------ + +* Alexis de Lattre + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/stock_packaging_usability_ul/__openerp__.py b/stock_packaging_usability_ul/__openerp__.py index 71558176ba6..1d58dffc638 100644 --- a/stock_packaging_usability_ul/__openerp__.py +++ b/stock_packaging_usability_ul/__openerp__.py @@ -26,15 +26,6 @@ 'category': 'Warehouse Management', 'license': 'AGPL-3', 'summary': "Faster packaging process with logistical units", - 'description': """ -This module modifies the behavior of the 2 buttons *Put in new pack* -(native button) and *Put residual in one pack* (provided by the module -*stock_packing_usability*) : it will ask the user to select the -logistical unit (object *product.ul*) of the package. - -This module has been written by Alexis de Lattre from Akretion - - """, 'author': 'Akretion', 'website': 'http://www.akretion.com', 'depends': ['stock_packaging_usability'], From d8f895d08d0532a152481e6009e1fad12015dfc5 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 17 Feb 2015 10:56:23 +0100 Subject: [PATCH 5/5] Take into account the remarks of Yannick: self[0] -> self, updates in fr.po --- stock_packaging_usability/i18n/fr.po | 4 ++-- stock_packaging_usability_ul/i18n/fr.po | 12 ++++++------ .../wizard/stock_select_ul.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stock_packaging_usability/i18n/fr.po b/stock_packaging_usability/i18n/fr.po index c352ae1b1d8..9ef2167ac35 100644 --- a/stock_packaging_usability/i18n/fr.po +++ b/stock_packaging_usability/i18n/fr.po @@ -18,12 +18,12 @@ msgstr "" #. module: stock_packaging_usability #: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details msgid "Picking wizard" -msgstr "Picking wizard" +msgstr "" #. module: stock_packaging_usability #: model:ir.model,name:stock_packaging_usability.model_stock_transfer_details_items msgid "Picking wizard items" -msgstr "Picking wizard items" +msgstr "" #. module: stock_packaging_usability #: view:stock.transfer_details:stock_packaging_usability.view_stock_enter_transfer_details diff --git a/stock_packaging_usability_ul/i18n/fr.po b/stock_packaging_usability_ul/i18n/fr.po index eb5212f72f6..6bb3a84e0d5 100644 --- a/stock_packaging_usability_ul/i18n/fr.po +++ b/stock_packaging_usability_ul/i18n/fr.po @@ -23,12 +23,12 @@ msgstr "Annuler" #. module: stock_packaging_usability_ul #: field:stock.select.ul,create_uid:0 msgid "Created by" -msgstr "Created by" +msgstr "Créé par" #. module: stock_packaging_usability_ul #: field:stock.select.ul,create_date:0 msgid "Created on" -msgstr "Created on" +msgstr "Créé le" #. module: stock_packaging_usability_ul #: field:stock.select.ul,id:0 @@ -38,12 +38,12 @@ msgstr "ID" #. module: stock_packaging_usability_ul #: field:stock.select.ul,write_uid:0 msgid "Last Updated by" -msgstr "Last Updated by" +msgstr "Dernière mise-à-jour par" #. module: stock_packaging_usability_ul #: field:stock.select.ul,write_date:0 msgid "Last Updated on" -msgstr "Last Updated on" +msgstr "Dernière mise-à-jour le" #. module: stock_packaging_usability_ul #: field:stock.select.ul,ul_id:0 @@ -53,12 +53,12 @@ msgstr "Unité logistique" #. module: stock_packaging_usability_ul #: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details msgid "Picking wizard" -msgstr "Picking wizard" +msgstr "" #. module: stock_packaging_usability_ul #: model:ir.model,name:stock_packaging_usability_ul.model_stock_transfer_details_items msgid "Picking wizard items" -msgstr "Picking wizard items" +msgstr "" #. module: stock_packaging_usability_ul #: model:ir.actions.act_window,name:stock_packaging_usability_ul.stock_select_ul_action diff --git a/stock_packaging_usability_ul/wizard/stock_select_ul.py b/stock_packaging_usability_ul/wizard/stock_select_ul.py index 71061302b20..4d6b3957c63 100644 --- a/stock_packaging_usability_ul/wizard/stock_select_ul.py +++ b/stock_packaging_usability_ul/wizard/stock_select_ul.py @@ -34,7 +34,7 @@ class StockSelectUL(models.TransientModel): @api.multi def validate(self): self.ensure_one() - ul = self[0].ul_id + ul = self.ul_id assert self.env.context.get('pack_function') is not None, \ 'missing context key pack_function' self = self.with_context(default_ul_id=(ul and ul.id or False))