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
1=== modified file 'account_financial_report_webkit/__init__.py'
2--- account_financial_report_webkit/__init__.py 2012-03-06 09:13:59 +0000
3+++ account_financial_report_webkit/__init__.py 2014-04-17 18:30:38 +0000
4@@ -20,4 +20,5 @@
5 import account
6 from . import wizard
7 from . import report
8-from . import account_move_line
9\ No newline at end of file
10+from . import account_move_line
11+from . import res_company
12\ No newline at end of file
13
14=== modified file 'account_financial_report_webkit/__openerp__.py'
15--- account_financial_report_webkit/__openerp__.py 2014-03-18 15:55:12 +0000
16+++ account_financial_report_webkit/__openerp__.py 2014-04-17 18:30:38 +0000
17@@ -167,7 +167,7 @@
18 the header and footer are created as text with arguments passed to
19 wkhtmltopdf. The texts are defined inside the report classes.
20 """,
21- 'version': '1.1.0',
22+ 'version': '1.2.0',
23 'author': 'Camptocamp',
24 'license': 'AGPL-3',
25 'category': 'Finance',
26@@ -179,6 +179,7 @@
27 'init_xml': [],
28 'demo_xml' : [],
29 'update_xml': ['account_view.xml',
30+ 'res_company_view.xml',
31 'data/financial_webkit_header.xml',
32 'report/report.xml',
33 'wizard/wizard.xml',
34
35=== modified file 'account_financial_report_webkit/report/common_partner_reports.py'
36--- account_financial_report_webkit/report/common_partner_reports.py 2013-05-07 06:56:51 +0000
37+++ account_financial_report_webkit/report/common_partner_reports.py 2014-04-17 18:30:38 +0000
38@@ -64,6 +64,9 @@
39
40 :return: browse record of the first special period.
41 """
42+ first_special_period = self.localcontext['company'].first_special_period_id
43+ if first_special_period:
44+ return first_special_period
45 move_line_obj = self.pool.get('account.move.line')
46 first_entry_id = move_line_obj.search(
47 self.cr, self.uid, [], order='date ASC', limit=1)
48
49=== added file 'account_financial_report_webkit/res_company.py'
50--- account_financial_report_webkit/res_company.py 1970-01-01 00:00:00 +0000
51+++ account_financial_report_webkit/res_company.py 2014-04-17 18:30:38 +0000
52@@ -0,0 +1,42 @@
53+# -*- encoding: utf-8 -*-
54+##############################################################################
55+#
56+# OpenERP, Open Source Management Solution
57+#
58+# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
59+#
60+# This program is free software: you can redistribute it and/or modify
61+# it under the terms of the GNU Affero General Public License as
62+# published by the Free Software Foundation, either version 3 of the
63+# License, or (at your option) any later version.
64+#
65+# This program is distributed in the hope that it will be useful,
66+# but WITHOUT ANY WARRANTY; without even the implied warranty of
67+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68+# GNU Affero General Public License for more details.
69+#
70+# You should have received a copy of the GNU Affero General Public License
71+# along with this program. If not, see <http://www.gnu.org/licenses/>.
72+#
73+##############################################################################
74+
75+from openerp.osv import fields, orm
76+
77+class res_company(orm.Model):
78+ _inherit = 'res.company'
79+
80+ def _get_first_special_period(self, cr, uid, context=None):
81+ first_special = self.pool.get('account.period').search(cr, uid,
82+ [('special', '=', True)], order='date_start ASC', limit=1)
83+ return first_special and first_special[0] or False
84+
85+ _columns = {
86+ 'first_special_period_id': fields.many2one('account.period', 'First Special Period',
87+ domain=[('special', '=', True)],
88+ help="When specified, the accounting reports will consider this "
89+ "period as the start period for the calculation of opening balances.")
90+ }
91+
92+ _defaults = {
93+ 'first_special_period_id': _get_first_special_period,
94+ }
95\ No newline at end of file
96
97=== added file 'account_financial_report_webkit/res_company_view.xml'
98--- account_financial_report_webkit/res_company_view.xml 1970-01-01 00:00:00 +0000
99+++ account_financial_report_webkit/res_company_view.xml 2014-04-17 18:30:38 +0000
100@@ -0,0 +1,18 @@
101+<?xml version="1.0" encoding="utf-8"?>
102+<openerp>
103+ <data>
104+
105+ <record id="company_form_inherit" model="ir.ui.view">
106+ <field name="name">company.form.inherit</field>
107+ <field name="model">res.company</field>
108+ <field name="inherit_id" ref="base.view_company_form"/>
109+ <field name="arch" type="xml">
110+ <field name="currency_id" position="after">
111+ <field name="first_special_period_id"/>
112+ </field>
113+ </field>
114+ </record>
115+
116+ </data>
117+</openerp>
118+