Nicola Malcontenti - Agile BG has proposed merging lp:~agilebg/account-invoicing/adding_product_customer_code_invoice into lp:account-invoicing.
Requested reviews: Account Core Editors (account-core-editors) For more details, see: https://code.launchpad.net/~agilebg/account-invoicing/adding_product_customer_code_invoice/+merge/202469 Based on product_customer_code,this module loads in every account invoice 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/account-invoicing/adding_product_customer_code_invoice/+merge/202469 Your team Account Core Editors is requested to review the proposed merge of lp:~agilebg/account-invoicing/adding_product_customer_code_invoice into lp:account-invoicing.
=== added directory 'product_customer_code_invoice' === added file 'product_customer_code_invoice/__init__.py' --- product_customer_code_invoice/__init__.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/__init__.py 2014-01-21 14:45:46 +0000 @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <[email protected]> +# +# 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 account_invoice === added file 'product_customer_code_invoice/__openerp__.py' --- product_customer_code_invoice/__openerp__.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/__openerp__.py 2014-01-21 14:45:46 +0000 @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <[email protected]> +# +# 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 for account invoice", + "version" : "1.0", + "author" : "Agile Business Group", + "website" : "http://www.agilebg.com", + "category" : "Account", + "depends" : [ + 'base', + 'product', + 'account', + 'product_customer_code' + ], + "description": """ + Based on product_customer_code, + this module loads in every account invoice + the customer code defined in the product, + """, + "demo" : [], + "data" : [ + 'account_invoice_view.xml', + ], + 'installable' : True, + 'active' : False, +} === added file 'product_customer_code_invoice/account_invoice.py' --- product_customer_code_invoice/account_invoice.py 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/account_invoice.py 2014-01-21 14:45:46 +0000 @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Author: Nicola Malcontenti <[email protected]> +# +# 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 account_invoice_line(orm.Model): + _inherit = 'account.invoice.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.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_invoice/account_invoice_view.xml' --- product_customer_code_invoice/account_invoice_view.xml 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/account_invoice_view.xml 2014-01-21 14:45:46 +0000 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + product customer code invoice for OpenERP + Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>). + Authors, Nicola Malcontenti, [email protected] + The licence is in the file __openerp__.py +--> +<openerp> + <data> + + <record id="invoice_form" model="ir.ui.view"> + <field name="name">account.invoice.product.code.form</field> + <field name="model">account.invoice</field> + <field name="inherit_id" ref="account.invoice_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> + </field> + </record> + + </data> +</openerp> \ No newline at end of file === added directory 'product_customer_code_invoice/i18n' === added file 'product_customer_code_invoice/i18n/it.po' --- product_customer_code_invoice/i18n/it.po 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/i18n/it.po 2014-01-21 14:45:46 +0000 @@ -0,0 +1,33 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_invoice +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:23+0000\n" +"PO-Revision-Date: 2014-01-15 15:27+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_invoice +#: field:account.invoice.line,product_customer_code:0 +msgid "Product Customer Code" +msgstr "Codice Prodotto Cliente" + +#. module: product_customer_code_invoice +#: model:ir.model,name:product_customer_code_invoice.model_account_invoice_line +msgid "Invoice Line" +msgstr "Righe Fattura" + +#. module: product_customer_code_invoice +#: model:ir.model,name:product_customer_code_invoice.model_account_invoice +msgid "Invoice" +msgstr "Fattura" === added file 'product_customer_code_invoice/i18n/product_customer_code_invoice.pot' --- product_customer_code_invoice/i18n/product_customer_code_invoice.pot 1970-01-01 00:00:00 +0000 +++ product_customer_code_invoice/i18n/product_customer_code_invoice.pot 2014-01-21 14:45:46 +0000 @@ -0,0 +1,32 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_customer_code_invoice +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-15 14:23+0000\n" +"PO-Revision-Date: 2014-01-15 14:23+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_invoice +#: field:account.invoice.line,product_customer_code:0 +msgid "Product Customer Code" +msgstr "" + +#. module: product_customer_code_invoice +#: model:ir.model,name:product_customer_code_invoice.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: product_customer_code_invoice +#: model:ir.model,name:product_customer_code_invoice.model_account_invoice +msgid "Invoice" +msgstr "" +
-- Mailing list: https://launchpad.net/~openerp-community-reviewer Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-community-reviewer More help : https://help.launchpad.net/ListHelp

