Nicola Malcontenti - Agile BG has proposed merging lp:~agilebg/sale-wkfl/adding_product_customer_code_sale_7 into lp:sale-wkfl.
Requested reviews: Sale Core Editors (sale-core-editors) For more details, see: https://code.launchpad.net/~agilebg/sale-wkfl/adding_product_customer_code_sale_7/+merge/202468 Based on product_customer_code, this module loads in every sale order line the customer code defined in the product. This module depends on https://code.launchpad.net/~akretion-team/openerp-product-attributes/7.0-product-customer-code-extraction/+merge/198296. -- https://code.launchpad.net/~agilebg/sale-wkfl/adding_product_customer_code_sale_7/+merge/202468 Your team Sale Core Editors is requested to review the proposed merge of lp:~agilebg/sale-wkfl/adding_product_customer_code_sale_7 into lp:sale-wkfl.
=== added directory 'product_customer_code_sale' === added file 'product_customer_code_sale/__init__.py' --- product_customer_code_sale/__init__.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/__init__.py 2014-01-21 14:40:39 +0000 @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <nicola.malconte...@agilebg.com> +# +# 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 sale === added file 'product_customer_code_sale/__openerp__.py' --- product_customer_code_sale/__openerp__.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/__openerp__.py 2014-01-21 14:40:39 +0000 @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <nicola.malconte...@agilebg.com> +# +# 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" : "Product Customer code on sale", + "version" : "1.0", + "author" : "Agile Business Group", + "website" : "http://www.agilebg.com", + "category" : "Sales Management", + "depends" : [ + 'base', + 'product', + 'sale', + 'product_customer_code' + ], + "description": """ + Based on product_customer_code, + this module loads in every sale order line + the customer code defined in the product, + """, + "demo" : [], + "data" : [ + 'sale_view.xml', + ], + 'installable' : True, + 'active' : False, +} === added directory 'product_customer_code_sale/i18n' === added file 'product_customer_code_sale/i18n/it.po' --- product_customer_code_sale/i18n/it.po 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/i18n/it.po 2014-01-21 14:40:39 +0000 @@ -0,0 +1,28 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_sale +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:30+0000\n" +"PO-Revision-Date: 2014-01-15 15:49+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_sale +#: field:sale.order.line,product_customer_code:0 +msgid "Product Customer Code" +msgstr "Codice Prodotto Cliente" + +#. module: product_customer_code_sale +#: model:ir.model,name:product_customer_code_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "Linea d'ordine di vendita" === added file 'product_customer_code_sale/i18n/product_customer_code_sale.pot' --- product_customer_code_sale/i18n/product_customer_code_sale.pot 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/i18n/product_customer_code_sale.pot 2014-01-21 14:40:39 +0000 @@ -0,0 +1,27 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_sale +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:31+0000\n" +"PO-Revision-Date: 2014-01-15 14:31+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_sale +#: field:sale.order.line,product_customer_code:0 +msgid "Product Customer Code" +msgstr "" + +#. module: product_customer_code_sale +#: model:ir.model,name:product_customer_code_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + === added file 'product_customer_code_sale/sale.py' --- product_customer_code_sale/sale.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/sale.py 2014-01-21 14:40:39 +0000 @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <nicola.malconte...@agilebg.com> +# +# 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 openerp.osv import fields, orm + + +class sale_order_line(orm.Model): + _inherit = 'sale.order.line' + + def _get_product_customer_code( + self, cr, uid, ids, + name, args, context=None): + if context is None: + context = {} + res = {} + product_customer_code_obj = self.pool.get('product.customer.code') + for line in self.browse(cr, uid, ids, context=context): + res[line.id] = '' + partner = line.order_id.partner_id + product = line.product_id + if product and partner: + code_ids = product_customer_code_obj.search(cr, uid, [ + ('product_id', '=', product.id), + ('partner_id', '=', partner.id), + ], limit=1, context=context) + if code_ids: + code = product_customer_code_obj.browse( + cr, uid, + code_ids[0], context=context).product_code or '' + res[line.id] = code + return res + + _columns = { + 'product_customer_code': fields.function( + _get_product_customer_code, + string='Product Customer Code', type='char', size=64), + } === added file 'product_customer_code_sale/sale_view.xml' --- product_customer_code_sale/sale_view.xml 1970-01-01 00:00:00 +0000 +++ product_customer_code_sale/sale_view.xml 2014-01-21 14:40:39 +0000 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + product customer code for OpenERP + Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>). + Authors, Nicola Malcontenti, nicola.malconte...@agilebg.com + The licence is in the file __openerp__.py +--> +<openerp> + <data> + + <record id="view_order_form" model="ir.ui.view"> + <field name="name">sale.order.product.code.view.form</field> + <field name="model">sale.order</field> + <field name="inherit_id" ref="sale.view_order_form"/> + <field eval="16" name="priority"/> + <field name="arch" type="xml"> + <xpath expr="//form//tree//field[@name='product_id']" position="after"> + <field name="product_customer_code"/> + </xpath> + <xpath expr="//form//form//field[@name='product_id']" position="after"> + <field name="product_customer_code"/> + </xpath> + </field> + </record> + + </data> +</openerp>
-- Mailing list: https://launchpad.net/~openerp-community-reviewer Post to : openerp-community-reviewer@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community-reviewer More help : https://help.launchpad.net/ListHelp