diff --git a/product_customer_code_picking/__init__.py b/product_customer_code_picking/__init__.py new file mode 100644 index 00000000000..16a2a919425 --- /dev/null +++ b/product_customer_code_picking/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl () +# Author: Nicola Malcontenti +# +# 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_picking diff --git a/product_customer_code_picking/__openerp__.py b/product_customer_code_picking/__openerp__.py new file mode 100644 index 00000000000..e6813ef1a86 --- /dev/null +++ b/product_customer_code_picking/__openerp__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl () +# Author: Nicola Malcontenti +# +# 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": "Product Customer code for stock picking", + "version": "1.0", + "author": "Agile Business Group", + "website": "http://www.agilebg.com", + "license": 'AGPL-3', + "category": "Stock", + "depends": [ + 'base', + 'product', + 'stock', + 'product_customer_code' + ], + "description": """ +This module makes the product customer code visible in the stock moves +of a picking. + +Contributors +------------ +* Nicola Malcontenti +* Alex Comba +* Lorenzo Battistini +""", + "demo": [], + "data": [ + 'stock_picking_view.xml', + ], + "installable": True, +} diff --git a/product_customer_code_picking/i18n/it.po b/product_customer_code_picking/i18n/it.po new file mode 100644 index 00000000000..4a89af5df46 --- /dev/null +++ b/product_customer_code_picking/i18n/it.po @@ -0,0 +1,33 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_picking +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:28+0000\n" +"PO-Revision-Date: 2014-01-15 15:29+0100\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: it\n" +"X-Generator: Poedit 1.6.2\n" + +#. module: product_customer_code_picking +#: field:stock.move,product_customer_code:0 +msgid "Product Customer Code" +msgstr "Codice Prodotto Cliente" + +#. module: product_customer_code_picking +#: model:ir.model,name:product_customer_code_picking.model_stock_move +msgid "Stock Move" +msgstr "Movimento di magazzino" + +#. module: product_customer_code_picking +#: model:ir.model,name:product_customer_code_picking.model_stock_picking +msgid "Picking List" +msgstr "Documento di trasporto" diff --git a/product_customer_code_picking/i18n/product_customer_code_picking.pot b/product_customer_code_picking/i18n/product_customer_code_picking.pot new file mode 100644 index 00000000000..4d0d5e2b14e --- /dev/null +++ b/product_customer_code_picking/i18n/product_customer_code_picking.pot @@ -0,0 +1,32 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_picking +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:28+0000\n" +"PO-Revision-Date: 2014-01-15 14:28+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: product_customer_code_picking +#: field:stock.move,product_customer_code:0 +msgid "Product Customer Code" +msgstr "" + +#. module: product_customer_code_picking +#: model:ir.model,name:product_customer_code_picking.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: product_customer_code_picking +#: model:ir.model,name:product_customer_code_picking.model_stock_picking +msgid "Picking List" +msgstr "" + diff --git a/product_customer_code_picking/stock_picking.py b/product_customer_code_picking/stock_picking.py new file mode 100644 index 00000000000..30d38b6c539 --- /dev/null +++ b/product_customer_code_picking/stock_picking.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl () +# Author: Nicola Malcontenti +# +# 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.osv import fields, orm + + +class stock_move(orm.Model): + _inherit = 'stock.move' + + def _get_product_customer_code( + self, cr, uid, ids, name, args, context=None + ): + res = {} + product_customer_code_obj = self.pool['product.customer.code'] + for move in self.browse(cr, uid, ids, context=context): + res[move.id] = '' + main_partner_id = ( + move.picking_id.partner_id.commercial_partner_id.id) + product = move.product_id + if product and main_partner_id: + code_ids = product_customer_code_obj.search(cr, uid, [ + ('product_id', '=', product.id), + ('partner_id', '=', main_partner_id), + ], limit=1, context=context) + if code_ids: + data = product_customer_code_obj.read( + cr, uid, code_ids[0], + ['product_code'], context=context + ) + res[move.id] = ( + 'product_code' in data + and data['product_code'] + or '' + ) + return res + + _columns = { + 'product_customer_code': fields.function( + _get_product_customer_code, + string='Product Customer Code', type='char', size=64), + } diff --git a/product_customer_code_picking/stock_picking_view.xml b/product_customer_code_picking/stock_picking_view.xml new file mode 100644 index 00000000000..ea6e09c2a12 --- /dev/null +++ b/product_customer_code_picking/stock_picking_view.xml @@ -0,0 +1,36 @@ + + + + + + + stock.move.product.code.tree + stock.move + + + + + + + + + + + stock.move.product.code.form + stock.move + + + + + + + + + + +