← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Luc De Meyer (Noviat) has proposed merging lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra into lp:account-financial-report.

Requested reviews:
  Account Report Core Editors (account-report-core-editor)

For more details, see:
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra/+merge/220527

add possibility to extend namespace for use in xls template via inherited module.
-- 
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra/+merge/220527
Your team Account Report Core Editors is requested to review the proposed merge of lp:~luc-demeyer/account-financial-report/7.0-account_journal_report_xls-namespace-extra into lp:account-financial-report.
=== 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 @@
 
 {
     'name': 'Financial Journal reports',
-    'version': '0.2',
+    'version': '0.3',
     'license': 'AGPL-3',
     'author': 'Noviat',
     'category': 'Accounting & Finance',

=== 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 @@
 #
 #    OpenERP, Open Source Management Solution
 #
-#    Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
+#    Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
 #
 #    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
+#    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/>.
+#    along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -36,9 +36,20 @@
         return (select_extra, join_extra, where_extra)
 
     # allow inherited modules to add document references
-    def _report_xls_document_extra(self, cr, uid, context):
+    def _report_xls_document_extra(self, cr, uid, context=None):
         return "''"
 
+    # allow inherited modules to extend the render namespace
+    def _report_xls_render_space_extra(self, cr, uid, context=None):
+        """
+        extend render namespace for use in the template 'lines', e.g.
+        space_extra = {
+            'partner_obj': self.pool.get('res.partner'),
+        }
+        return space_extra
+        """
+        return None
+
     # override list in inherited module to add/drop columns or change order
     def _report_xls_fields(self, cr, uid, context=None):
         res = [

=== 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 @@
 #
 #    OpenERP, Open Source Management Solution
 #
-#    Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
+#    Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
 #
 #    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
+#    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/>.
+#    along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== 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 @@
 #
 #    OpenERP, Open Source Management Solution
 #
-#    Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
+#    Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -12,11 +12,11 @@
 #
 #    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
+#    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/>.
+#    along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -41,10 +41,12 @@
         self.context = context
         wanted_list = journal_obj._report_xls_fields(cr, uid, context)
         template_changes = journal_obj._report_xls_template(cr, uid, context)
+        space_extra = journal_obj._report_xls_render_space_extra(cr, uid, context)
         self.localcontext.update({
             'datetime': datetime,
             'wanted_list': wanted_list,
             'template_changes': template_changes,
+            'space_extra': space_extra,
         })
 
 
@@ -210,6 +212,8 @@
 
     def _journal_lines(self, o, ws, _p, row_pos, xlwt, _xs):
 
+        if _p.space_extra:
+            locals().update(_p.space_extra)
         wanted_list = self.wanted_list
         debit_pos = self.debit_pos
         credit_pos = self.credit_pos


Follow ups