Merge lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix into lp:~account-report-core-editor/account-financial-report/7.0

Proposed by Luc De Meyer (Noviat)
Status: Work in progress
Proposed branch: lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix
Merge into: lp:~account-report-core-editor/account-financial-report/7.0
Diff against target: 125 lines (+78/-2)
4 files modified
account_financial_report_webkit/__init__.py (+1/-0)
account_financial_report_webkit/account_period.py (+37/-0)
account_financial_report_webkit/report/common_reports.py (+19/-2)
account_financial_report_webkit/report/general_ledger.py (+21/-0)
To merge this branch: bzr merge lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Yannick Vaucher @ Camptocamp Needs Information
Review via email: mp+193709@code.launchpad.net

Description of the change

General Ledger should include accounting move lines in close & opening periods.

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Is there a bug report about this issue?
If it does can you link it?
If not can you create it?

l.64 + l.81 + l.104 + l.110 + l.114

Just a note about credits, your user name will be in the commit if someone really wants to know who wrote a specific line of code for exemple with bzr blame.

If you want to show you contributed to a module, please only add this in __openerp__.py under Contributors in description. It will even be better for your Company as it will be visible on apps.openerp.com and not only hidden somewhere in the code.

https://doc.openerp.com/contribute/05_developing_modules/#modules-description

Here is an exemple

http://bazaar.launchpad.net/~stock-logistic-core-editors/carriers-deliveries/7.0/view/head:/base_delivery_carrier_label/__openerp__.py

review: Needs Information
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Hello,

As there was no activity on this MP I'll set it as Work in progress.
Feel free to set it back to Need reviews

Cheers

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

There is no bug report since imho the 'Description of Change' is clear : "General Ledger should include accounting move lines in close & opening periods."
Without this fix, you don't get a complete history of all moves in a certain fiscal year.

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 Yannick Vaucher @ Camptocamp
Sent: vrijdag 31 januari 2014 10:48
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix into lp:account-financial-report

Review: Needs Information

Is there a bug report about this issue?
If it does can you link it?
If not can you create it?

l.64 + l.81 + l.104 + l.110 + l.114

Just a note about credits, your user name will be in the commit if someone really wants to know who wrote a specific line of code for exemple with bzr blame.

If you want to show you contributed to a module, please only add this in __openerp__.py under Contributors in description. It will even be better for your Company as it will be visible on apps.openerp.com and not only hidden somewhere in the code.

https://doc.openerp.com/contribute/05_developing_modules/#modules-description

Here is an exemple

http://bazaar.launchpad.net/~stock-logistic-core-editors/carriers-deliveries/7.0/view/head:/base_delivery_carrier_label/__openerp__.py

--
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix/+merge/193709
You are the owner of lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Is this MP related to bug lp:1172779 ?

If yes, the discussion in the merge proposals linked to that bug might be of interest.

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

Stephane,

bug lp:1172779 indeed describes the same problem as the one for which I made the merge proposal.

I think the error description is clear. The patch is only a few lines of code and runs at all our customers hence it is tested and stable.

I hope someone at C2C finds to the time to review and merge so that we stop applying this patch every time we install this module.

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 Stéphane Bidoul (Acsone)
Sent: dinsdag 25 februari 2014 9:28
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix into lp:account-financial-report

Is this MP related to bug lp:1172779 ?

If yes, the discussion in the merge proposals linked to that bug might be of interest.

--
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix/+merge/193709
You are the owner of lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

At the time, there was debate about showing the detail or a summary of opening moves.

https://code.launchpad.net/~sbi/account-financial-report/account-financial-report-bug1172779/+merge/160949/comments/361722

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

I missed that debate but I believe we should show all lines and not the sum (except for the accounts configured as 'centralized').

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 Stéphane Bidoul (Acsone)
Sent: vrijdag 28 februari 2014 19:24
To: <email address hidden>
Subject: Re: [Merge] lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix into lp:account-financial-report

At the time, there was debate about showing the detail or a summary of opening moves.

https://code.launchpad.net/~sbi/account-financial-report/account-financial-report-bug1172779/+merge/160949/comments/361722

--
https://code.launchpad.net/~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix/+merge/193709
You are the owner of lp:~luc-demeyer/account-financial-report/7.0-account_financial_report_webkit-GL-fix.

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

Unmerged revisions

57. By Luc De Meyer

