Merge lp:~camptocamp/account-invoice-report/7.0-add-invoice_report_assemble-yvr into lp:~account-core-editors/account-invoice-report/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp
Approved revision: 46
Merged at revision: 50
Proposed branch: lp:~camptocamp/account-invoice-report/7.0-add-invoice_report_assemble-yvr
Merge into: lp:~account-core-editors/account-invoice-report/7.0
Diff against target: 380 lines (+332/-0)
9 files modified
invoice_report_assemble/__init__.py (+24/-0)
invoice_report_assemble/__openerp__.py (+41/-0)
invoice_report_assemble/company.py (+32/-0)
invoice_report_assemble/i18n/fr.po (+54/-0)
invoice_report_assemble/i18n/invoice_report_assemble.pot (+54/-0)
invoice_report_assemble/invoice_report.xml (+15/-0)
invoice_report_assemble/report_assembler.py (+44/-0)
invoice_report_assemble/res_config.py (+41/-0)
invoice_report_assemble/res_config_view.xml (+27/-0)
To merge this branch: bzr merge lp:~camptocamp/account-invoice-report/7.0-add-invoice_report_assemble-yvr
Reviewer Review Type Date Requested Status
Nicolas Bessi - Camptocamp (community) code review, no test Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+194204@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Nice! LGTM
Thanks

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

(base_report_assembler is a prerequisite and still in needs fixing)

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

base_report_assembler is approved still need an other positive advice

46. By Nicolas Bessi - Camptocamp

[PEP8]

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Thanks for the MP.

Fixed some neat pick and added module in category Accounting.

LGTM

review: Approve (code review, no test)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Thanks for the fixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'invoice_report_assemble'
2=== added file 'invoice_report_assemble/__init__.py'
3--- invoice_report_assemble/__init__.py 1970-01-01 00:00:00 +0000
4+++ invoice_report_assemble/__init__.py 2014-01-31 11:20:46 +0000
5@@ -0,0 +1,24 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Yannick Vaucher
10+# Copyright 2013 Camptocamp SA
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
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (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 report_assembler
27+from . import company
28+from . import res_config
29+
30
31=== added file 'invoice_report_assemble/__openerp__.py'
32--- invoice_report_assemble/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ invoice_report_assemble/__openerp__.py 2014-01-31 11:20:46 +0000
34@@ -0,0 +1,41 @@
35+# -*- coding: utf-8 -*-
36+##############################################################################
37+#
38+# Author: Yannick Vaucher
39+# Copyright 2013 Camptocamp SA
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+{'name': 'Assemble invoice report',
56+ 'version': '1.0',
57+ 'category': 'Accounting',
58+ 'description': """Add a printing button to print an invoice report assembled
59+ like assembling invoice webkit with bvr payment slip in a single report.
60+ It can be either of the generated invoice report""",
61+ 'author': 'Camptocamp',
62+ 'maintainer': 'Camptocamp',
63+ 'website': 'http://www.camptocamp.com/',
64+ 'depends': [
65+ 'base_report_assembler',
66+ 'account'],
67+ 'data': [
68+ 'invoice_report.xml',
69+ 'res_config_view.xml',
70+ ],
71+ 'test': [],
72+ 'installable': True,
73+ 'auto_install': False,
74+ 'application': True,
75+ }
76
77=== added file 'invoice_report_assemble/company.py'
78--- invoice_report_assemble/company.py 1970-01-01 00:00:00 +0000
79+++ invoice_report_assemble/company.py 2014-01-31 11:20:46 +0000
80@@ -0,0 +1,32 @@
81+# -*- coding: utf-8 -*-
82+##############################################################################
83+#
84+# Author: Yannick Vaucher
85+# Copyright 2013 Camptocamp SA
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
89+# published by the Free Software Foundation, either version 3 of the
90+# License, or (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 orm, fields
102+
103+
104+class ResCompany(orm.Model):
105+ _inherit = 'res.company'
106+
107+ _columns = {
108+ 'assemble_invoice_report_ids': fields.one2many(
109+ 'assembled.report', 'company_id',
110+ 'Account Invoice Assemblage Report',
111+ domain=[('model', '=', 'account.invoice')]),
112+ }
113
114=== added directory 'invoice_report_assemble/i18n'
115=== added file 'invoice_report_assemble/i18n/fr.po'
116--- invoice_report_assemble/i18n/fr.po 1970-01-01 00:00:00 +0000
117+++ invoice_report_assemble/i18n/fr.po 2014-01-31 11:20:46 +0000
118@@ -0,0 +1,54 @@
119+# Translation of OpenERP Server.
120+# This file contains the translation of the following modules:
121+# * invoice_report_assemble
122+#
123+msgid ""
124+msgstr ""
125+"Project-Id-Version: OpenERP Server 7.0\n"
126+"Report-Msgid-Bugs-To: \n"
127+"POT-Creation-Date: 2013-11-05 15:01+0000\n"
128+"PO-Revision-Date: 2013-11-05 15:01+0000\n"
129+"Last-Translator: <>\n"
130+"Language-Team: \n"
131+"MIME-Version: 1.0\n"
132+"Content-Type: text/plain; charset=UTF-8\n"
133+"Content-Transfer-Encoding: \n"
134+"Plural-Forms: \n"
135+
136+#. module: invoice_report_assemble
137+#: field:account.config.settings,assemble_invoice_report_ids:0
138+msgid "Account Invoice Report Assemblage"
139+msgstr "Assemblage de rapport de facture"
140+
141+#. module: invoice_report_assemble
142+#: model:ir.model,name:invoice_report_assemble.model_res_company
143+msgid "Companies"
144+msgstr "Sociétés"
145+
146+#. module: invoice_report_assemble
147+#: model:ir.actions.report.xml,name:invoice_report_assemble.invoice_report_assemblage
148+msgid "Invoice Assemblage"
149+msgstr "Assemblage de facture"
150+
151+#. module: invoice_report_assemble
152+#: view:account.config.settings:0
153+msgid "Invoice report assemblage"
154+msgstr "Assemblage de rapport de facture"
155+
156+#. module: invoice_report_assemble
157+#: code:addons/invoice_report_assemble/report_assembler.py:37
158+#, python-format
159+msgid "No report defined in Configuration -> Accounting for model invoice."
160+msgstr "Pas de rapport défini dans Configuration -> Finance pour les factures."
161+
162+#. module: invoice_report_assemble
163+#: code:addons/invoice_report_assemble/report_assembler.py:38
164+#, python-format
165+msgid "Error"
166+msgstr "Erreur"
167+
168+#. module: invoice_report_assemble
169+#: field:res.company,assemble_invoice_report_ids:0
170+msgid "Account Invoice Assemblage Report"
171+msgstr "Assemblage de rapport de facture"
172+
173
174=== added file 'invoice_report_assemble/i18n/invoice_report_assemble.pot'
175--- invoice_report_assemble/i18n/invoice_report_assemble.pot 1970-01-01 00:00:00 +0000
176+++ invoice_report_assemble/i18n/invoice_report_assemble.pot 2014-01-31 11:20:46 +0000
177@@ -0,0 +1,54 @@
178+# Translation of OpenERP Server.
179+# This file contains the translation of the following modules:
180+# * invoice_report_assemble
181+#
182+msgid ""
183+msgstr ""
184+"Project-Id-Version: OpenERP Server 7.0\n"
185+"Report-Msgid-Bugs-To: \n"
186+"POT-Creation-Date: 2013-11-05 15:01+0000\n"
187+"PO-Revision-Date: 2013-11-05 15:01+0000\n"
188+"Last-Translator: <>\n"
189+"Language-Team: \n"
190+"MIME-Version: 1.0\n"
191+"Content-Type: text/plain; charset=UTF-8\n"
192+"Content-Transfer-Encoding: \n"
193+"Plural-Forms: \n"
194+
195+#. module: invoice_report_assemble
196+#: field:account.config.settings,assemble_invoice_report_ids:0
197+msgid "Account Invoice Report Assemblage"
198+msgstr ""
199+
200+#. module: invoice_report_assemble
201+#: model:ir.model,name:invoice_report_assemble.model_res_company
202+msgid "Companies"
203+msgstr ""
204+
205+#. module: invoice_report_assemble
206+#: model:ir.actions.report.xml,name:invoice_report_assemble.invoice_report_assemblage
207+msgid "Invoice Assemblage"
208+msgstr ""
209+
210+#. module: invoice_report_assemble
211+#: view:account.config.settings:0
212+msgid "Invoice report assemblage"
213+msgstr ""
214+
215+#. module: invoice_report_assemble
216+#: code:addons/invoice_report_assemble/report_assembler.py:37
217+#, python-format
218+msgid "No report defined in Configuration -> Accounting for model invoice."
219+msgstr ""
220+
221+#. module: invoice_report_assemble
222+#: code:addons/invoice_report_assemble/report_assembler.py:38
223+#, python-format
224+msgid "Error"
225+msgstr ""
226+
227+#. module: invoice_report_assemble
228+#: field:res.company,assemble_invoice_report_ids:0
229+msgid "Account Invoice Assemblage Report"
230+msgstr ""
231+
232
233=== added file 'invoice_report_assemble/invoice_report.xml'
234--- invoice_report_assemble/invoice_report.xml 1970-01-01 00:00:00 +0000
235+++ invoice_report_assemble/invoice_report.xml 2014-01-31 11:20:46 +0000
236@@ -0,0 +1,15 @@
237+<?xml version="1.0" encoding="utf-8"?>
238+<openerp>
239+ <data>
240+ <report
241+ auto="False"
242+ id="invoice_report_assemblage"
243+ model="account.invoice"
244+ name="invoice_report_assemblage"
245+ string="Invoice Assemblage"
246+ attachment="(object.state in ('open','paid')) and ('INV_BVR'+(object.number or '').replace('/',''))"
247+ attachment_use="0"
248+ multi="True"
249+ report_type="assemblage"/>
250+ </data>
251+</openerp>
252
253=== added file 'invoice_report_assemble/report_assembler.py'
254--- invoice_report_assemble/report_assembler.py 1970-01-01 00:00:00 +0000
255+++ invoice_report_assemble/report_assembler.py 2014-01-31 11:20:46 +0000
256@@ -0,0 +1,44 @@
257+# -*- coding: utf-8 -*-
258+##############################################################################
259+#
260+# Author: Yannick Vaucher
261+# Copyright 2013 Camptocamp SA
262+#
263+# This program is free software: you can redistribute it and/or modify
264+# it under the terms of the GNU Affero General Public License as
265+# published by the Free Software Foundation, either version 3 of the
266+# License, or (at your option) any later version.
267+#
268+# This program is distributed in the hope that it will be useful,
269+# but WITHOUT ANY WARRANTY; without even the implied warranty of
270+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
271+# GNU Affero General Public License for more details.
272+#
273+# You should have received a copy of the GNU Affero General Public License
274+# along with this program. If not, see <http://www.gnu.org/licenses/>.
275+#
276+##############################################################################
277+
278+from openerp import pooler
279+from openerp.osv import orm
280+from openerp.tools.translate import _
281+from openerp.addons.base_report_assembler import report_assembler
282+
283+
284+class InvoicePDFReportAssembler(report_assembler.PDFReportAssembler):
285+ """InvoicePDFReportAssembler allows to merge multiple
286+ invoice reports into one pdf"""
287+
288+ def _get_report_ids(self, cr, uid, ids, context=None):
289+ pool = pooler.get_pool(cr.dbname)
290+ user_obj = pool.get('res.users')
291+ company = user_obj.browse(cr, uid, uid, context=context).company_id
292+ report_ids = [r.report_id.id for r in company.assemble_invoice_report_ids]
293+ if not report_ids:
294+ msg = _("No report defined in Configuration -> Accounting for model invoice.")
295+ raise orm.except_orm(_('Error'), msg)
296+ return report_ids
297+
298+InvoicePDFReportAssembler('report.invoice_report_assemblage',
299+ 'account.invoice',
300+ None)
301
302=== added file 'invoice_report_assemble/res_config.py'
303--- invoice_report_assemble/res_config.py 1970-01-01 00:00:00 +0000
304+++ invoice_report_assemble/res_config.py 2014-01-31 11:20:46 +0000
305@@ -0,0 +1,41 @@
306+# -*- coding: utf-8 -*-
307+##############################################################################
308+#
309+# Author: Yannick Vaucher
310+# Copyright 2013 Camptocamp SA
311+#
312+# This program is free software: you can redistribute it and/or modify
313+# it under the terms of the GNU Affero General Public License as
314+# published by the Free Software Foundation, either version 3 of the
315+# License, or (at your option) any later version.
316+#
317+# This program is distributed in the hope that it will be useful,
318+# but WITHOUT ANY WARRANTY; without even the implied warranty of
319+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320+# GNU Affero General Public License for more details.
321+#
322+# You should have received a copy of the GNU Affero General Public License
323+# along with this program. If not, see <http://www.gnu.org/licenses/>.
324+#
325+##############################################################################
326+from openerp.osv import orm, fields
327+
328+
329+class AccountConfigSettings(orm.TransientModel):
330+ _inherit = 'account.config.settings'
331+
332+ _columns = {
333+ 'assemble_invoice_report_ids': fields.related(
334+ 'company_id', 'assemble_invoice_report_ids',
335+ string='Account Invoice Report Assemblage',
336+ type='one2many', relation='assembled.report'),
337+ }
338+
339+ def onchange_company_id(self, cr, uid, ids, company_id, context=None):
340+ res = super(AccountConfigSettings, self).onchange_company_id(
341+ cr, uid, ids, company_id, context=context)
342+ company = self.pool.get('res.company').browse(cr, uid, company_id,
343+ context=context)
344+ r_ids = [r.id for r in company.assemble_invoice_report_ids]
345+ res['value']['assemble_invoice_report_ids'] = r_ids
346+ return res
347
348=== added file 'invoice_report_assemble/res_config_view.xml'
349--- invoice_report_assemble/res_config_view.xml 1970-01-01 00:00:00 +0000
350+++ invoice_report_assemble/res_config_view.xml 2014-01-31 11:20:46 +0000
351@@ -0,0 +1,27 @@
352+<?xml version="1.0" encoding="utf-8"?>
353+<openerp>
354+ <data>
355+
356+ <record id="view_account_config_settings" model="ir.ui.view">
357+ <field name="name">account settings.add.invoice.assemble</field>
358+ <field name="model">account.config.settings</field>
359+ <field name="inherit_id" ref="account.view_account_config_settings"/>
360+ <field name="arch" type="xml">
361+ <xpath expr="//field[@name='module_account_followup']/ancestor::div[1]" position="after">
362+ <div>
363+ <label for="assemble_invoice_report_ids" string="Invoice report assemblage"/>
364+ <field name="assemble_invoice_report_ids" context="{'default_model': 'account.invoice'}">
365+ <tree editable="bottom">
366+ <field name="report_id"/>
367+ <field name="model" invisible="True"/>
368+ <field name="sequence" invisible="True"/>
369+ <field name="company_id" invisible="True"/>
370+ </tree>
371+ </field>
372+ </div>
373+ </xpath>
374+ </field>
375+ </record>
376+
377+ </data>
378+</openerp>
379
380=== added directory 'invoice_report_assemble/security'

Subscribers

People subscribed via source and target branches