Commit 2ad24830 authored by Jérome Perrin's avatar Jérome Perrin

Fix bugs in Balance Sheet and Profit & Loss:

- Profit & Loss was showing negative value for profit or loss on previous period
- Profit & Loss was not showing previous period loss if current period is a profit
- Balance Sheet was not calculating properly net profit for previous period

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32077 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef4f614b
...@@ -83,11 +83,13 @@ dQEAAAAA</string> </value> ...@@ -83,11 +83,13 @@ dQEAAAAA</string> </value>
at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day()).latestTime();\n at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day()).latestTime();\n
date_formatter nocall:here/Base_viewFieldLibrary/my_date/render_pdf;\n date_formatter nocall:here/Base_viewFieldLibrary/my_date/render_pdf;\n
from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n
from_date_previous_period python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date_previous_period);\n
portal_type here/getPortalAccountingMovementTypeList;\n portal_type here/getPortalAccountingMovementTypeList;\n
section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"]);\n section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"]);\n
financial_section python:context.getPortalObject().portal_categories.financial_section;\n financial_section python:context.getPortalObject().portal_categories.financial_section;\n
getInventory python: lambda **kw: context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, portal_type=portal_type, **kw);\n getInventory python: lambda **kw: context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, portal_type=portal_type, **kw);\n
getInventoryIncomeAccount python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n getInventoryIncomeAccount python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n
getInventoryIncomeAccountPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, from_date=from_date_previous_period, portal_type=portal_type, **kw);\n
getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, portal_type=portal_type, **kw);\'\n getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, portal_type=portal_type, **kw);\'\n
office:version=\'1.0\'>\n office:version=\'1.0\'>\n
<office:scripts/>\n <office:scripts/>\n
...@@ -620,7 +622,27 @@ dQEAAAAA</string> </value> ...@@ -620,7 +622,27 @@ dQEAAAAA</string> </value>
table:style-name=\'report-content-currency2\'>\n table:style-name=\'report-content-currency2\'>\n
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block></tal:block>\n </tal:block>\n
\n
<!-- previous period -->\n
<tal:block\n
tal:define=\'value python: -getInventoryPreviousPeriod(node_category=node_category) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
global total_prev_period python: total_prev_period + value;\'>\n
<table:table-cell\n
tal:condition=\'value\'\n
tal:attributes=\'office:value value\'\n
table:style-name=\'report-content-currency2\'\n
office:value=\'123456.56\'\n
office:value-type=\'float\'>\n
<text:p>123 456,56</text:p>\n
</table:table-cell>\n
<table:table-cell\n
tal:condition=\'not:value\'\n
table:style-name=\'report-content-currency2\'>\n
<text:p></text:p>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
\n \n
<tal:block tal:condition=\'python: cat_level_1.getId() != "net_profit"\'>\n <tal:block tal:condition=\'python: cat_level_1.getId() != "net_profit"\'>\n
<tal:block \n <tal:block \n
...@@ -640,7 +662,6 @@ dQEAAAAA</string> </value> ...@@ -640,7 +662,6 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
</tal:block>\n
\n \n
<!-- previous period -->\n <!-- previous period -->\n
<tal:block\n <tal:block\n
...@@ -660,6 +681,9 @@ dQEAAAAA</string> </value> ...@@ -660,6 +681,9 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
\n
</tal:block>\n
\n
</tal:block>\n </tal:block>\n
</table:table-row>\n </table:table-row>\n
<!-- }}} -->\n <!-- }}} -->\n
...@@ -721,7 +745,27 @@ dQEAAAAA</string> </value> ...@@ -721,7 +745,27 @@ dQEAAAAA</string> </value>
table:style-name=\'report-content-currency2\'>\n table:style-name=\'report-content-currency2\'>\n
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block></tal:block>\n </tal:block>\n
\n
<!-- previous period -->\n
<tal:block\n
tal:define=\'value python: -getInventoryPreviousPeriod(node_category=[node_category]) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
global total_prev_period python: total_prev_period + value;\'>\n
<table:table-cell\n
tal:condition=\'value\'\n
tal:attributes=\'office:value value\'\n
table:style-name=\'report-content-currency2\'\n
office:value=\'123456.56\'\n
office:value-type=\'float\'>\n
<text:p>123 456,56</text:p>\n
</table:table-cell>\n
<table:table-cell\n
tal:condition=\'not:value\'\n
table:style-name=\'report-content-currency2\'>\n
<text:p></text:p>\n
</table:table-cell>\n
</tal:block>\n
</tal:block>\n
\n \n
<tal:block tal:condition=\'python: cat_level_2.getId() != "net_profit"\'>\n <tal:block tal:condition=\'python: cat_level_2.getId() != "net_profit"\'>\n
<tal:block \n <tal:block \n
...@@ -741,7 +785,6 @@ dQEAAAAA</string> </value> ...@@ -741,7 +785,6 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
</tal:block>\n
\n \n
<!-- previous period -->\n <!-- previous period -->\n
<tal:block\n <tal:block\n
...@@ -761,6 +804,8 @@ dQEAAAAA</string> </value> ...@@ -761,6 +804,8 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
</tal:block>\n
\n
</table:table-row>\n </table:table-row>\n
\n \n
<!-- }}} -->\n <!-- }}} -->\n
...@@ -797,7 +842,28 @@ dQEAAAAA</string> </value> ...@@ -797,7 +842,28 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
\n
<!-- previous period -->\n
<tal:block\n
tal:define=\'value python: -getInventoryPreviousPeriod(node_category=[node_category]) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
global total_prev_period python: total_prev_period + value;\'>\n
<table:table-cell\n
tal:condition=\'value\'\n
tal:attributes=\'office:value value\'\n
table:style-name=\'report-content-currency3\'\n
office:value=\'123456.56\'\n
office:value-type=\'float\'>\n
<text:p>123 456,56</text:p>\n
</table:table-cell>\n
<table:table-cell\n
tal:condition=\'not:value\'\n
table:style-name=\'report-content-currency3\'>\n
<text:p></text:p>\n
</table:table-cell>\n
</tal:block>\n
\n
</tal:block>\n </tal:block>\n
\n
<tal:block tal:condition=\'python: cat_level_3.getId() != "net_profit"\'>\n <tal:block tal:condition=\'python: cat_level_3.getId() != "net_profit"\'>\n
<tal:block\n <tal:block\n
tal:define=\'value python: -getInventory(node_category=node_category);\n tal:define=\'value python: -getInventory(node_category=node_category);\n
...@@ -835,6 +901,7 @@ dQEAAAAA</string> </value> ...@@ -835,6 +901,7 @@ dQEAAAAA</string> </value>
<text:p></text:p>\n <text:p></text:p>\n
</table:table-cell>\n </table:table-cell>\n
</tal:block>\n </tal:block>\n
\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</table:table-row>\n </table:table-row>\n
......
...@@ -80,7 +80,7 @@ dQEAAAAA</string> </value> ...@@ -80,7 +80,7 @@ dQEAAAAA</string> </value>
xmlns:metal=\'http://xml.zope.org/namespaces/metal\'\n xmlns:metal=\'http://xml.zope.org/namespaces/metal\'\n
tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n
tal:define=\'at_date request/at_date/latestTime;\n tal:define=\'at_date request/at_date/latestTime;\n
at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day().latestTime());\n at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day()).latestTime();\n
from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n
from_date_previous_period python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date_previous_period);\n from_date_previous_period python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date_previous_period);\n
portal_type here/getPortalAccountingMovementTypeList;\n portal_type here/getPortalAccountingMovementTypeList;\n
...@@ -90,7 +90,7 @@ dQEAAAAA</string> </value> ...@@ -90,7 +90,7 @@ dQEAAAAA</string> </value>
getInventory python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n getInventory python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n
getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, from_date=from_date_previous_period, portal_type=portal_type, **kw);\n getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, from_date=from_date_previous_period, portal_type=portal_type, **kw);\n
net_income python:getInventory(node_category=["financial_section/income", "financial_section/expense"]);\n net_income python:getInventory(node_category=["financial_section/income", "financial_section/expense"]);\n
net_income_previous_period python:getInventoryPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"])\'\n net_income_previous_period python:getInventoryPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\'\n
office:version=\'1.0\'>\n office:version=\'1.0\'>\n
<office:scripts/>\n <office:scripts/>\n
<office:font-face-decls>\n <office:font-face-decls>\n
...@@ -486,7 +486,7 @@ dQEAAAAA</string> </value> ...@@ -486,7 +486,7 @@ dQEAAAAA</string> </value>
<!-- }}} -->\n <!-- }}} -->\n
\n \n
<!-- NET PROFIT {{{ -->\n <!-- NET PROFIT {{{ -->\n
<table:table-row tal:condition="python: net_income &lt; 0">\n <table:table-row tal:condition="python: net_income &lt; 0 or net_income_previous_period &lt; 0">\n
<table:table-cell table:style-name=\'report-stat2\'\n <table:table-cell table:style-name=\'report-stat2\'\n
office:value-type=\'string\'\n office:value-type=\'string\'\n
table:number-rows-spanned=\'1\'\n table:number-rows-spanned=\'1\'\n
...@@ -499,8 +499,8 @@ dQEAAAAA</string> </value> ...@@ -499,8 +499,8 @@ dQEAAAAA</string> </value>
tal:define="global grand_total_current_period python: grand_total_current_period - net_income"\n tal:define="global grand_total_current_period python: grand_total_current_period - net_income"\n
office:value-type=\'float\' office:value=\'123456.56\'><text:p>123 456,56</text:p></table:table-cell>\n office:value-type=\'float\' office:value=\'123456.56\'><text:p>123 456,56</text:p></table:table-cell>\n
<table:table-cell table:style-name=\'report-stat-currency2\'\n <table:table-cell table:style-name=\'report-stat-currency2\'\n
tal:attributes="office:value python: net_income_previous_period"\n tal:attributes="office:value python: - net_income_previous_period"\n
tal:define="global grand_total_previous_period python: grand_total_previous_period + net_income_previous_period"\n tal:define="global grand_total_previous_period python: grand_total_previous_period - net_income_previous_period"\n
office:value=\'\' office:value-type=\'float\'><text:p></text:p></table:table-cell>\n office:value=\'\' office:value-type=\'float\'><text:p></text:p></table:table-cell>\n
</table:table-row>\n </table:table-row>\n
\n \n
...@@ -837,7 +837,7 @@ dQEAAAAA</string> </value> ...@@ -837,7 +837,7 @@ dQEAAAAA</string> </value>
<!-- }}} --> \n <!-- }}} --> \n
\n \n
<!-- NET LOSS {{{ -->\n <!-- NET LOSS {{{ -->\n
<table:table-row tal:condition="python: net_income &gt; 0">\n <table:table-row tal:condition="python: net_income &gt; 0 or net_income_previous_period &gt; 0">\n
<table:table-cell table:style-name=\'report-stat2\'\n <table:table-cell table:style-name=\'report-stat2\'\n
office:value-type=\'string\'\n office:value-type=\'string\'\n
table:number-rows-spanned=\'1\'\n table:number-rows-spanned=\'1\'\n
......
1090 1091
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment