Merge lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra into lp:~account-report-core-editor/account-financial-report/7.0

Proposed by Luc De Meyer (Noviat)
Status: Needs review
Proposed branch: lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra
Merge into: lp:~account-report-core-editor/account-financial-report/7.0
Diff against target: 137 lines (+26/-11)
4 files modified
account_journal_report_xls/__openerp__.py (+1/-1)
account_journal_report_xls/account_journal.py (+15/-4)
account_journal_report_xls/report/__init__.py (+3/-3)
account_journal_report_xls/report/nov_account_journal_xls.py (+7/-3)
To merge this branch: bzr merge lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Alexandre Fayolle - camptocamp code review, no tests Needs Information
Review via email: mp+220527@code.launchpad.net

Description of the change

add possibility to extend namespace for use in xls template via inherited module.

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

I find your naming very confusing. Could you clarify what is "space" and what is "namespace" here?

review: Needs Information (code review, no tests)
Revision history for this message
Luc De Meyer (Noviat) (luc-demeyer) wrote :

Namespace means python namespace.
Luc

www.noviat.com
Rusatiralaan 1, 1083 Brussel
+32 2 808 86 38

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Alexandre Fayolle - camptocamp
Sent: donderdag 26 juni 2014 16:21
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra into lp:account-financial-report

Review: Needs Information code review, no tests

I find your naming very confusing. Could you clarify what is "space" and what is "namespace" here?
--
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra/+merge/220527
You are the owner of lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :
review: Needs Resubmitting

Unmerged revisions

91. By Luc De Meyer

update account_journal_report_xls

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_journal_report_xls/__openerp__.py'
--- account_journal_report_xls/__openerp__.py 2014-02-21 16:43:10 +0000
+++ account_journal_report_xls/__openerp__.py 2014-05-21 20:48:21 +0000
@@ -22,7 +22,7 @@
2222
23{23{
24 'name': 'Financial Journal reports',24 'name': 'Financial Journal reports',
25 'version': '0.2',25 'version': '0.3',
26 'license': 'AGPL-3',26 'license': 'AGPL-3',
27 'author': 'Noviat',27 'author': 'Noviat',
28 'category': 'Accounting & Finance',28 'category': 'Accounting & Finance',
2929
=== modified file 'account_journal_report_xls/account_journal.py'
--- account_journal_report_xls/account_journal.py 2014-01-19 18:16:42 +0000
+++ account_journal_report_xls/account_journal.py 2014-05-21 20:48:21 +0000
@@ -3,7 +3,7 @@
3#3#
4# OpenERP, Open Source Management Solution4# OpenERP, Open Source Management Solution
5#5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.6# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as9# it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
12#12#
13# This program is distributed in the hope that it will be useful,13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.16# GNU Affero General Public License for more details.
17#17#
18# You should have received a copy of the GNU Affero General Public License18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
2222
@@ -36,9 +36,20 @@
36 return (select_extra, join_extra, where_extra)36 return (select_extra, join_extra, where_extra)
3737
38 # allow inherited modules to add document references38 # allow inherited modules to add document references
39 def _report_xls_document_extra(self, cr, uid, context):39 def _report_xls_document_extra(self, cr, uid, context=None):
40 return "''"40 return "''"
4141
42 # allow inherited modules to extend the render namespace
43 def _report_xls_render_space_extra(self, cr, uid, context=None):
44 """
45 extend render namespace for use in the template 'lines', e.g.
46 space_extra = {
47 'partner_obj': self.pool.get('res.partner'),
48 }
49 return space_extra
50 """
51 return None
52
42 # override list in inherited module to add/drop columns or change order53 # override list in inherited module to add/drop columns or change order
43 def _report_xls_fields(self, cr, uid, context=None):54 def _report_xls_fields(self, cr, uid, context=None):
44 res = [55 res = [
4556
=== modified file 'account_journal_report_xls/report/__init__.py'
--- account_journal_report_xls/report/__init__.py 2013-12-19 17:08:40 +0000
+++ account_journal_report_xls/report/__init__.py 2014-05-21 20:48:21 +0000
@@ -3,7 +3,7 @@
3#3#
4# OpenERP, Open Source Management Solution4# OpenERP, Open Source Management Solution
5#5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.6# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as9# it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
12#12#
13# This program is distributed in the hope that it will be useful,13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.16# GNU Affero General Public License for more details.
17#17#
18# You should have received a copy of the GNU Affero General Public License18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
2222
2323
=== modified file 'account_journal_report_xls/report/nov_account_journal_xls.py'
--- account_journal_report_xls/report/nov_account_journal_xls.py 2014-01-19 18:16:42 +0000
+++ account_journal_report_xls/report/nov_account_journal_xls.py 2014-05-21 20:48:21 +0000
@@ -3,7 +3,7 @@
3#3#
4# OpenERP, Open Source Management Solution4# OpenERP, Open Source Management Solution
5#5#
6# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.6# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as9# it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
12#12#
13# This program is distributed in the hope that it will be useful,13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.16# GNU Affero General Public License for more details.
17#17#
18# You should have received a copy of the GNU Affero General Public License18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
2222
@@ -41,10 +41,12 @@
41 self.context = context41 self.context = context
42 wanted_list = journal_obj._report_xls_fields(cr, uid, context)42 wanted_list = journal_obj._report_xls_fields(cr, uid, context)
43 template_changes = journal_obj._report_xls_template(cr, uid, context)43 template_changes = journal_obj._report_xls_template(cr, uid, context)
44 space_extra = journal_obj._report_xls_render_space_extra(cr, uid, context)
44 self.localcontext.update({45 self.localcontext.update({
45 'datetime': datetime,46 'datetime': datetime,
46 'wanted_list': wanted_list,47 'wanted_list': wanted_list,
47 'template_changes': template_changes,48 'template_changes': template_changes,
49 'space_extra': space_extra,
48 })50 })
4951
5052
@@ -210,6 +212,8 @@
210212
211 def _journal_lines(self, o, ws, _p, row_pos, xlwt, _xs):213 def _journal_lines(self, o, ws, _p, row_pos, xlwt, _xs):
212214
215 if _p.space_extra:
216 locals().update(_p.space_extra)
213 wanted_list = self.wanted_list217 wanted_list = self.wanted_list
214 debit_pos = self.debit_pos218 debit_pos = self.debit_pos
215 credit_pos = self.credit_pos219 credit_pos = self.credit_pos