From b814ec11bf7ecc307c9a91171a82780f6497b3ad Mon Sep 17 00:00:00 2001 From: David Beal Date: Wed, 21 Sep 2016 12:48:25 +0200 Subject: [PATCH] [ADD] stock_picking_zip module --- stock_picking_zip/__init__.py | 1 + stock_picking_zip/__openerp__.py | 26 +++++++++++++ stock_picking_zip/i18n/fr.po | 39 ++++++++++++++++++++ stock_picking_zip/i18n/stock_picking_zip.pot | 38 +++++++++++++++++++ stock_picking_zip/stock.py | 24 ++++++++++++ stock_picking_zip/stock_view.xml | 30 +++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 stock_picking_zip/__init__.py create mode 100644 stock_picking_zip/__openerp__.py create mode 100644 stock_picking_zip/i18n/fr.po create mode 100644 stock_picking_zip/i18n/stock_picking_zip.pot create mode 100644 stock_picking_zip/stock.py create mode 100644 stock_picking_zip/stock_view.xml diff --git a/stock_picking_zip/__init__.py b/stock_picking_zip/__init__.py new file mode 100644 index 0000000..12bab77 --- /dev/null +++ b/stock_picking_zip/__init__.py @@ -0,0 +1 @@ +from . import stock diff --git a/stock_picking_zip/__openerp__.py b/stock_picking_zip/__openerp__.py new file mode 100644 index 0000000..99589db --- /dev/null +++ b/stock_picking_zip/__openerp__.py @@ -0,0 +1,26 @@ +# coding: utf-8 +# © 2016 David BEAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Stock Picking Zip', + 'summary': "Allow to group picking list by zip code", + 'version': '8.0.0.0.1', + 'category': 'stock', + 'author': 'Akretion', + 'description': """ +Allow to group picking list by zip code + + +Author: David BEAL +""", + 'depends': [ + 'stock', + ], + 'website': 'http://www.akretion.com/', + 'data': [ + 'stock_view.xml', + ], + 'installable': True, + 'license': 'AGPL-3', +} diff --git a/stock_picking_zip/i18n/fr.po b/stock_picking_zip/i18n/fr.po new file mode 100644 index 0000000..be7e401 --- /dev/null +++ b/stock_picking_zip/i18n/fr.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_zip +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-21 10:46+0000\n" +"PO-Revision-Date: 2016-09-21 12:47+0200\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: fr\n" +"X-Generator: Poedit 1.8.7.1\n" + +#. module: stock_picking_zip +#: view:stock.picking:stock_picking_zip.view_picking_internal_search +msgid "Group By" +msgstr "Grouper par" + +#. module: stock_picking_zip +#: model:ir.model,name:stock_picking_zip.model_stock_picking +msgid "Picking List" +msgstr "Liste de livraison" + +#. module: stock_picking_zip +#: help:stock.picking,short_zip:0 +msgid "Troncated zip code to a limited chars number allowing group by" +msgstr "Code postal tronqué permettant de faire des regroupements" + +#. module: stock_picking_zip +#: view:stock.picking:stock_picking_zip.view_picking_internal_search +#: field:stock.picking,short_zip:0 +msgid "Zip" +msgstr "Code P." diff --git a/stock_picking_zip/i18n/stock_picking_zip.pot b/stock_picking_zip/i18n/stock_picking_zip.pot new file mode 100644 index 0000000..7d603d7 --- /dev/null +++ b/stock_picking_zip/i18n/stock_picking_zip.pot @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_zip +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-21 10:46+0000\n" +"PO-Revision-Date: 2016-09-21 10:46+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_picking_zip +#: view:stock.picking:stock_picking_zip.view_picking_internal_search +msgid "Group By" +msgstr "" + +#. module: stock_picking_zip +#: model:ir.model,name:stock_picking_zip.model_stock_picking +msgid "Picking List" +msgstr "" + +#. module: stock_picking_zip +#: help:stock.picking,short_zip:0 +msgid "Troncated zip code to a limited chars number allowing group by" +msgstr "" + +#. module: stock_picking_zip +#: view:stock.picking:stock_picking_zip.view_picking_internal_search +#: field:stock.picking,short_zip:0 +msgid "Zip" +msgstr "" + diff --git a/stock_picking_zip/stock.py b/stock_picking_zip/stock.py new file mode 100644 index 0000000..e5209fc --- /dev/null +++ b/stock_picking_zip/stock.py @@ -0,0 +1,24 @@ +# coding: utf-8 +# © 2016 David BEAL @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields, api + + +class StockPicking(models.Model): + _inherit = 'stock.picking' + + short_zip = fields.Char( + string='Zip', compute='_compute_short_zip', store=True, + help="Troncated zip code to a limited chars number allowing group by") + + def _set_short_zip_size(self): + """ if zip is 69100, then short zip is 69 """ + return 2 + + @api.depends('partner_id') + @api.multi + def _compute_short_zip(self): + for rec in self: + if rec.partner_id and rec.partner_id.zip: + rec.short_zip = rec.partner_id.zip[:self._set_short_zip_size()] diff --git a/stock_picking_zip/stock_view.xml b/stock_picking_zip/stock_view.xml new file mode 100644 index 0000000..4c3f3b7 --- /dev/null +++ b/stock_picking_zip/stock_view.xml @@ -0,0 +1,30 @@ + + + + + + + + stock.picking + + + + + + + + + + stock.picking + + + + + + + + + + + +