← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2 into lp:account-financial-report

 

Luc De Meyer (Noviat) has proposed merging lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2 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_financial_report_webkit-first-special-fix2/+merge/216380

add company parameter for first special period
-- 
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2/+merge/216380
Your team Account Report Core Editors is requested to review the proposed merge of lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2 into lp:account-financial-report.
=== modified file 'account_financial_report_webkit/__init__.py'
--- account_financial_report_webkit/__init__.py	2012-03-06 09:13:59 +0000
+++ account_financial_report_webkit/__init__.py	2014-04-17 18:30:38 +0000
@@ -20,4 +20,5 @@
 import account
 from . import wizard
 from . import report
-from . import account_move_line
\ No newline at end of file
+from . import account_move_line
+from . import res_company
\ No newline at end of file

=== modified file 'account_financial_report_webkit/__openerp__.py'
--- account_financial_report_webkit/__openerp__.py	2014-03-18 15:55:12 +0000
+++ account_financial_report_webkit/__openerp__.py	2014-04-17 18:30:38 +0000
@@ -167,7 +167,7 @@
 the header and footer are created as text with arguments passed to
 wkhtmltopdf. The texts are defined inside the report classes.
 """,
-    'version': '1.1.0',
+    'version': '1.2.0',
     'author': 'Camptocamp',
     'license': 'AGPL-3',
     'category': 'Finance',
@@ -179,6 +179,7 @@
     'init_xml': [],
     'demo_xml' : [],
     'update_xml': ['account_view.xml',
+                   'res_company_view.xml',
                    'data/financial_webkit_header.xml',
                    'report/report.xml',
                    'wizard/wizard.xml',

=== modified file 'account_financial_report_webkit/report/common_partner_reports.py'
--- account_financial_report_webkit/report/common_partner_reports.py	2013-05-07 06:56:51 +0000
+++ account_financial_report_webkit/report/common_partner_reports.py	2014-04-17 18:30:38 +0000
@@ -64,6 +64,9 @@
 
         :return: browse record of the first special period.
         """
+        first_special_period = self.localcontext['company'].first_special_period_id
+        if first_special_period:
+            return first_special_period
         move_line_obj = self.pool.get('account.move.line')
         first_entry_id = move_line_obj.search(
             self.cr, self.uid, [], order='date ASC', limit=1)

=== added file 'account_financial_report_webkit/res_company.py'
--- account_financial_report_webkit/res_company.py	1970-01-01 00:00:00 +0000
+++ account_financial_report_webkit/res_company.py	2014-04-17 18:30:38 +0000
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#
+#    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
+#    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 res_company(orm.Model):
+    _inherit = 'res.company'
+
+    def _get_first_special_period(self, cr, uid, context=None):
+        first_special = self.pool.get('account.period').search(cr, uid,
+              [('special', '=', True)], order='date_start ASC', limit=1)
+        return first_special and first_special[0] or False
+
+    _columns = {
+        'first_special_period_id': fields.many2one('account.period', 'First Special Period',
+            domain=[('special', '=', True)], 
+            help="When specified, the accounting reports will consider this "
+                 "period as the start period for the calculation of opening balances.")
+    }
+
+    _defaults = {
+        'first_special_period_id': _get_first_special_period,
+    }
\ No newline at end of file

=== added file 'account_financial_report_webkit/res_company_view.xml'
--- account_financial_report_webkit/res_company_view.xml	1970-01-01 00:00:00 +0000
+++ account_financial_report_webkit/res_company_view.xml	2014-04-17 18:30:38 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+
+    <record id="company_form_inherit" model="ir.ui.view">
+      <field name="name">company.form.inherit</field>
+      <field name="model">res.company</field>
+      <field name="inherit_id" ref="base.view_company_form"/>
+      <field name="arch" type="xml">
+        <field name="currency_id" position="after">
+          <field name="first_special_period_id"/>
+        </field>
+      </field>
+    </record>
+
+  </data>
+</openerp>
+


Follow ups