Merge lp:~agilebg/account-invoicing/adding_product_customer_code_invoice into lp:~account-core-editors/account-invoicing/7.0

Proposed by Nicola Malcontenti - Agile BG
Status: Merged
Merged at revision: 47
Proposed branch: lp:~agilebg/account-invoicing/adding_product_customer_code_invoice
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 240 lines (+208/-0)
6 files modified
product_customer_code_invoice/__init__.py (+21/-0)
product_customer_code_invoice/__openerp__.py (+44/-0)
product_customer_code_invoice/account_invoice.py (+54/-0)
product_customer_code_invoice/account_invoice_view.xml (+24/-0)
product_customer_code_invoice/i18n/it.po (+33/-0)
product_customer_code_invoice/i18n/product_customer_code_invoice.pot (+32/-0)
To merge this branch: bzr merge lp:~agilebg/account-invoicing/adding_product_customer_code_invoice
Reviewer Review Type Date Requested Status
Raphaël Valyi - http://www.akretion.com Approve
Guewen Baconnier @ Camptocamp depends on a mp 'work in progress' Needs Fixing
Holger Brunn (Therp) code review Approve
Lorenzo Battistini (community) code review Approve
Review via email: mp+202469@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

But it looks like the MP mentioned above is stuck, so we should wait with merging until that one is done.

review: Approve (code review)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

As the MP on which this one depends is stuck, I put my review as Needs Fixing just to avoid it to be merged by inadvertence if someone does not read all the comments and just see the review votes.

review: Needs Fixing (depends on a mp 'work in progress')
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