add open/close entries to GL

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 2013-11-03 20:44:40 +0000
@@ -18,6 +18,7 @@
18#18#
19##############################################################################19##############################################################################
20import account20import account
21from . import account_period
21from . import wizard22from . import wizard
22from . import report23from . import report
23from . import account_move_line24from . import account_move_line
24\ No newline at end of file25\ No newline at end of file
2526
=== added file 'account_financial_report_webkit/account_period.py'
--- account_financial_report_webkit/account_period.py 1970-01-01 00:00:00 +0000
+++ account_financial_report_webkit/account_period.py 2013-11-03 20:44:40 +0000
@@ -0,0 +1,37 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5#
6# Copyright (c) 2013 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 orm
24
25class account_period(orm.Model):
26 _inherit = 'account.period'
27
28 def build_ctx_periods(self, cr, uid, period_from_id, period_to_id):
29 """ add close periods """
30 period_ids = super(account_period, self).build_ctx_periods(cr, uid, period_from_id, period_to_id)
31 period_to = self.browse(cr, uid, period_to_id)
32 period_date_stop = period_to.date_stop
33 close_period_ids = self.search(cr, uid, [('date_stop', '=', period_date_stop), ('special', '=', True), ('company_id', '=', period_to.company_id.id)])
34 for p in close_period_ids:
35 if p not in period_ids:
36 period_ids.append(p)
37 return period_ids
038
=== modified file 'account_financial_report_webkit/report/common_reports.py'
--- account_financial_report_webkit/report/common_reports.py 2013-09-12 20:53:27 +0000
+++ account_financial_report_webkit/report/common_reports.py 2013-11-03 20:44:40 +0000
@@ -217,7 +217,15 @@
217217
218 def exclude_opening_periods(self, period_ids):218 def exclude_opening_periods(self, period_ids):
219 period_obj = self.pool.get('account.period')219 period_obj = self.pool.get('account.period')
220 return period_obj.search(self.cr, self.uid, [['special', '=', False], ['id', 'in', period_ids]])220 # FIX by Noviat: close periods should be included
221 self.cr.execute("SELECT p.id " \
222 "FROM account_period p " \
223 "INNER JOIN account_fiscalyear f ON p.fiscalyear_id = f.id " \
224 "WHERE (special = FALSE or (special = TRUE AND p.date_stop = f.date_stop)) " \
225 "AND p.id IN %s", (tuple(period_ids),))
226 period_ids = self.cr.fetchall()
227 period_ids = [x[0] for x in period_ids]
228 return period_ids
221229
222 def get_included_opening_period(self, period):230 def get_included_opening_period(self, period):
223 """Return the opening included in normal period we use the assumption231 """Return the opening included in normal period we use the assumption
@@ -384,7 +392,16 @@
384 if pnl_periods_ids and not opening_period_selected:392 if pnl_periods_ids and not opening_period_selected:
385 res[acc.id] = self._compute_init_balance(acc.id, pnl_periods_ids)393 res[acc.id] = self._compute_init_balance(acc.id, pnl_periods_ids)
386 else:394 else:
387 res[acc.id] = self._compute_init_balance(acc.id, bs_period_ids)395 # FIX by Noviat
396 if not bs_period_ids:
397 res[acc.id] = {
398 'debit': 0.0,
399 'credit': 0.0,
400 'init_balance': 0.0,
401 'init_balance_currency': 0.0,
402 'state': 'computed'}
403 else:
404 res[acc.id] = self._compute_init_balance(acc.id, bs_period_ids)
388 return res405 return res
389406
390 ####################Account move retrieval helper ##########################407 ####################Account move retrieval helper ##########################
391408
=== modified file 'account_financial_report_webkit/report/general_ledger.py'
--- account_financial_report_webkit/report/general_ledger.py 2013-05-08 14:03:48 +0000
+++ account_financial_report_webkit/report/general_ledger.py 2013-11-03 20:44:40 +0000
@@ -207,6 +207,27 @@
207 line['counterparts'] = counter_parts.get(line.get('move_id'), '')207 line['counterparts'] = counter_parts.get(line.get('move_id'), '')
208 return res208 return res
209209
210 def _get_move_ids_from_periods(self, account_id, period_start, period_stop, target_move):
211 """
212 Change by Noviat: override this methods since we want to include the opening entries in the general ledger
213 """
214 move_line_obj = self.pool.get('account.move.line')
215 period_obj = self.pool.get('account.period')
216 periods = period_obj.build_ctx_periods(self.cursor, self.uid, period_start.id, period_stop.id)
217
218 #>>> change Noviat
219 special = period_obj.search(self.cursor, self.uid, [('date_start', '>=', period_start.date_start), ('date_stop', '<=', period_stop.date_stop),
220 ('company_id', '=', period_start.company_id.id), ('special', '=', True)])
221 periods += special
222 #<<< change Noviat
223
224 if not periods:
225 return []
226
227 search = [('period_id', 'in', periods), ('account_id', '=', account_id)]
228 if target_move == 'posted':
229 search += [('move_id.state', '=', 'posted')]
230 return move_line_obj.search(self.cursor, self.uid, search)
210231
211HeaderFooterTextWebKitParser('report.account.account_report_general_ledger_webkit',232HeaderFooterTextWebKitParser('report.account.account_report_general_ledger_webkit',
212 'account.account',233 'account.account',