Merge lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2 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_financial_report_webkit-first-special-fix2
Merge into: lp:~account-report-core-editor/account-financial-report/7.0
Diff against target: 118 lines (+67/-2)
5 files modified
account_financial_report_webkit/__init__.py (+2/-1)
account_financial_report_webkit/__openerp__.py (+2/-1)
account_financial_report_webkit/report/common_partner_reports.py (+3/-0)
account_financial_report_webkit/res_company.py (+42/-0)
account_financial_report_webkit/res_company_view.xml (+18/-0)
To merge this branch: bzr merge lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Omar (Pexego) code review Approve
Frederic Clementi - Camptocamp Pending
Review via email: mp+216380@code.launchpad.net

Description of the change

add company parameter for first special period

To post a comment you must log in.
Revision history for this message
Omar (Pexego) (omar7r) wrote :

LGTM

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

Hi, Luc,

I see your solution very restricted, because you can have an special period for each fiscal year. Setting it at company level doesn't seem the best approach. Why don't you put it at fiscal year level?

Regards.

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

The account_financial_report_webkit module needs to know only the very first special period from where accounting is being done in OpenERP (with accounting I mean full accounting, not just payables/receivables).
From that first special period, the opening balances for all the fiscal years on which we need to financial reports are calculated correctly.
Hence only one parameter at the company level is required.

Regards,
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 Pedro Manuel Baeza
Sent: zaterdag 7 juni 2014 12:16
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2 into lp:account-financial-report

Review: Needs Information code review

Hi, Luc,

I see your solution very restricted, because you can have an special period for each fiscal year. Setting it at company level doesn't seem the best approach. Why don't you put it at fiscal year level?

Regards.
--
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2/+merge/216380
You are the owner of lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-first-special-fix2.

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

OK, now I see. Sorry for the misunderstanding.

Regards.

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

Unmerged revisions

87. By Luc De Meyer

add company parameter for first special period

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
20import account20import account
21from . import wizard21from . import wizard
22from . import report22from . import report
23from . import account_move_line
24\ No newline at end of file23\ No newline at end of file
24from . import account_move_line
25from . import res_company
25\ No newline at end of file26\ No newline at end of file
2627
=== 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 @@
167the header and footer are created as text with arguments passed to167the header and footer are created as text with arguments passed to
168wkhtmltopdf. The texts are defined inside the report classes.168wkhtmltopdf. The texts are defined inside the report classes.
169""",169""",
170 'version': '1.1.0',170 'version': '1.2.0',
171 'author': 'Camptocamp',171 'author': 'Camptocamp',
172 'license': 'AGPL-3',172 'license': 'AGPL-3',
173 'category': 'Finance',173 'category': 'Finance',
@@ -179,6 +179,7 @@
179 'init_xml': [],179 'init_xml': [],
180 'demo_xml' : [],180 'demo_xml' : [],
181 'update_xml': ['account_view.xml',181 'update_xml': ['account_view.xml',
182 'res_company_view.xml',
182 'data/financial_webkit_header.xml',183 'data/financial_webkit_header.xml',
183 'report/report.xml',184 'report/report.xml',
184 'wizard/wizard.xml',185 'wizard/wizard.xml',
185186
=== 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 @@
6464
65 :return: browse record of the first special period.65 :return: browse record of the first special period.
66 """66 """
67 first_special_period = self.localcontext['company'].first_special_period_id
68 if first_special_period:
69 return first_special_period
67 move_line_obj = self.pool.get('account.move.line')70 move_line_obj = self.pool.get('account.move.line')
68 first_entry_id = move_line_obj.search(71 first_entry_id = move_line_obj.search(
69 self.cr, self.uid, [], order='date ASC', limit=1)72 self.cr, self.uid, [], order='date ASC', limit=1)
7073
=== 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 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# 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/>.
20#
21##############################################################################
22
23from openerp.osv import fields, orm
24
25class res_company(orm.Model):
26 _inherit = 'res.company'
27
28 def _get_first_special_period(self, cr, uid, context=None):
29 first_special = self.pool.get('account.period').search(cr, uid,
30 [('special', '=', True)], order='date_start ASC', limit=1)
31 return first_special and first_special[0] or False
32
33 _columns = {
34 'first_special_period_id': fields.many2one('account.period', 'First Special Period',
35 domain=[('special', '=', True)],
36 help="When specified, the accounting reports will consider this "
37 "period as the start period for the calculation of opening balances.")
38 }
39
40 _defaults = {
41 'first_special_period_id': _get_first_special_period,
42 }
0\ No newline at end of file43\ No newline at end of file
144
=== 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 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="company_form_inherit" model="ir.ui.view">
6 <field name="name">company.form.inherit</field>
7 <field name="model">res.company</field>
8 <field name="inherit_id" ref="base.view_company_form"/>
9 <field name="arch" type="xml">
10 <field name="currency_id" position="after">
11 <field name="first_special_period_id"/>
12 </field>
13 </field>
14 </record>
15
16 </data>
17</openerp>
18