LGTM, also proceeding with the merge now as pending merge was just processed and as we got 2 approvals here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_customer_code_invoice'
2=== added file 'product_customer_code_invoice/__init__.py'
3--- product_customer_code_invoice/__init__.py 1970-01-01 00:00:00 +0000
4+++ product_customer_code_invoice/__init__.py 2014-01-21 14:45:46 +0000
5@@ -0,0 +1,21 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
10+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as published
14+# by the Free Software Foundation, either version 3 of the License, or
15+# (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+from . import account_invoice
27
28=== added file 'product_customer_code_invoice/__openerp__.py'
29--- product_customer_code_invoice/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ product_customer_code_invoice/__openerp__.py 2014-01-21 14:45:46 +0000
31@@ -0,0 +1,44 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
36+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
37+#
38+# This program is free software: you can redistribute it and/or modify
39+# it under the terms of the GNU Affero General Public License as published
40+# by the Free Software Foundation, either version 3 of the License, or
41+# (at your option) any later version.
42+#
43+# This program is distributed in the hope that it will be useful,
44+# but WITHOUT ANY WARRANTY; without even the implied warranty of
45+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+# GNU Affero General Public License for more details.
47+#
48+# You should have received a copy of the GNU Affero General Public License
49+# along with this program. If not, see <http://www.gnu.org/licenses/>.
50+#
51+##############################################################################
52+{
53+ "name" : "Product Customer code for account invoice",
54+ "version" : "1.0",
55+ "author" : "Agile Business Group",
56+ "website" : "http://www.agilebg.com",
57+ "category" : "Account",
58+ "depends" : [
59+ 'base',
60+ 'product',
61+ 'account',
62+ 'product_customer_code'
63+ ],
64+ "description": """
65+ Based on product_customer_code,
66+ this module loads in every account invoice
67+ the customer code defined in the product,
68+ """,
69+ "demo" : [],
70+ "data" : [
71+ 'account_invoice_view.xml',
72+ ],
73+ 'installable' : True,
74+ 'active' : False,
75+}
76
77=== added file 'product_customer_code_invoice/account_invoice.py'
78--- product_customer_code_invoice/account_invoice.py 1970-01-01 00:00:00 +0000
79+++ product_customer_code_invoice/account_invoice.py 2014-01-21 14:45:46 +0000
80@@ -0,0 +1,54 @@
81+# -*- coding: utf-8 -*-
82+##############################################################################
83+#
84+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
85+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
86+#
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU Affero General Public License as published
89+# by the Free Software Foundation, either version 3 of the License, or
90+# (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU Affero General Public License for more details.
96+#
97+# You should have received a copy of the GNU Affero General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+#
100+##############################################################################
101+from openerp.osv import fields, orm
102+
103+
104+class account_invoice_line(orm.Model):
105+ _inherit = 'account.invoice.line'
106+
107+ def _get_product_customer_code(
108+ self, cr, uid, ids,
109+ name, args, context=None):
110+ if context is None:
111+ context = {}
112+ res = {}
113+ product_customer_code_obj = self.pool.get('product.customer.code')
114+ for line in self.browse(cr, uid, ids, context=context):
115+ res[line.id] = ''
116+ partner = line.partner_id
117+ product = line.product_id
118+ if product and partner:
119+ code_ids = product_customer_code_obj.search(cr, uid, [
120+ ('product_id', '=', product.id),
121+ ('partner_id', '=', partner.id),
122+ ], limit=1, context=context)
123+ if code_ids:
124+ code = product_customer_code_obj.browse(
125+ cr, uid,
126+ code_ids[0], context=context).product_code or ''
127+ res[line.id] = code
128+ return res
129+
130+ _columns = {
131+ 'product_customer_code': fields.function(
132+ _get_product_customer_code,
133+ string='Product Customer Code', type='char', size=64),
134+ }
135
136=== added file 'product_customer_code_invoice/account_invoice_view.xml'
137--- product_customer_code_invoice/account_invoice_view.xml 1970-01-01 00:00:00 +0000
138+++ product_customer_code_invoice/account_invoice_view.xml 2014-01-21 14:45:46 +0000
139@@ -0,0 +1,24 @@
140+<?xml version="1.0" encoding="utf-8"?>
141+<!--
142+ product customer code invoice for OpenERP
143+ Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>).
144+ Authors, Nicola Malcontenti, nicola.malcontenti@agilebg.com
145+ The licence is in the file __openerp__.py
146+-->
147+<openerp>
148+ <data>
149+
150+ <record id="invoice_form" model="ir.ui.view">
151+ <field name="name">account.invoice.product.code.form</field>
152+ <field name="model">account.invoice</field>
153+ <field name="inherit_id" ref="account.invoice_form"/>
154+ <field eval="16" name="priority"/>
155+ <field name="arch" type="xml">
156+ <xpath expr="//form//tree//field[@name='product_id']" position="after">
157+ <field name="product_customer_code"/>
158+ </xpath>
159+ </field>
160+ </record>
161+
162+ </data>
163+</openerp>
164\ No newline at end of file
165
166=== added directory 'product_customer_code_invoice/i18n'
167=== added file 'product_customer_code_invoice/i18n/it.po'
168--- product_customer_code_invoice/i18n/it.po 1970-01-01 00:00:00 +0000
169+++ product_customer_code_invoice/i18n/it.po 2014-01-21 14:45:46 +0000
170@@ -0,0 +1,33 @@
171+# Translation of OpenERP Server.
172+# This file contains the translation of the following modules:
173+# * product_customer_code_invoice
174+#
175+msgid ""
176+msgstr ""
177+"Project-Id-Version: OpenERP Server 7.0\n"
178+"Report-Msgid-Bugs-To: \n"
179+"POT-Creation-Date: 2014-01-15 14:23+0000\n"
180+"PO-Revision-Date: 2014-01-15 15:27+0100\n"
181+"Last-Translator: <>\n"
182+"Language-Team: \n"
183+"MIME-Version: 1.0\n"
184+"Content-Type: text/plain; charset=UTF-8\n"
185+"Content-Transfer-Encoding: 8bit\n"
186+"Plural-Forms: \n"
187+"Language: it\n"
188+"X-Generator: Poedit 1.6.2\n"
189+
190+#. module: product_customer_code_invoice
191+#: field:account.invoice.line,product_customer_code:0
192+msgid "Product Customer Code"
193+msgstr "Codice Prodotto Cliente"
194+
195+#. module: product_customer_code_invoice
196+#: model:ir.model,name:product_customer_code_invoice.model_account_invoice_line
197+msgid "Invoice Line"
198+msgstr "Righe Fattura"
199+
200+#. module: product_customer_code_invoice
201+#: model:ir.model,name:product_customer_code_invoice.model_account_invoice
202+msgid "Invoice"
203+msgstr "Fattura"
204
205=== added file 'product_customer_code_invoice/i18n/product_customer_code_invoice.pot'
206--- product_customer_code_invoice/i18n/product_customer_code_invoice.pot 1970-01-01 00:00:00 +0000
207+++ product_customer_code_invoice/i18n/product_customer_code_invoice.pot 2014-01-21 14:45:46 +0000
208@@ -0,0 +1,32 @@
209+# Translation of OpenERP Server.
210+# This file contains the translation of the following modules:
211+# * product_customer_code_invoice
212+#
213+msgid ""
214+msgstr ""
215+"Project-Id-Version: OpenERP Server 7.0\n"
216+"Report-Msgid-Bugs-To: \n"
217+"POT-Creation-Date: 2014-01-15 14:23+0000\n"
218+"PO-Revision-Date: 2014-01-15 14:23+0000\n"
219+"Last-Translator: <>\n"
220+"Language-Team: \n"
221+"MIME-Version: 1.0\n"
222+"Content-Type: text/plain; charset=UTF-8\n"
223+"Content-Transfer-Encoding: \n"
224+"Plural-Forms: \n"
225+
226+#. module: product_customer_code_invoice
227+#: field:account.invoice.line,product_customer_code:0
228+msgid "Product Customer Code"
229+msgstr ""
230+
231+#. module: product_customer_code_invoice
232+#: model:ir.model,name:product_customer_code_invoice.model_account_invoice_line
233+msgid "Invoice Line"
234+msgstr ""
235+
236+#. module: product_customer_code_invoice
237+#: model:ir.model,name:product_customer_code_invoice.model_account_invoice
238+msgid "Invoice"
239+msgstr ""
240+

Subscribers

People subscribed via source and target branches