Commit c413d34b authored by Nicolas Wavrant's avatar Nicolas Wavrant

Adding Ledgers to split and gather Movements

This merge request makes full use of the base category "Ledger" in the Accounting and Project modules of ERP5.

Main modifications are : 
   * Adding the ledger property on every Accounting Transaction Types. It was already on Task Types.
   * Adding a new portal type of portal type for the types quoted above. It allows to define a list a ledgers directly on these types. These ledgers are the one allowed on the documents of each type.
   * New Delivery_init (Python) Script called by every "${}_init" script of the above type, and setting a default ledger at the creation of the documents
   * Adding a ledger field and column in the view defined like "[Entity|Account|...]_viewTransactionList" to only display the transactions belonging to a favorite ledger. The favorite ledgers can be defined in the Accounting Preferences. The list of displayed ledgers is the list of ledgers defined on the accounting portal types. If no ledger is defined, the field doesn't show up.
   * Adding a ledger field in every accounting report, to only generate them with the movements belonging to the ledgers of one's choice.
   * Adding the ledger parameter (and co) to the InventoryAPI to ease the queries on Inventory by ledger. Please note that the stock table now embeds a "ledger_uid" column


/reviewed-on nexedi/erp5!129
parents 6eb4d565 4c2946eb
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Existence Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>ledger</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ledger_existence_constraint</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>message_category_not_set</string> </key>
<value> <string>Ledger must be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Existence Constraint</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: portal.portal_types[here.getPortalType()].getLedgerList([]) != []</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,6 +3,7 @@ from Products.PythonScripts.standard import Object
from ZTUtils import LazyFilter
portal = context.getPortalObject()
portal_categories = portal.portal_categories
request = portal.REQUEST
getInventoryList_ = portal.portal_simulation.getInventoryList
traverse = portal.restrictedTraverse
......@@ -91,6 +92,18 @@ if project:
if mirror_section_category:
inventory_params['mirror_section_category'] = mirror_section_category
if ledger:
if ledger == 'None':
inventory_params['ledger_uid'] = Query(ledger_uid=None)
else:
if not isinstance(ledger, list):
# Allows the generation of reports on different ledgers as the same time
ledger = [ledger]
ledger_value_list = [portal_categories.restrictedTraverse(ledger_category, None)
for ledger_category in ledger]
for ledger_value in ledger_value_list:
inventory_params.setdefault('ledger_uid', []).append(ledger_value.getUid())
# a dictionary (node_relative_url, mirror_section_uid, payment_uid + analytic)
# -> {'debit'=, 'credit'=}
line_per_account = {}
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None, group_analytic=[], mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw</string> </value>
<value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None, ledger=None, group_analytic=[], mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -24,6 +24,7 @@ mirror_section = request.get('mirror_section', None)
payment = request.get('payment', None)
function = request.get('function', None)
funding = request.get('funding', None)
ledger = request.get('ledger', None)
project = request.get('project', None)
simulation_state = request['simulation_state']
hide_analytic = request['hide_analytic']
......@@ -83,6 +84,8 @@ if mirror_section:
params['mirror_section_uid'] = traverse(mirror_section).getUid()
if parent_portal_type:
params['parent_portal_type'] = parent_portal_type
if ledger:
params['ledger'] = ledger
analytic_column_list = ()
if hide_analytic:
......
......@@ -79,6 +79,16 @@ if mirror_section:
mirror_section_uid = portal.restrictedTraverse(mirror_section).getUid()
params['mirror_section_uid'] = mirror_section_uid
ledger = request.get('ledger', None)
if ledger:
if not isinstance(ledger, list):
# Allows the generation of reports on different ledgers as the same time
ledger = [ledger]
ledger_value_list = [cat_tool.restrictedTraverse(ledger_category, None)
for ledger_category in ledger]
for ledger_value in ledger_value_list:
params.setdefault('ledger_uid', []).append(ledger_value.getUid())
default_selection_params = params.copy()
default_selection_params['period_start_date'] = period_start_date
default_selection_params['movement_portal_type'] = portal.getPortalAccountingMovementTypeList()
......
......@@ -20,6 +20,8 @@ if mirror_section_category:
inventory_kw['mirror_section_category'] = mirror_section_category
if mirror_section_uid:
inventory_kw['mirror_section_uid'] = mirror_section_uid
if ledger_uid:
inventory_kw['ledger_uid'] = ledger_uid
if node_category:
# XXX if node category is passed, income or balance accounts are not
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>section_uid, simulation_state, at_date, period_start_date, precision, node_category=None, function_category=None, function_uid=None, funding_category=None, funding_uid=None, project_uid=None, from_date=\'ignored\', mirror_section_category=None, mirror_section_uid=None, **kw</string> </value>
<value> <string>section_uid, simulation_state, at_date, period_start_date, precision, node_category=None, function_category=None, function_uid=None, funding_category=None, funding_uid=None, project_uid=None, ledger_uid=None, from_date=\'ignored\', mirror_section_category=None, mirror_section_uid=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -12,6 +12,7 @@ role_filter_list = request.get('mirror_section_category_list', None)
omit_balanced_accounts = request['omit_balanced_accounts']
from_date = request.get('from_date', None)
project = request.get('project', None)
ledger = request.get('ledger', None)
currency = portal.Base_getCurrencyForSection(request['section_category'])
precision = portal.account_module.getQuantityPrecisionFromResource(currency)
......@@ -46,6 +47,16 @@ if project:
else:
params['project_uid'] = portal.restrictedTraverse(project).getUid()
if ledger:
if not isinstance(ledger, list):
# Allows the generation of reports on different ledgers as the same time
ledger = [ledger]
portal_categories = portal.portal_categories
ledger_value_list = [portal_categories.restrictedTraverse(ledger_category, None)
for ledger_category in ledger]
for ledger_value in ledger_value_list:
params.setdefault('ledger_uid', []).append(ledger_value.getUid())
simulation_tool = portal.portal_simulation
entity_columns = [
......
......@@ -10,6 +10,7 @@ from_date = request.get('from_date', None)
portal_type = request.get('portal_type', None)
function = request.get('function', None)
funding = request.get('funding', None)
ledger = request.get('ledger', None)
project = request.get('project', None)
simulation_state = request['simulation_state']
expand_accounts = request.get('expand_accounts', False)
......@@ -119,6 +120,7 @@ return [ ReportSection(
section_uid=section_uid,
function=function,
funding=funding,
ledger=ledger,
project=project,
portal_type=portal_type,
simulation_state=simulation_state,
......
......@@ -101,6 +101,7 @@
<string>your_payment</string>
<string>your_node</string>
<string>your_portal_type</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
<string>your_report_date</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -112,6 +112,7 @@
<list>
<string>your_simulation_state</string>
<string>your_portal_type</string>
<string>your_ledger</string>
<string>your_export</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -36,10 +36,10 @@
portal_type here/getPortalAccountingMovementTypeList;
section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"], request["section_category_strict"]);
financial_section python:context.getPortalObject().portal_categories.financial_section;
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);
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);
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);
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);'
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, ledger=request.get("ledger", None), **kw);
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, ledger=request.get("ledger", None), **kw);
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, ledger=request.get("ledger", None), **kw);
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, ledger=request.get("ledger", None), **kw);'
office:version='1.0'>
<office:scripts/>
<office:font-face-decls>
......@@ -951,4 +951,4 @@
</office:spreadsheet>
</office:body>
</office:document-content><!-- vim: filetype=xml tw=1000 foldmethod=marker
-->
\ No newline at end of file
-->
......@@ -90,6 +90,7 @@
<value>
<list>
<string>your_simulation_state</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -96,6 +96,7 @@
<string>your_hide_analytic</string>
<string>your_mirror_section_category_list</string>
<string>your_funding</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="MultiListField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Only consider transactions in those ledgers.</string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>preferences/getPreferredAccountingTransactionLedgerList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>context/AccountingTransactionModule_getLedgerItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>context/AccountingTransactionModule_getLedgerItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: preferences.getPreference(\'preferred_textarea_height\', 3)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -101,6 +101,7 @@
<string>your_mirror_section</string>
<string>your_gap_list</string>
<string>your_gap_root</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
<string>your_report_date</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -112,6 +112,7 @@
<list>
<string>your_simulation_state</string>
<string>your_mirror_section_category_list</string>
<string>your_ledger</string>
<string>your_export</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -97,6 +97,7 @@
<string>your_omit_grouping_reference</string>
<string>your_mirror_section_category_list</string>
<string>your_gap_root</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
<string>your_report_date</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -99,6 +99,7 @@
<list>
<string>your_simulation_state</string>
<string>your_mirror_section_category_list</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -36,8 +36,8 @@
date_formatter nocall:here/Base_viewAccountingReport/my_date/render_pdf;
section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"], request["section_category_strict"]);
financial_section python:context.getPortalObject().portal_categories.financial_section;
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);
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);
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, ledger=request.get("ledger", None), **kw);
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, ledger=request.get("ledger", None), **kw);
net_income python:getInventory(node_category=["financial_section/income", "financial_section/expense"]);
net_income_previous_period python:getInventoryPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);'
office:version='1.0'>
......@@ -861,4 +861,4 @@
</office:spreadsheet>
</office:body>
</office:document-content><!-- vim: filetype=xml tw=1000 foldmethod=marker
-->
\ No newline at end of file
-->
......@@ -90,6 +90,7 @@
<value>
<list>
<string>your_simulation_state</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -93,6 +93,7 @@
<string>your_mirror_section_category_list</string>
<string>your_funding</string>
<string>your_report_date</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>enabled</string>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_multi_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>request/ledger | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>request/ledger | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>context/AccountingTransactionModule_getLedgerItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,6 +100,7 @@
<string>your_mirror_section_category_list</string>
<string>your_gap_root</string>
<string>your_portal_type</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
<string>your_report_date</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -107,6 +107,7 @@
<string>your_simulation_state</string>
<string>your_portal_type</string>
<string>your_mirror_section_category_list</string>
<string>your_ledger</string>
<string>your_landscape</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -36,6 +36,8 @@ if project_uid:
inventory_query['project_uid'] = project_uid
if function:
inventory_query['function_category'] = function
if params.get('ledger', None):
inventory_query['ledger'] = params.get('ledger')
if 'parent_portal_type' in params:
portal_type_list = params['parent_portal_type']
......
......@@ -113,6 +113,7 @@
<string>your_account</string>
<string>your_preferred_from_date</string>
<string>your_preferred_at_date</string>
<string>your_preferred_ledger</string>
</list>
</value>
</item>
......
......@@ -124,6 +124,10 @@
<string>quantity</string>
<string>Transaction Currency Balance</string>
</tuple>
<tuple>
<string>ledger_translated_title</string>
<string>Ledger</string>
</tuple>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="MultiListField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_preferred_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>6</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br/>
]]></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: preferences.getPreferredAccountingTransactionLedgerList()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>not: request/is_accounting_report | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [((\'\' if category == \'\' else here.portal_categories.resolveCategory(category).getTranslatedTitle()), category) for category in preferences.getPreferredAccountingTransactionLedgerList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Creates a balance transaction to open the next period.
"""
from Products.ZSQLCatalog.SQLCatalog import Query
portal = context.getPortalObject()
Base_translateString = portal.Base_translateString
......@@ -61,7 +63,9 @@ section_list = [section]
if group_value is not None:
section_list.extend(getDependantSectionList(group_value, section))
def createBalanceTransaction(section):
ledger_list = portal.portal_categories.ledger.getCategoryChildValueList(is_self_excluded=1) + [None,]
def createBalanceTransaction(section, ledger=None):
balance_date = at_date + 1
# We discard hours, minutes and seconds and at the same time, make sure the date
# is in its "normal timezone". For example, when at_date is the day of a dailight saving
......@@ -69,220 +73,247 @@ def createBalanceTransaction(section):
balance_date = DateTime(balance_date.year(), balance_date.month(), balance_date.day())
return portal.accounting_module.newContent(
portal_type='Balance Transaction',
ledger=ledger,
start_date=balance_date,
title=context.getTitle() or Base_translateString('Balance Transaction'),
destination_section_value=section,
resource=section_currency,
causality_value=context)
getInventoryList = portal.portal_simulation.getInventoryList
with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True):
for section in section_list:
section_uid = section.getUid()
balance_transaction = None
# List ledgers on which there are movements
inventory_ledger_uid_list = [inventory.ledger_uid for inventory \
in getInventoryList(at_date=at_date.latestTime(),
portal_type=portal.getPortalAccountingMovementTypeList(),
group_by_ledger=True)]
group_by_node_node_category_list = []
group_by_mirror_section_node_category_list = []
group_by_payment_node_category_list = []
profit_and_loss_node_category_list = []
for ledger in ledger_list:
node_category_list = portal.portal_categories\
.account_type.getCategoryChildValueList()
for node_category in node_category_list:
node_category_url = node_category.getRelativeUrl()
if node_category_url in (
'account_type/asset/cash/bank',):
group_by_payment_node_category_list.append(node_category_url)
elif node_category_url in (
'account_type/asset/receivable',
'account_type/liability/payable'):
group_by_mirror_section_node_category_list.append(node_category_url)
elif node_category.isMemberOf('account_type/income') or \
node_category.isMemberOf('account_type/expense'):
profit_and_loss_node_category_list.append(node_category_url)
else:
group_by_node_node_category_list.append(node_category_url)
# If there are no movements within this ledger, we can
# directly go to another
if ledger is None and None not in inventory_ledger_uid_list:
continue
elif ledger is not None and ledger.getUid() not in inventory_ledger_uid_list:
continue
getInventoryList = portal.portal_simulation.getInventoryList
if ledger is not None:
ledger_uid = ledger.getUid()
ledger_url = ledger.getCategoryRelativeUrl()
else:
ledger_uid = Query(ledger_uid=None)
ledger_url = ''
inventory_param_dict = dict(section_uid=section_uid,
simulation_state=('delivered',),
precision=section_currency_precision,
portal_type=portal.getPortalAccountingMovementTypeList(),
at_date=at_date.latestTime(),)
for section in section_list:
section_uid = section.getUid()
balance_transaction = None
# Calculate the sum of profit and loss accounts balances for that period.
# This must match the difference between assets, liability and equity accounts.
profit_and_loss_accounts_balance = portal.portal_simulation.getInventoryAssetPrice(
from_date=context.getStartDate(),
node_category_strict_membership=profit_and_loss_node_category_list,
**inventory_param_dict)
selected_profit_and_loss_account_balance = portal.portal_simulation.getInventoryAssetPrice(
node=profit_and_loss_account,
resource=section_currency,
**inventory_param_dict)
section_currency_uid = context.getParentValue().getPriceCurrencyUid()
profit_and_loss_quantity = 0
line_count = 0
for inventory in getInventoryList(
node_category_strict_membership=group_by_node_node_category_list,
group_by_node=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
line_count += 1
if inventory.resource_uid != section_currency_uid:
group_by_node_node_category_list = []
group_by_mirror_section_node_category_list = []
group_by_payment_node_category_list = []
profit_and_loss_node_category_list = []
node_category_list = portal.portal_categories\
.account_type.getCategoryChildValueList()
for node_category in node_category_list:
node_category_url = node_category.getRelativeUrl()
if node_category_url in (
'account_type/asset/cash/bank',):
group_by_payment_node_category_list.append(node_category_url)
elif node_category_url in (
'account_type/asset/receivable',
'account_type/liability/payable'):
group_by_mirror_section_node_category_list.append(node_category_url)
elif node_category.isMemberOf('account_type/income') or \
node_category.isMemberOf('account_type/expense'):
profit_and_loss_node_category_list.append(node_category_url)
else:
group_by_node_node_category_list.append(node_category_url)
inventory_param_dict = dict(section_uid=section_uid,
simulation_state=('delivered',),
precision=section_currency_precision,
portal_type=portal.getPortalAccountingMovementTypeList(),
at_date=at_date.latestTime(),
ledger_uid=ledger_uid)
# Calculate the sum of profit and loss accounts balances for that period.
# This must match the difference between assets, liability and equity accounts.
profit_and_loss_accounts_balance = portal.portal_simulation.getInventoryAssetPrice(
from_date=context.getStartDate(),
node_category_strict_membership=profit_and_loss_node_category_list,
**inventory_param_dict)
selected_profit_and_loss_account_balance = portal.portal_simulation.getInventoryAssetPrice(
node=profit_and_loss_account,
resource=section_currency,
**inventory_param_dict)
section_currency_uid = context.getParentValue().getPriceCurrencyUid()
profit_and_loss_quantity = 0
line_count = 0
for inventory in getInventoryList(
node_category_strict_membership=group_by_node_node_category_list,
group_by_node=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
line_count += 1
if inventory.resource_uid != section_currency_uid:
profit_and_loss_quantity += total_price
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
resource=inventory.resource_relative_url,
quantity=quantity,
destination_total_asset_price=total_price)
else:
if total_price != quantity:
# If this fail for you, your accounting doesn't use currencies with
# consistency
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if inventory.node_relative_url != profit_and_loss_account:
profit_and_loss_quantity += total_price
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
quantity=total_price)
for inventory in getInventoryList(
node_category_strict_membership=group_by_mirror_section_node_category_list,
group_by_node=1,
group_by_mirror_section=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
profit_and_loss_quantity += total_price
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction.newContent(
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid,
resource=inventory.resource_relative_url,
quantity=quantity,
destination_total_asset_price=total_price)
else:
if total_price != quantity:
# If this fail for you, your accounting doesn't use currencies with
# consistency
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if inventory.node_relative_url != profit_and_loss_account:
profit_and_loss_quantity += total_price
else:
if total_price != quantity:
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid,
quantity=total_price)
for inventory in getInventoryList(
node_category_strict_membership=group_by_mirror_section_node_category_list,
group_by_node=1,
group_by_mirror_section=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
profit_and_loss_quantity += total_price
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid,
resource=inventory.resource_relative_url,
quantity=quantity,
destination_total_asset_price=total_price)
else:
if total_price != quantity:
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
source_section_uid=inventory.mirror_section_uid,
quantity=total_price)
for inventory in getInventoryList(
node_category_strict_membership=group_by_payment_node_category_list,
group_by_node=1,
group_by_payment=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
for inventory in getInventoryList(
node_category_strict_membership=group_by_payment_node_category_list,
group_by_node=1,
group_by_payment=1,
group_by_resource=1,
**inventory_param_dict):
total_price = roundCurrency(inventory.total_price or 0, section_currency)
quantity = roundCurrency(inventory.total_quantity or 0,
inventory.resource_relative_url)
if not total_price and not quantity:
continue
profit_and_loss_quantity += total_price
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
resource=inventory.resource_relative_url,
quantity=quantity,
destination_payment_uid=inventory.payment_uid,
destination_total_asset_price=total_price)
else:
if total_price != quantity:
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
destination_payment_uid=inventory.payment_uid,
quantity=total_price)
if balance_transaction is None:
# we did not have any transaction for this section
# One possible corner case is that we have only transactions that brings
# the balance of all balance sheets accounts to 0. In this case we want to
# create a balance transaction that notes that the current balance of profit
# and loss account is 0, so that the delta gets indexed.
if profit_and_loss_accounts_balance:
balance_transaction = createBalanceTransaction(section, ledger_url)
balance_transaction.newContent(
portal_type='Balance Transaction Line',
destination=profit_and_loss_account,
quantity=0)
balance_transaction.stop()
balance_transaction.deliver()
continue
profit_and_loss_quantity += total_price
line_count += 1
if inventory.resource_uid != section_currency_uid:
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
resource=inventory.resource_relative_url,
quantity=quantity,
destination_payment_uid=inventory.payment_uid,
destination_total_asset_price=total_price)
else:
if total_price != quantity:
raise ValueError('Different price: %s != %s ' % (
total_price, quantity))
if balance_transaction is None:
balance_transaction = createBalanceTransaction(section)
balance_transaction.newContent(
id='%03d' % line_count,
portal_type='Balance Transaction Line',
destination=inventory.node_relative_url,
destination_payment_uid=inventory.payment_uid,
quantity=total_price)
if balance_transaction is None:
# we did not have any transaction for this section
# One possible corner case is that we have only transactions that brings
# the balance of all balance sheets accounts to 0. In this case we want to
# create a balance transaction that notes that the current balance of profit
# and loss account is 0, so that the delta gets indexed.
if profit_and_loss_accounts_balance:
balance_transaction = createBalanceTransaction(section)
assert roundCurrency(profit_and_loss_accounts_balance, section_currency) == roundCurrency(
- roundCurrency(selected_profit_and_loss_account_balance, section_currency)
- roundCurrency(profit_and_loss_quantity, section_currency), section_currency)
# If profit_and_loss_quantity equals 0 then we are on a
# ledger which no accounting transactions are member of
if profit_and_loss_quantity != 0.:
# add a final line for p&l
balance_transaction.newContent(
portal_type='Balance Transaction Line',
destination=profit_and_loss_account,
quantity=0)
id='%03d' % (line_count + 1),
portal_type='Balance Transaction Line',
destination=profit_and_loss_account,
quantity=-profit_and_loss_quantity)
# and go to delivered state directly (the user is not supposed to edit this document)
balance_transaction.stop()
balance_transaction.deliver()
continue
assert roundCurrency(profit_and_loss_accounts_balance, section_currency) == roundCurrency(
- roundCurrency(selected_profit_and_loss_account_balance, section_currency)
- roundCurrency(profit_and_loss_quantity, section_currency), section_currency)
# add a final line for p&l
balance_transaction.newContent(
id='%03d' % (line_count + 1),
portal_type='Balance Transaction Line',
destination=profit_and_loss_account,
quantity=-profit_and_loss_quantity)
# and go to delivered state directly (the user is not supposed to edit this document)
balance_transaction.stop()
balance_transaction.deliver()
# make sure this Accounting Period has an activity pending during the indexing
# of the balance transaction.
......
......@@ -43,6 +43,17 @@ selection_columns.append(('period_%s' % (idx + 1),
mapping={'day_count': period_list[-1]}))))
editable_columns.append(('period_%s' % (idx + 1), ''))
selection_params = dict(section_category=section_category,
section_category_strict=section_category_strict,
account_type=account_type,
editable_columns=editable_columns,
simulation_state=simulation_state,
period_list=period_list,
at_date=at_date)
ledger = request.get('ledger', None)
if ledger:
selection_params['ledger'] = ledger
return [ReportSection(form_id=(detailed and
'AccountingTransactionModule_viewDetailedAgedBalanceReportSection' or
......@@ -52,10 +63,4 @@ return [ReportSection(form_id=(detailed and
selection_name=(detailed and
'accounting_transaction_module_detailed_aged_balance_selection' or
'accounting_transaction_module_summary_aged_balance_selection'),
selection_params=dict(section_category=section_category,
section_category_strict=section_category_strict,
account_type=account_type,
editable_columns=editable_columns,
simulation_state=simulation_state,
period_list=period_list,
at_date=at_date))]
selection_params=selection_params)]
......@@ -38,6 +38,19 @@ def getSectionTitle(uid):
last_period_id = 'period_%s' % len(period_list)
line_list = []
extra_kw = {}
ledger = kw.get('ledger', None)
if ledger:
if not isinstance(ledger, list):
# Allows the generation of reports on different ledgers as the same time
ledger = [ledger]
portal_categories = portal.portal_categories
ledger_value_list = [portal_categories.restrictedTraverse(ledger_category, None)
for ledger_category in ledger]
for ledger_value in ledger_value_list:
extra_kw.setdefault('ledger_uid', []).append(ledger_value.getUid())
for brain in portal.portal_simulation.getMovementHistoryList(
at_date=at_date,
simulation_state=simulation_state,
......@@ -47,7 +60,8 @@ for brain in portal.portal_simulation.getMovementHistoryList(
grouping_query=grouping_query,
sort_on=(('stock.mirror_section_uid', 'ASC'),
('stock.date', 'ASC'),
('stock.uid', 'ASC'))):
('stock.uid', 'ASC')),
**extra_kw):
movement = brain.getObject()
transaction = movement.getParentValue()
......
......@@ -2,10 +2,13 @@ from Products.ERP5Form.Report import ReportSection
request = container.REQUEST
Base_translateString = container.Base_translateString
portal = context.getPortalObject()
portal_type = request['portal_type']
simulation_state = request['simulation_state']
hide_analytic = request['hide_analytic']
project = request.get('project', None)
ledger = request.get('ledger', None)
at_date = request['at_date'].latestTime()
from_date = request.get('from_date') or at_date.earliestTime()
section_uid = context.Base_getSectionUidListForSectionCategory(
......@@ -38,6 +41,16 @@ if project:
selection_params['project_uid'] = \
context.getPortalObject().restrictedTraverse(project).getUid()
if ledger:
if not isinstance(ledger, list):
# Allows the generation of reports on different ledgers as the same time
ledger = [ledger]
portal_categories = portal.portal_categories
ledger_value_list = [portal_categories.restrictedTraverse(ledger_category, None)
for ledger_category in ledger]
for ledger_value in ledger_value_list:
selection_params.setdefault('ledger_uid', []).append(ledger_value.getUid())
analytic_column_list = ()
if hide_analytic:
selection_params['group_by'] = ( 'explanation_uid',
......
......@@ -19,6 +19,9 @@ if project_uid:
else:
extra_kw['project_uid'] = project_uid
if ledger_uid:
extra_kw['ledger_uid'] = ledger_uid
account_title_cache = {}
def getAccountId(node_relative_url):
if node_relative_url not in account_title_cache:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection, at_date, from_date, portal_type, simulation_state, section_uid, payment_mode=None, payment=None, gap_root=None, group_by=None, analytic_column_list=[], project_uid=None, **kw</string> </value>
<value> <string>selection, at_date, from_date, portal_type, simulation_state, section_uid, payment_mode=None, payment=None, gap_root=None, group_by=None, analytic_column_list=[], project_uid=None, ledger_uid=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""Returns the item list of ledgers defined on Accounting Types
"""
portal = context.getPortalObject()
portal_types = portal.portal_types
accounting_type_list = portal.getPortalAccountingTransactionTypeList()
ledger_set = set()
for accounting_type in accounting_type_list:
try:
new_ledger_list = portal_types[accounting_type].getLedgerValueList([])
ledger_set = ledger_set.union(set(new_ledger_list))
except AttributeError:
# This portal type doesn't inherit from Delivery Type, thus we can pass
continue
if len(ledger_set):
return [[ledger.getTranslatedTitle(), ledger.getRelativeUrl()] for ledger in list(ledger_set)]
return ()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>source=True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingTransactionModule_getLedgerItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -214,6 +214,10 @@
<string>source_title</string>
<string>Sender or Provider</string>
</tuple>
<tuple>
<string>ledger_translated_title</string>
<string>Ledger</string>
</tuple>
</list>
</value>
</item>
......
......@@ -97,6 +97,7 @@
<string>your_at_date</string>
<string>your_currency</string>
<string>your_account_type</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
<string>your_report_date</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -111,6 +111,7 @@
<list>
<string>your_period_list</string>
<string>your_simulation_state</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -91,6 +91,7 @@
<list>
<string>your_simulation_state</string>
<string>your_portal_type</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -98,6 +98,7 @@
<string>your_at_date</string>
<string>your_gap_root</string>
<string>your_portal_type</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -96,6 +96,7 @@
<string>my_title</string>
<string>my_destination_section_title</string>
<string>my_reference</string>
<string>my_ledger</string>
<string>my_resource</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -113,6 +113,7 @@
<string>listbox_source_asset_debit</string>
<string>listbox_function</string>
<string>listbox_funding</string>
<string>my_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.portal_types[here.getPortalType()].getLedger()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\',\'\')] + [(ledger.getTranslatedTitle(), ledger.getCategoryRelativeUrl(base=0)) for ledger in here.portal_types[here.getPortalType()].getLedgerValueList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -97,6 +97,7 @@
<string>my_destination_section</string>
<string>my_destination_reference</string>
<string>my_title</string>
<string>my_ledger</string>
<string>my_resource</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -98,6 +98,12 @@ simulation_state = selection_params.get('simulation_state',
if simulation_state:
params['simulation_state'] = simulation_state
ledger = selection_params.get('ledger_uid', None)
if ledger is None:
portal_categories = context.getPortalObject().portal_categories
params['ledger_uid'] = [portal_categories.resolveCategory(category).getUid()
for category in preference.getPreferredAccountingTransactionLedgerList([])]
portal_type = selection_params.get('movement_portal_type', None)
if portal_type:
params['portal_type'] = portal_type
......
......@@ -97,6 +97,7 @@
<string>my_title</string>
<string>your_preferred_from_date</string>
<string>your_preferred_at_date</string>
<string>your_preferred_ledger</string>
</list>
</value>
</item>
......
......@@ -131,6 +131,10 @@
<string>quantity</string>
<string>Transaction Currency Balance</string>
</tuple>
<tuple>
<string>ledger_translated_title</string>
<string>Ledger</string>
</tuple>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="MultiListField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_preferred_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>6</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br/>
]]></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: preferences.getPreferredAccountingTransactionLedgerList()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>not: request/is_accounting_report | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [((\'\' if category == \'\' else here.portal_categories.resolveCategory(category).getTranslatedTitle()), category) for category in preferences.getPreferredAccountingTransactionLedgerList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -22,8 +22,11 @@ if kw.get('node_uid'):
if kw.get('mirror_section_uid'):
params['mirror_section_uid'] = kw['mirror_section_uid']
category_uid_list = ('payment_uid', 'project_uid', 'funding_uid',
'function_uid', 'payment_request_uid', 'default_aggregate_uid')
if kw.get('ledger', None):
params['ledger'] = kw['ledger']
category_uid_list = ('payment_uid', 'project_uid', 'funding_uid', 'function_uid',
'ledger_uid', 'payment_request_uid', 'default_aggregate_uid')
for category_uid in category_uid_list:
category_uid_value = kw.get(category_uid)
if category_uid_value:
......
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ZSQLCatalog.SQLCatalog import Query, SimpleQuery, ComplexQuery
portal = context.getPortalObject()
params = portal.ERP5Accounting_getParams(selection_name=selection_name)
......@@ -16,7 +16,7 @@ if kw.get('mirror_section_uid'):
params['mirror_section_uid'] = kw['mirror_section_uid']
category_uid_list = ('payment_uid', 'project_uid', 'funding_uid',
'function_uid', 'payment_request_uid')
'ledger_uid', 'function_uid', 'payment_request_uid')
for category_uid in category_uid_list:
category_uid_value = kw.get(category_uid)
if category_uid_value:
......@@ -65,6 +65,9 @@ if not 'parent_portal_type' in params:
# Remove unsupported inventory API parameters
params.pop('detailed_from_date_summary', None)
if kw.get('ledger', None):
params['ledger'] = kw.get('ledger')
period_start_date = params.pop('period_start_date', None)
if period_start_date and params.get('node_uid'):
# find the node for this node_uid
......
......@@ -97,6 +97,7 @@
<string>my_title</string>
<string>my_destination_section_title</string>
<string>my_reference</string>
<string>my_ledger</string>
<string>my_resource</string>
<string>my_payment_mode</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -97,6 +97,7 @@
<string>my_title</string>
<string>my_source_section_title</string>
<string>my_reference</string>
<string>my_ledger</string>
<string>my_resource</string>
<string>my_payment_mode</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -84,6 +84,8 @@
<string>my_preferred_accounting_transaction_source_section</string>
<string>my_preferred_accounting_transaction_currency</string>
<string>my_preferred_accounting_bank_account_display_method</string>
<string>my_preferred_accounting_transaction_gap</string>
<string>my_preferred_account_number_method</string>
</list>
</value>
</item>
......@@ -98,8 +100,7 @@
<value>
<list>
<string>my_preferred_accounting_transaction_simulation_state_list</string>
<string>my_preferred_accounting_transaction_gap</string>
<string>my_preferred_account_number_method</string>
<string>my_preferred_accounting_transaction_ledger_list</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_accounting_transaction_ledger_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,6 +53,10 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -61,6 +65,10 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
......
......@@ -96,6 +96,7 @@
<string>my_title</string>
<string>my_source_section_title</string>
<string>my_reference</string>
<string>my_ledger</string>
<string>my_resource</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -96,6 +96,7 @@
<string>my_title</string>
<string>my_destination_section_title</string>
<string>my_reference</string>
<string>my_ledger</string>
<string>my_resource</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>action_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Actions</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_viewAction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>copy_roles</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Copy Roles</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_viewCopyRoleListDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>delivery_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.1</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delivery View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryType_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_property_sheets</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Property Sheets</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_jumpToPropertySheetList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:portal.Base_checkPermission(\'portal_property_sheets\', \'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>role_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Roles</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_viewRole</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>translation_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>4.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Translations</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_viewTranslation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>update_local_roles</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Update Local Roles</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/updateRoleMapping</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,19 +2,32 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Movement Group" module="erp5.portal_type"/>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/category</string>
<string>collect_order_group/delivery</string>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......@@ -22,28 +35,49 @@
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Movement Group</string> </value>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>resource</string>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/BaseType_view</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -47,7 +47,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Ledger is used to split movements, deliveries, or orders of the same type in different subsets. It will replace the "journal" base category which is less generic</string> </value>
<value> <string>Ledger is used to split movements, deliveries, or orders of the same type in different subsets</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -44,6 +44,10 @@
<portal_type id="Delivery Tool">
<item>Delivery Builder</item>
</portal_type>
<portal_type id="Delivery Type">
<item>Action Information</item>
<item>Role Information</item>
</portal_type>
<portal_type id="Embedded Folder">
<item>Embedded File</item>
</portal_type>
......
......@@ -9,6 +9,9 @@
<portal_type id="Currency Module">
<item>business_application</item>
</portal_type>
<portal_type id="Delivery Type">
<item>ledger</item>
</portal_type>
<portal_type id="Notification Message">
<item>specialise</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Delivery Type is a Base Type which allows its portal type instances to define a list of ledger to which they can belong to.</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple>
<string>type_definition</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery Type</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Delivery Type</string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>DeliveryType</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -35,6 +35,10 @@
<type>Currency Exchange Line</type>
<workflow>currency_exchange_line_interaction_workflow, edit_workflow, reindex_object_interaction_workflow, validation_workflow</workflow>
</chain>
<chain>
<type>Delivery Type</type>
<workflow>base_type_interaction_workflow, dynamic_class_generation_interaction_workflow</workflow>
</chain>
<chain>
<type>Email</type>
<workflow>edit_workflow</workflow>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_ledger_list</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DeliveryType_view</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>PortalType_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Portal Type</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category_list</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledgers</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -24,6 +24,13 @@ Delivery Builder | view_predicate_group
Delivery Builder | view_profile
Delivery Causality Assignment Movement Group | view
Delivery Tool | view
Delivery Type | action_view
Delivery Type | copy_roles
Delivery Type | jump_property_sheets
Delivery Type | role_view
Delivery Type | translation_view
Delivery Type | update_local_roles
Delivery Type | view
Email | change_function
Email | view
Embedded File | download
......
......@@ -29,6 +29,8 @@ Delivery Builder | Title Movement Group
Delivery Builder | Variant Movement Group
Delivery Builder | Variation Property Movement Group
Delivery Tool | Delivery Builder
Delivery Type | Action Information
Delivery Type | Role Information
Embedded Folder | Embedded File
Geographical Area | Geographical Location
Notification Message Module | Notification Message
......
......@@ -2,6 +2,7 @@ Currency Exchange Cell | currency_exchange_type
Currency Exchange Cell | price_currency
Currency Exchange Line | price_currency
Currency Module | business_application
Delivery Type | ledger
Notification Message Module | business_application
Notification Message | specialise
Organisation Module | business_application
......
......@@ -18,6 +18,7 @@ Day Movement Group
Delivery Builder
Delivery Causality Assignment Movement Group
Delivery Tool
Delivery Type
Email
Embedded File
Embedded Folder
......
......@@ -15,6 +15,8 @@ Currency Exchange Line | reindex_object_interaction_workflow
Currency Exchange Line | validation_workflow
Currency | edit_workflow
Currency | validation_workflow
Delivery Type | base_type_interaction_workflow
Delivery Type | dynamic_class_generation_interaction_workflow
Email | edit_workflow
Embedded File | document_conversion_interaction_workflow
Embedded File | edit_workflow
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Generated Delivery Builder" module="erp5.portal_type"/>
<global name="Delivery Builder" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -24,55 +24,16 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>collect_order</string> </key>
<value>
<tuple>
<string>OrderMovementGroup</string>
<string>PathMovementGroup</string>
<string>DateMovementGroup</string>
<string>ResourceMovementGroup</string>
<string>VariantMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>collect_order_list</string> </key>
<value>
<list>
<string>test</string>
<string>test2</string>
</list>
</value>
</item>
<item>
<key> <string>collect_order_list_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>AccountingTransaction_roundDebitCredit</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>delivery_cell_portal_type</string> </key>
<value> <string>Pay Sheet Cell</string> </value>
......@@ -87,23 +48,8 @@
</value>
</item>
<item>
<key> <string>delivery_collect_order</string> </key>
<value>
<tuple>
<string>DateMovementGroup</string>
<string>ResourceMovementGroup</string>
<string>RootAppliedRuleCausalityMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_line_collect_order</string> </key>
<value>
<tuple>
<string>PathMovementGroup</string>
<string>SectionPathMovementGroup</string>
</tuple>
</value>
<key> <string>delivery_creatable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>delivery_line_portal_type</string> </key>
......@@ -133,12 +79,6 @@
<key> <string>portal_type</string> </key>
<value> <string>Delivery Builder</string> </value>
</item>
<item>
<key> <string>resource_portal_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>PaySheetTransaction_selectMovement</string> </value>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Root Applied Rule Causality Movement Group" module="erp5.portal_type"/>
<global name="Parent Explanation Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -22,19 +22,19 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>root_applied_rule_causality_movement_group_on_delivery</string> </value>
<value> <string>parent_explanation_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Root Applied Rule Causality Movement Group</string> </value>
<value> <string>Parent Explanation Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>root_applied_rule_causality_movement_group_on_delivery</string> </value>
<value> <string>parent_explanation_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -24,6 +24,8 @@ if request.get('from_date'):
at_date = DateTime(request['at_date'])
simulation_state = request['simulation_state']
ledger = request.get('ledger', None)
object_list = []
total_price = 0
......@@ -38,7 +40,8 @@ for inventory in portal.portal_simulation.getInventoryList(
from_date=from_date,
at_date=at_date,
group_by_resource=0,
group_by_node=1, ):
group_by_node=1,
ledger=ledger, ):
price = inventory.total_price or 0
total_price += price
movement = inventory.getObject()
......
......@@ -19,6 +19,7 @@ if request.get('from_date'):
at_date = DateTime(request['at_date'])
simulation_state = request['simulation_state']
resource = request['resource']
ledger = request.get('ledger', None)
portal_simulation = context.getPortalObject().portal_simulation
......@@ -31,7 +32,8 @@ employee_params = {
'from_date' : from_date,
'simulation_state' : simulation_state,
'precision' : precision,
'resource' : resource
'resource' : resource,
'ledger' : ledger,
}
employer_params = {
......@@ -43,7 +45,8 @@ employer_params = {
'from_date' : from_date,
'simulation_state' : simulation_state,
'precision' : precision,
'resource' : resource
'resource' : resource,
'ledger' : ledger,
}
if request.get('mirror_section'):
......
......@@ -92,6 +92,7 @@
<string>your_at_date</string>
<string>your_from_date</string>
<string>your_section_category</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -99,6 +99,7 @@
<value>
<list>
<string>your_simulation_state</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -94,6 +94,7 @@
<string>your_mirror_section</string>
<string>your_resource</string>
<string>your_section_category</string>
<string>your_ledger</string>
<string>your_simulation_state</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewReportFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -101,6 +101,7 @@
<value>
<list>
<string>your_simulation_state</string>
<string>your_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>AccountModule_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -114,6 +114,8 @@
<string>Base_viewReportFieldLibrary</string>
<string>your_from_date</string>
<string>your_simulation_state</string>
<string>my_view_mode_category</string>
<string>my_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\',\'\')] + [(ledger.getTranslatedTitle(), ledger.getCategoryRelativeUrl(base=0)) for ledger in here.portal_types[here.getPortalType()].getLedgerValueList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_view_mode_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -103,6 +103,7 @@
<string>my_destination_reference</string>
<string>my_title</string>
<string>my_source_section_title</string>
<string>my_ledger</string>
<string>my_resource</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPayrollFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -91,6 +91,7 @@
<string>my_resource_title</string>
<string>my_variation_category_list</string>
<string>my_specialise_title</string>
<string>my_ledger</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_ledger</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ledger</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\',\'\')] + [(ledger.getTranslatedTitle(), ledger.getCategoryRelativeUrl(base=0)) for ledger in here.portal_types[here.getPortalType()].getLedgerValueList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
......@@ -60,10 +61,20 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -79,6 +90,12 @@
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
......@@ -93,4 +110,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\',\'\')] + [(ledger.getTranslatedTitle(), ledger.getCategoryRelativeUrl(base=0)) for ledger in here.portal_types[here.getPortalType()].getLedgerValueList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -5,7 +5,7 @@ inventory_kw["at_date"] = at_date
inventory_kw["from_date"] = from_date
inventory_kw["quantity"] = "<0"
if ledger:
inventory_kw["parent_ledger_relative_url"] = "ledger/%s" % ledger
inventory_kw["ledger"] = "ledger/%s" % ledger
if multiplier is None:
multiplier = 1
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -51,7 +51,7 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
<value> <string>Delivery Type</string> </value>
</item>
<item>
<key> <string>product</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -56,7 +56,7 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
<value> <string>Delivery Type</string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -65,7 +65,7 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
<value> <string>Delivery Type</string> </value>
</item>
<item>
<key> <string>product</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
<global name="Delivery Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Inventory import Inventory
from Products.ERP5.Document.AccountingTransaction import AccountingTransaction
from Products.ZSQLCatalog.SQLCatalog import Query
import types
......@@ -136,6 +137,10 @@ class BalanceTransaction(AccountingTransaction, Inventory):
getInventoryList = self.getPortalObject()\
.portal_simulation.getInventoryList
section_uid = self.getDestinationSectionUid()
ledger_uid = self.getLedgerUid()
if ledger_uid is None:
ledger_uid = Query(ledger_uid=None)
precision = 2
if section_uid is not None:
accounting_currency = \
......@@ -150,7 +155,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
section_uid=section_uid,
precision=precision,
portal_type=self.getPortalAccountingMovementTypeList(),
simulation_state=('delivered', ))
simulation_state=('delivered', ),
ledger_uid=ledger_uid)
# node
for movement in self._getGroupByNodeMovementList():
......@@ -267,7 +273,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
relative_url=movement.getRelativeUrl(),
quantity=movement.getQuantity(),
total_price=movement\
.getDestinationInventoriatedTotalAssetPrice(), ))
.getDestinationInventoriatedTotalAssetPrice(),
ledger_uid=movement.getLedgerUid(), ))
# mirror section
for movement in self._getGroupByMirrorSectionMovementList():
......@@ -291,7 +298,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
relative_url=movement.getRelativeUrl(),
quantity=movement.getQuantity(),
total_price=movement\
.getDestinationInventoriatedTotalAssetPrice(), ))
.getDestinationInventoriatedTotalAssetPrice(),
ledger_uid=movement.getLedgerUid(), ))
# payment
for movement in self._getGroupByPaymentMovementList():
......@@ -315,7 +323,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
relative_url=movement.getRelativeUrl(),
quantity=movement.getQuantity(),
total_price=movement\
.getDestinationInventoriatedTotalAssetPrice(), ))
.getDestinationInventoriatedTotalAssetPrice(),
ledger_uid=movement.getLedgerUid(), ))
return new_stock
......
......@@ -523,14 +523,14 @@ class SimulationTool(BaseTool):
resource=None, node=None, payment=None,
section=None, mirror_section=None, item=None,
function=None, project=None, funding=None, payment_request=None,
transformed_resource=None,
transformed_resource=None, ledger=None,
# used for tracking
input=0, output=0,
# categories
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
function_category=None, project_category=None, funding_category=None,
payment_request_category=None,
ledger_category=None, payment_request_category=None,
# categories with strict membership
resource_category_strict_membership=None,
node_category_strict_membership=None,
......@@ -540,6 +540,7 @@ class SimulationTool(BaseTool):
function_category_strict_membership=None,
project_category_strict_membership=None,
funding_category_strict_membership=None,
ledger_category_strict_membership=None,
payment_request_category_strict_membership=None,
# simulation_state
strict_simulation_state=0,
......@@ -553,7 +554,8 @@ class SimulationTool(BaseTool):
# uids
resource_uid=None, node_uid=None, section_uid=None, payment_uid=None,
mirror_node_uid=None, mirror_section_uid=None, function_uid=None,
project_uid=None, funding_uid=None, payment_request_uid=None,
project_uid=None, funding_uid=None, ledger_uid=None,
payment_request_uid=None,
# omit input and output
omit_input=0,
omit_output=0,
......@@ -585,6 +587,9 @@ class SimulationTool(BaseTool):
group_by_funding=0,
group_by_funding_category=0,
group_by_funding_category_strict_membership=0,
group_by_ledger=0,
group_by_ledger_category=0,
group_by_ledger_category_strict_membership=0,
group_by_payment_request=0,
group_by_payment_request_category=0,
group_by_payment_request_category_strict_membership=0,
......@@ -653,6 +658,7 @@ class SimulationTool(BaseTool):
column_value_dict.set('payment_uid', payment_uid)
column_value_dict.set('project_uid', project_uid)
column_value_dict.set('funding_uid', funding_uid)
column_value_dict.set('ledger_uid', ledger_uid)
column_value_dict.set('payment_request_uid', payment_request_uid)
column_value_dict.set('function_uid', function_uid)
column_value_dict.set('section_uid', section_uid)
......@@ -665,6 +671,7 @@ class SimulationTool(BaseTool):
column_value_dict.setUIDList('payment_uid', payment)
column_value_dict.setUIDList('project_uid', project)
column_value_dict.setUIDList('funding_uid', funding)
column_value_dict.setUIDList('ledger_uid', ledger)
column_value_dict.setUIDList('payment_request_uid', payment_request)
column_value_dict.setUIDList('function_uid', function)
......@@ -684,6 +691,7 @@ class SimulationTool(BaseTool):
related_key_dict.setUIDList('node_category_uid', node_category)
related_key_dict.setUIDList('project_category_uid', project_category)
related_key_dict.setUIDList('funding_category_uid', funding_category)
related_key_dict.setUIDList('ledger_category_uid', ledger_category)
related_key_dict.setUIDList('payment_request_category_uid', payment_request_category)
related_key_dict.setUIDList('function_category_uid', function_category)
related_key_dict.setUIDList('payment_category_uid', payment_category)
......@@ -699,6 +707,8 @@ class SimulationTool(BaseTool):
project_category_strict_membership)
related_key_dict.setUIDList('funding_category_strict_membership_uid',
funding_category_strict_membership)
related_key_dict.setUIDList('ledger_category_strict_membership_uid',
ledger_category_strict_membership)
related_key_dict.setUIDList('payment_request_category_strict_membership_uid',
payment_request_category_strict_membership)
related_key_dict.setUIDList('function_category_strict_membership_uid',
......@@ -741,6 +751,8 @@ class SimulationTool(BaseTool):
group_by_project = 1
elif value == 'funding_uid':
group_by_funding = 1
elif value == 'ledger_uid':
group_by_ledger = 1
elif value == 'payment_request_uid':
group_by_payment_request = 1
elif value == "function_uid":
......@@ -839,6 +851,8 @@ class SimulationTool(BaseTool):
column_group_by_expression_list.append('project_uid')
if group_by_funding:
column_group_by_expression_list.append('funding_uid')
if group_by_ledger:
column_group_by_expression_list.append('ledger_uid')
if group_by_payment_request:
column_group_by_expression_list.append('payment_request_uid')
if group_by_function:
......@@ -912,6 +926,14 @@ class SimulationTool(BaseTool):
'funding_category_strict_membership_uid')
related_key_select_expression_list.append(
'funding_category_strict_membership_uid')
if group_by_ledger_category:
related_key_group_by_expression_list.append('ledger_category_uid')
related_key_select_expression_list.append('ledger_category_uid')
if group_by_ledger_category_strict_membership:
related_key_group_by_expression_list.append(
'ledger_category_strict_membership_uid')
related_key_select_expression_list.append(
'ledger_category_strict_membership_uid')
if group_by_payment_category:
related_key_group_by_expression_list.append('payment_request_category_uid')
related_key_select_expression_list.append('payment_request_category_uid')
......@@ -1131,7 +1153,7 @@ class SimulationTool(BaseTool):
group_by_node=0, group_by_mirror_node=0,
group_by_section=0, group_by_mirror_section=0,
group_by_payment=0, group_by_project=0, group_by_funding=0,
group_by_function=0,
group_by_ledger=0, group_by_function=0,
group_by_variation=0, group_by_sub_variation=0,
group_by_movement=0, group_by_date=0,
group_by_section_category=0,
......@@ -1158,8 +1180,8 @@ class SimulationTool(BaseTool):
new_group_by_dict = {}
if not ignore_group_by and group_by is None:
if group_by_node or group_by_mirror_node or group_by_section or \
group_by_project or group_by_funding or group_by_function or \
group_by_mirror_section or group_by_payment or \
group_by_project or group_by_funding or group_by_ledger or \
group_by_function or group_by_mirror_section or group_by_payment or \
group_by_sub_variation or group_by_variation or \
group_by_movement or group_by_date or group_by_section_category or\
group_by_section_category_strict_membership:
......
......@@ -48,7 +48,9 @@
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
<tuple>
<string>type_definition</string>
</tuple>
</value>
</item>
<item>
......
......@@ -45,6 +45,7 @@ SELECT
<dtml-var stock_table_id>.function_uid as function_uid,
<dtml-var stock_table_id>.project_uid as project_uid,
<dtml-var stock_table_id>.funding_uid as funding_uid,
<dtml-var stock_table_id>.ledger_uid as ledger_uid,
<dtml-var stock_table_id>.payment_request_uid as payment_request_uid,
catalog.path as path
</dtml-if>
......
......@@ -67,9 +67,15 @@
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<list>
<string>Base Type</string>
<string>type_definition</string>
</list>
</value>
</item>
......@@ -79,6 +85,10 @@
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
......
......@@ -70,9 +70,15 @@
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<list>
<string>Base Type</string>
<string>type_definition</string>
</list>
</value>
</item>
......
......@@ -24,6 +24,7 @@ WHERE
getDestinationFunctionUid[loop_item],
getDestinationProjectUid[loop_item],
getDestinationFundingUid[loop_item],
getLedgerUid[loop_item],
getDestinationPaymentRequestUid[loop_item],
getSourceSectionUid[loop_item],
getSourceUid[loop_item],
......@@ -51,6 +52,7 @@ WHERE
getSourceFunctionUid[loop_item],
getSourceProjectUid[loop_item],
getSourceFundingUid[loop_item],
getLedgerUid[loop_item],
getSourcePaymentRequestUid[loop_item],
getDestinationSectionUid[loop_item],
getDestinationUid[loop_item],
......@@ -84,6 +86,7 @@ REPLACE INTO
`function_uid`,
`project_uid`,
`funding_uid`,
`ledger_uid`,
`payment_request_uid`,
`mirror_section_uid`,
`mirror_node_uid`,
......@@ -114,19 +117,20 @@ VALUES
<dtml-sqlvar expr="row_item[9]" type="int" optional>,
<dtml-sqlvar expr="row_item[10]" type="int" optional>,
<dtml-sqlvar expr="row_item[11]" type="int" optional>,
<dtml-sqlvar expr="row_item[12]" type="int">,
<dtml-sqlvar expr="row_item[13]" type="float" optional>,
<dtml-sqlvar expr="row_item[14]" type="int">,
<dtml-sqlvar expr="row_item[12]" type="int" optional>,
<dtml-sqlvar expr="row_item[13]" type="int">,
<dtml-sqlvar expr="row_item[14]" type="float" optional>,
<dtml-sqlvar expr="row_item[15]" type="int">,
<dtml-sqlvar expr="row_item[16]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[16]" type="int">,
<dtml-sqlvar expr="row_item[17]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[18]" type="float" optional>,
<dtml-sqlvar expr="row_item[19]" type="string" optional>,
<dtml-sqlvar expr="row_item[18]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[19]" type="float" optional>,
<dtml-sqlvar expr="row_item[20]" type="string" optional>,
<dtml-sqlvar expr="row_item[21]" type="string" optional>,
<dtml-sqlvar expr="row_item[22]" type="string" optional>
<dtml-sqlvar expr="row_item[22]" type="string" optional>,
<dtml-sqlvar expr="row_item[23]" type="string" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if>
</dtml-in>
</dtml-if>
</dtml-let>
\ No newline at end of file
</dtml-let>
......@@ -33,6 +33,7 @@ getSourceProjectUid\r\n
getDestinationProjectUid\r\n
getSourceFundingUid\r\n
getDestinationFundingUid\r\n
getLedgerUid\r\n
getSourcePaymentRequestUid\r\n
getDestinationPaymentRequestUid\r\n
getSimulationState\r\n
......
......@@ -12,6 +12,7 @@
getDestinationFunctionUid[loop_item],
getDestinationProjectUid[loop_item],
getDestinationFundingUid[loop_item],
getLedgerUid[loop_item],
getDestinationPaymentRequestUid[loop_item],
getSourceSectionUid[loop_item],
getSourceUid[loop_item],
......@@ -38,6 +39,7 @@
getSourceFunctionUid[loop_item],
getSourceProjectUid[loop_item],
getSourceFundingUid[loop_item],
getLedgerUid[loop_item],
getSourcePaymentRequestUid[loop_item],
getDestinationSectionUid[loop_item],
getDestinationUid[loop_item],
......@@ -73,17 +75,18 @@ VALUES
<dtml-sqlvar expr="row_item[9]" type="int" optional>,
<dtml-sqlvar expr="row_item[10]" type="int" optional>,
<dtml-sqlvar expr="row_item[11]" type="int" optional>,
<dtml-sqlvar expr="row_item[12]" type="int">,
<dtml-sqlvar expr="row_item[13]" type="float" optional>,
<dtml-sqlvar expr="row_item[14]" type="int">,
<dtml-sqlvar expr="row_item[15]" type="int">,
<dtml-sqlvar expr="row_item[16]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[12]" type="int" optional>,
<dtml-sqlvar expr="row_item[13]" type="int">,
<dtml-sqlvar expr="row_item[14]" type="float" optional>,
<dtml-sqlvar expr="row_item[15]" type="int">,
<dtml-sqlvar expr="row_item[16]" type="int">,
<dtml-sqlvar expr="row_item[17]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[18]" type="float" optional>,
<dtml-sqlvar expr="row_item[19]" type="string" optional>,
<dtml-sqlvar expr="row_item[18]" type="datetime" optional>,
<dtml-sqlvar expr="row_item[19]" type="float" optional>,
<dtml-sqlvar expr="row_item[20]" type="string" optional>,
<dtml-sqlvar expr="row_item[21]" type="string" optional>,
<dtml-sqlvar expr="row_item[22]" type="string" optional>
<dtml-sqlvar expr="row_item[22]" type="string" optional>,
<dtml-sqlvar expr="row_item[23]" type="string" optional>
)
<dtml-if sequence-end><dtml-else>,</dtml-if>
</dtml-in>
......
......@@ -29,6 +29,7 @@ getSourceProjectUid\r\n
getDestinationProjectUid\r\n
getSourceFundingUid\r\n
getDestinationFundingUid\r\n
getLedgerUid\r\n
getSourcePaymentRequestUid\r\n
getDestinationPaymentRequestUid\r\n
getSimulationState\r\n
......
......@@ -12,6 +12,7 @@ CREATE TABLE `stock` (
`function_uid` BIGINT UNSIGNED,
`project_uid` BIGINT UNSIGNED,
`funding_uid` BIGINT UNSIGNED,
`ledger_uid` BIGINT UNSIGNED,
`payment_request_uid` BIGINT UNSIGNED,
`mirror_section_uid` BIGINT UNSIGNED,
`mirror_node_uid` BIGINT UNSIGNED,
......
......@@ -14,10 +14,7 @@
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0\r\n
table_1\r\n
RELATED_QUERY_SEPARATOR=" AND "\r\n
query_table="catalog"</string> </value>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -43,7 +40,7 @@ query_table="catalog"</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_parent_ledger</string> </value>
<value> <string>z_related_ledger_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
......
<dtml-var table_0>.base_category_uid = <dtml-var "portal_categories.ledger.getUid()">
AND <dtml-var table_1>.uid = <dtml-var table_0>.category_uid
<dtml-var RELATED_QUERY_SEPARATOR>
<dtml-var table_0>.uid = <dtml-var query_table>.parent_uid
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_ledger_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -17,7 +17,6 @@
<key>parent_description | catalog/description/z_related_parent</key>
<key>parent_float_index | catalog/float_index/z_related_parent</key>
<key>parent_int_index | catalog/int_index/z_related_parent</key>
<key>parent_ledger_relative_url | category,catalog/relative_url/z_related_parent_ledger</key>
<key>parent_portal_type | catalog/portal_type/z_related_parent</key>
<key>parent_reference | catalog/reference/z_related_parent</key>
<key>parent_relative_url | catalog/relative_url/z_related_parent</key>
......@@ -41,6 +40,8 @@
<key>stock_function_category_uid | category/category_uid/z_related_function_uid_from_stock</key>
<key>stock_funding_category_strict_membership_uid | category/category_uid/z_related_strict_membership_funding_uid_from_stock</key>
<key>stock_funding_category_uid | category/category_uid/z_related_funding_uid_from_stock</key>
<key>stock_ledger_category_strict_membership_uid | category/category_uid/z_related_strict_membership_ledger_uid_from_stock</key>
<key>stock_ledger_category_uid | category/category_uid/z_related_ledger_uid_from_stock</key>
<key>stock_mirror_section_category_strict_membership_uid | category/category_uid/z_related_strict_membership_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_category_uid | category/category_uid/z_related_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_title | catalog/title/z_related_mirror_section_uid_from_stock</key>
......
......@@ -86,12 +86,12 @@ erp5_mysql_innodb/z_related_explanation_translated_portal_type_from_stock
erp5_mysql_innodb/z_related_function_uid_from_stock
erp5_mysql_innodb/z_related_funding_uid_from_stock
erp5_mysql_innodb/z_related_grand_parent
erp5_mysql_innodb/z_related_ledger_uid_from_stock
erp5_mysql_innodb/z_related_metric_type
erp5_mysql_innodb/z_related_mirror_section_uid_from_stock
erp5_mysql_innodb/z_related_node_uid_from_item
erp5_mysql_innodb/z_related_node_uid_from_stock
erp5_mysql_innodb/z_related_parent
erp5_mysql_innodb/z_related_parent_ledger
erp5_mysql_innodb/z_related_parent_specialise
erp5_mysql_innodb/z_related_parent_strict_group
erp5_mysql_innodb/z_related_payment_request_uid_from_stock
......@@ -106,6 +106,7 @@ erp5_mysql_innodb/z_related_section_uid_from_item
erp5_mysql_innodb/z_related_section_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_function_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_funding_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_ledger_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_mirror_section_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_node_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_payment_request_uid_from_stock
......
......@@ -60,12 +60,13 @@ parent_specialise_reference | category,catalog/reference/z_related_parent_specia
predicate_category_base_category_uid | predicate_category/base_category_uid/z_related_predicate_category
predicate_category_category_strict_membership | predicate_category/category_strict_membership/z_related_predicate_category
predicate_category_category_uid | predicate_category/category_uid/z_related_predicate_category
parent_ledger_relative_url | category,catalog/relative_url/z_related_parent_ledger
child_aggregate_relative_url | catalog,category,catalog/relative_url/z_related_child_aggregate
children_reference | catalog/reference/z_related_children
related_resource_from_use_category_uid | category,category/category_uid/z_related_resource_from_use
stock_funding_category_strict_membership_uid | category/category_uid/z_related_strict_membership_funding_uid_from_stock
stock_funding_category_uid | category/category_uid/z_related_funding_uid_from_stock
stock_ledger_category_strict_membership_uid | category/category_uid/z_related_strict_membership_ledger_uid_from_stock
stock_ledger_category_uid | category/category_uid/z_related_ledger_uid_from_stock
stock_payment_request_category_strict_membership_uid | category/category_uid/z_related_strict_membership_payment_request_uid_from_stock
stock_payment_request_category_uid | category/category_uid/z_related_payment_request_uid_from_stock
stock_explanation_portal_type | catalog/portal_type/z_related_explanation_from_stock
......
......@@ -2,49 +2,58 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/delivery</string>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<key> <string>categories</string> </key>
<value>
<none/>
<tuple>
<string>elementary_type/tokens</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The preferred ledger</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
<value> <string>preferred_accounting_transaction_ledger_property</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
<key> <string>mode</string> </key>
<value> <string>w</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
<key> <string>property_default</string> </key>
<value> <string>python: []</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Existence Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>ledger</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Ledger must be defined</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ledger_existence_constraint</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>message_category_not_set</string> </key>
<value> <string>Ledger must be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Existence Constraint</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: portal.portal_types[here.getPortalType()].getLedgerList([]) != []</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -42,6 +42,8 @@ from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Form.PreferenceTool import Priority
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
SOURCE = 'source'
DESTINATION = 'destination'
RUN_ALL_TESTS = 1
......@@ -1167,6 +1169,356 @@ class TestClosingPeriod(AccountingTestCase):
self.assertEqual(None, pl_movement.getSourceTotalAssetPrice())
self.assertEqual(200., pl_movement.getDestinationCredit())
@UnrestrictedMethod
def setUpLedger(self):
# Create Ledger Categories
ledger_category = self.portal.portal_categories.ledger
ledger_accounting_category = ledger_category.get('accounting', None)
if ledger_accounting_category is None:
ledger_accounting_category = ledger_category.newContent(portal_type='Category', id='accounting')
if ledger_accounting_category.get('general', None) is None:
ledger_accounting_category.newContent(portal_type='Category', id='general')
if ledger_accounting_category.get('detailed', None) is None:
ledger_accounting_category.newContent(portal_type='Category', id='detailed')
if ledger_accounting_category.get('other', None) is None:
ledger_accounting_category.newContent(portal_type='Category', id='other')
# Allow some ledgers on the 'Sale Invoice Transaction' portal type
self.portal.portal_types['Sale Invoice Transaction'].edit(
ledger=['accounting/general', 'accounting/detailed'])
def test_createBalanceOnLedgerWithTransactionsWithNoLedger(self):
self.setUpLedger()
organisation_module = self.organisation_module
period = self.section.newContent(portal_type='Accounting Period')
period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31))
pl = self.portal.account_module.newContent(
portal_type='Account',
account_type='equity')
# 2 Transactions for clients 1 and 2 on ledger accounting/general
transaction1 = self._makeOne(
start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction',
ledger='accounting/general',
destination_section_value=organisation_module.client_1,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=100),
dict(source_value=self.account_module.receivable,
source_credit=100)))
transaction2 = self._makeOne(
start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction',
ledger='accounting/general',
destination_section_value=organisation_module.client_2,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=200),
dict(source_value=self.account_module.receivable,
source_credit=200)))
# 2 Transactions for clients 1 and 2 on ledger accounting/detailed
transaction3 = self._makeOne(
start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction',
ledger='accounting/detailed',
destination_section_value=organisation_module.client_1,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=400),
dict(source_value=self.account_module.receivable,
source_credit=400)))
transaction4 = self._makeOne(
start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction',
ledger='accounting/detailed',
destination_section_value=organisation_module.client_2,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=800),
dict(source_value=self.account_module.receivable,
source_credit=800)))
# 2 Transactions for clients 1 and 2 with no ledger
transaction5 = self._makeOne(
start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction',
ledger='',
destination_section_value=organisation_module.client_1,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=1600),
dict(source_value=self.account_module.receivable,
source_credit=1600)))
transaction6 = self._makeOne(
start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction',
ledger='',
destination_section_value=organisation_module.client_2,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=3200),
dict(source_value=self.account_module.receivable,
source_credit=3200)))
period.AccountingPeriod_createBalanceTransaction(
profit_and_loss_account=pl.getRelativeUrl())
accounting_transaction_list = self.accounting_module.contentValues()
self.assertEqual(9, len(accounting_transaction_list))
balance_transaction_list = self.accounting_module.contentValues(
portal_type='Balance Transaction')
self.assertEqual(3, len(balance_transaction_list))
# 1st balance has 3 lines : # 2nd balance has 3 lines :
# on ledger/accounting/general # on ledger/accounting/detailed
# pl = 300 D # pl = 1200 D
# receivable/client1 = 200 C # receivable/client1 = 800 C
# receivable/client2 = 100 C # receivable/client2 = 400 C
# 3rd balance has 3 lines :
# on no ledger
# pl = 4800 D
# receivable/client1 = 3200 C
# receivable/client2 = 1600 C
result_mapping = {}
result_mapping['accounting/general'] = {'client1': 100., 'client2': 200., 'pl': 300.}
result_mapping['accounting/detailed'] = {'client1': 400., 'client2': 800., 'pl': 1200.}
result_mapping[None] = {'client1': 1600., 'client2': 3200., 'pl': 4800.}
for balance_transaction in balance_transaction_list:
self.assertEqual(self.section,
balance_transaction.getDestinationSectionValue())
self.assertEqual(None, balance_transaction.getSourceSection())
self.assertEqual(DateTime(2007, 1, 1),
balance_transaction.getStartDate())
self.assertEqual('currency_module/euro',
balance_transaction.getResource())
self.assertEqual('delivered', balance_transaction.getSimulationState())
movement_list = balance_transaction.getMovementList()
self.assertEqual(3, len(movement_list))
current_ledger = balance_transaction.getLedger()
assert current_ledger in (None, 'accounting/general', 'accounting/detailed')
result = result_mapping[current_ledger]
client1_movement_list = [m for m in movement_list
if m.getSourceSectionValue() == organisation_module.client_1]
self.assertEqual(1, len(client1_movement_list))
client1_movement = client1_movement_list[0]
self.assertEqual([], client1_movement.getValueList('resource'))
self.assertEqual([], client1_movement.getValueList('destination_section'))
self.assertEqual(None, client1_movement.getSource())
self.assertEqual(self.account_module.receivable,
client1_movement.getDestinationValue())
self.assertEqual(organisation_module.client_1,
client1_movement.getSourceSectionValue())
self.assertEqual(None, client1_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, client1_movement.getSourceTotalAssetPrice())
self.assertEqual(result['client1'], client1_movement.getDestinationCredit())
client2_movement_list = [m for m in movement_list
if m.getSourceSectionValue() == organisation_module.client_2]
self.assertEqual(1, len(client2_movement_list))
client2_movement = client2_movement_list[0]
self.assertEqual([], client2_movement.getValueList('resource'))
self.assertEqual([], client2_movement.getValueList('destination_section'))
self.assertEqual(None, client2_movement.getSource())
self.assertEqual(self.account_module.receivable,
client2_movement.getDestinationValue())
self.assertEqual(organisation_module.client_2,
client2_movement.getSourceSectionValue())
self.assertEqual(None, client2_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, client2_movement.getSourceTotalAssetPrice())
self.assertEqual(result['client2'], client2_movement.getDestinationCredit())
pl_movement_list = [m for m in movement_list
if m.getDestinationValue() == pl]
self.assertEqual(1, len(pl_movement_list))
pl_movement = pl_movement_list[0]
self.assertEqual([], pl_movement.getValueList('resource'))
self.assertEqual(None, pl_movement.getSource())
self.assertEqual(pl,
pl_movement.getDestinationValue())
self.assertEqual(None,
pl_movement.getSourceSection())
self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, pl_movement.getSourceTotalAssetPrice())
self.assertEqual(result['pl'], pl_movement.getDestinationDebit())
self.tic()
def test_createBalanceOnLedgerWithAllTransactionsWithLedger(self):
self.setUpLedger()
organisation_module = self.organisation_module
period = self.section.newContent(portal_type='Accounting Period')
period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31))
pl = self.portal.account_module.newContent(
portal_type='Account',
account_type='equity')
# 2 Transactions for clients 1 and 2 on ledger accounting/general
transaction1 = self._makeOne(
start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction',
ledger='accounting/general',
destination_section_value=organisation_module.client_1,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=100),
dict(source_value=self.account_module.receivable,
source_credit=100)))
transaction2 = self._makeOne(
start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction',
ledger='accounting/general',
destination_section_value=organisation_module.client_2,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=200),
dict(source_value=self.account_module.receivable,
source_credit=200)))
# 2 Transactions for clients 1 and 2 on ledger accounting/detailed
transaction3 = self._makeOne(
start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction',
ledger='accounting/detailed',
destination_section_value=organisation_module.client_1,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=400),
dict(source_value=self.account_module.receivable,
source_credit=400)))
transaction4 = self._makeOne(
start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction',
ledger='accounting/detailed',
destination_section_value=organisation_module.client_2,
simulation_state='delivered',
lines=(dict(source_value=self.account_module.goods_sales,
source_debit=800),
dict(source_value=self.account_module.receivable,
source_credit=800)))
period.AccountingPeriod_createBalanceTransaction(
profit_and_loss_account=pl.getRelativeUrl())
accounting_transaction_list = self.accounting_module.contentValues()
self.assertEqual(6, len(accounting_transaction_list))
balance_transaction_list = self.accounting_module.contentValues(
portal_type='Balance Transaction')
self.assertEqual(2, len(balance_transaction_list))
# 1st balance has 3 lines : # 2nd balance has 3 lines :
# on ledger/accounting/general # on ledger/accounting/detailed
# pl = 300 D # pl = 1200 D
# receivable/client1 = 200 C # receivable/client1 = 800 C
# receivable/client2 = 100 C # receivable/client2 = 400 C
result_mapping = {}
result_mapping['accounting/general'] = {'client1': 100., 'client2': 200., 'pl': 300.}
result_mapping['accounting/detailed'] = {'client1': 400., 'client2': 800., 'pl': 1200.}
for balance_transaction in balance_transaction_list:
self.assertEqual(self.section,
balance_transaction.getDestinationSectionValue())
self.assertEqual(None, balance_transaction.getSourceSection())
self.assertEqual(DateTime(2007, 1, 1),
balance_transaction.getStartDate())
self.assertEqual('currency_module/euro',
balance_transaction.getResource())
self.assertEqual('delivered', balance_transaction.getSimulationState())
movement_list = balance_transaction.getMovementList()
self.assertEqual(3, len(movement_list))
current_ledger = balance_transaction.getLedger()
assert current_ledger in ('accounting/general', 'accounting/detailed')
result = result_mapping[current_ledger]
client1_movement_list = [m for m in movement_list
if m.getSourceSectionValue() == organisation_module.client_1]
self.assertEqual(1, len(client1_movement_list))
client1_movement = client1_movement_list[0]
self.assertEqual([], client1_movement.getValueList('resource'))
self.assertEqual([], client1_movement.getValueList('destination_section'))
self.assertEqual(None, client1_movement.getSource())
self.assertEqual(self.account_module.receivable,
client1_movement.getDestinationValue())
self.assertEqual(organisation_module.client_1,
client1_movement.getSourceSectionValue())
self.assertEqual(None, client1_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, client1_movement.getSourceTotalAssetPrice())
self.assertEqual(result['client1'], client1_movement.getDestinationCredit())
client2_movement_list = [m for m in movement_list
if m.getSourceSectionValue() == organisation_module.client_2]
self.assertEqual(1, len(client2_movement_list))
client2_movement = client2_movement_list[0]
self.assertEqual([], client2_movement.getValueList('resource'))
self.assertEqual([], client2_movement.getValueList('destination_section'))
self.assertEqual(None, client2_movement.getSource())
self.assertEqual(self.account_module.receivable,
client2_movement.getDestinationValue())
self.assertEqual(organisation_module.client_2,
client2_movement.getSourceSectionValue())
self.assertEqual(None, client2_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, client2_movement.getSourceTotalAssetPrice())
self.assertEqual(result['client2'], client2_movement.getDestinationCredit())
pl_movement_list = [m for m in movement_list
if m.getDestinationValue() == pl]
self.assertEqual(1, len(pl_movement_list))
pl_movement = pl_movement_list[0]
self.assertEqual([], pl_movement.getValueList('resource'))
self.assertEqual(None, pl_movement.getSource())
self.assertEqual(pl,
pl_movement.getDestinationValue())
self.assertEqual(None,
pl_movement.getSourceSection())
self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice())
self.assertEqual(None, pl_movement.getSourceTotalAssetPrice())
self.assertEqual(result['pl'], pl_movement.getDestinationDebit())
self.tic()
def testStockTableContent():
q = self.portal.erp5_sql_connection.manage_test
self.assertEqual(2, q(
"SELECT count(*) FROM stock WHERE portal_type="
"'Balance Transaction Line'")[0][0])
self.assertEqual(300, q(
"SELECT sum(total_price) FROM stock WHERE portal_type="
"'Balance Transaction Line' AND ledger_uid="
"%s GROUP BY ledger_uid" %
self.portal.portal_categories.ledger.accounting.general.getUid())[0][0])
self.assertEqual(300, q(
"SELECT sum(quantity) FROM stock WHERE portal_type="
"'Balance Transaction Line' AND ledger_uid="
"%s GROUP BY ledger_uid" %
self.portal.portal_categories.ledger.accounting.general.getUid())[0][0])
self.assertEqual(1200, q(
"SELECT sum(total_price) FROM stock WHERE portal_type="
"'Balance Transaction Line' AND ledger_uid="
"%s GROUP BY ledger_uid" % self.portal.portal_categories.ledger.accounting.detailed.getUid())[0][0])
self.assertEqual(1200, q(
"SELECT sum(quantity) FROM stock WHERE portal_type="
"'Balance Transaction Line' AND ledger_uid="
"%s GROUP BY ledger_uid" % self.portal.portal_categories.ledger.accounting.detailed.getUid())[0][0])
# now check content of stock table
testStockTableContent()
balance_transaction.immediateReindexObject()
self.tic()
testStockTableContent()
def test_createBalanceOnMirrorSectionMultiCurrency(self):
pl = self.portal.account_module.newContent(
......
......@@ -527,6 +527,39 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=500, credit=500)
def testJournalLedger(self):
self.createLedgerDataSet()
request_form = self.portal.REQUEST.form
request_form['at_date'] = DateTime(2006, 2, 2)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['portal_type'] = ['Sale Invoice Transaction']
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
request_form['hide_analytic'] = True
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewJournalReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0],
node_title='41',
mirror_section_title='Client 1',
debit=500,
credit=0)
self.checkLineProperties(data_line_list[1],
node_title='7',
debit=0,
credit=500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=500, credit=500)
def createAccountStatementDataSet(self, use_two_bank_accounts=1):
"""Create transactions for Account statement report.
......@@ -798,6 +831,53 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.goods_sales,
source_credit=300.0)))
@UnrestrictedMethod
def createLedgerCategory(self):
ledger = self.portal.portal_categories.ledger
self.accounting_ledger = ledger.get('accounting', None)
if self.accounting_ledger is None:
self.accounting_ledger = ledger.newContent(portal_type='Category',
id='accounting')
if self.accounting_ledger.get('general', None) is None:
self.accounting_ledger.newContent(portal_type='Category', id='general')
if self.accounting_ledger.get('detailed', None) is None:
self.accounting_ledger.newContent(portal_type='Category', id='detailed')
def createLedgerDataSet(self):
# create some ledgers
self.createLedgerCategory()
account_module = self.portal.account_module
self._makeOne(
portal_type='Sale Invoice Transaction',
title='Ledger detailed',
reference='lad',
simulation_state='delivered',
destination_section_value=self.organisation_module.client_1,
ledger='accounting/detailed',
start_date=DateTime(2006, 2, 2),
lines=(dict(source_value=account_module.receivable,
source_debit=300.0),
dict(source_value=account_module.goods_sales,
source_credit=300.0),
dict(source_value=account_module.receivable,
source_debit=200.0),
dict(source_value=account_module.goods_sales,
source_credit=200.0)))
self._makeOne(
portal_type='Sale Invoice Transaction',
title='Ledger general',
reference='lag',
simulation_state='delivered',
destination_section_value=self.organisation_module.client_1,
ledger='accounting/general',
start_date=DateTime(2006, 2, 2),
lines=(dict(source_value=account_module.receivable,
source_debit=500.0),
dict(source_value=account_module.goods_sales,
source_credit=500.0)))
def test_Resource_zGetMovementHistoryList(self):
# Check if Resource_zGetMovementHistoryList works fine with derived_merge optimizer.
# see https://bugs.launchpad.net/maria/+bug/985828
......@@ -2152,6 +2232,39 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0)
def testAccountStatementLedger(self):
# test account statement on a ledger
self.createLedgerDataSet()
request_form = self.portal.REQUEST.form
request_form['node'] = \
self.portal.account_module.receivable.getRelativeUrl()
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewAccountStatementReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0],
Movement_getExplanationTitleAndAnalytics=
'Ledger general\nlag',
date=DateTime(2006, 2, 2),
debit_price=500, credit_price=0, running_total_price=500, )
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0)
def testTrialBalance(self):
# Simple test of trial balance
# we will use the same data set as account statement
......@@ -3569,6 +3682,157 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
credit=300, final_debit_balance=300, final_credit_balance=300,
final_balance_if_debit=300, final_balance_if_credit=300)
def testTrialBalanceLedger(self):
# trial balance restricted to a ledger
self.createLedgerDataSet()
# set request variables and render
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['stopped', 'delivered']
request_form['show_empty_accounts'] = 0
request_form['expand_accounts'] = 0
request_form['per_account_class_summary'] = 0
request_form['portal_type'] = ['Sale Invoice Transaction']
request_form['group_analytic'] = []
request_form['show_detailed_balance_columns'] = 1
# only get transactions belonging to ledger.accounting.general
request_form['ledger'] = 'ledger/accounting/general'
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewTrialBalanceReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], node_id='41',
node_title='Receivable', initial_debit_balance=0,
initial_credit_balance=0, debit=500, credit=0,
final_debit_balance=500, final_credit_balance=0,
final_balance_if_debit=500, final_balance_if_credit=0,)
self.checkLineProperties(data_line_list[1], node_id='7',
node_title='Goods Sales', initial_debit_balance=0,
initial_credit_balance=0, debit=0, credit=500, final_debit_balance=0,
final_credit_balance=500, final_balance_if_debit=0,
final_balance_if_credit=500,)
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], node_id=None, node_title=None,
initial_debit_balance=0, initial_credit_balance=0, debit=500,
credit=500, final_debit_balance=500, final_credit_balance=500,
final_balance_if_debit=500, final_balance_if_credit=500)
def testTrialBalanceWithMultipleLedger(self):
# trial balance restricted to a ledger
self.createLedgerDataSet()
# get a report on both ledgers
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['stopped', 'delivered']
request_form['show_empty_accounts'] = 0
request_form['expand_accounts'] = 0
request_form['per_account_class_summary'] = 0
request_form['portal_type'] = ['Sale Invoice Transaction']
request_form['group_analytic'] = []
request_form['show_detailed_balance_columns'] = 1
request_form['ledger'] = ['ledger/accounting/general',
'ledger/accounting/detailed']
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewTrialBalanceReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], node_id='41',
node_title='Receivable', initial_debit_balance=0,
initial_credit_balance=0, debit=1000, credit=0,
final_debit_balance=1000, final_credit_balance=0,
final_balance_if_debit=1000, final_balance_if_credit=0,)
self.checkLineProperties(data_line_list[1], node_id='7',
node_title='Goods Sales', initial_debit_balance=0,
initial_credit_balance=0, debit=0, credit=1000, final_debit_balance=0,
final_credit_balance=1000, final_balance_if_debit=0,
final_balance_if_credit=1000,)
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], node_id=None, node_title=None,
initial_debit_balance=0, initial_credit_balance=0, debit=1000,
credit=1000, final_debit_balance=1000, final_credit_balance=1000,
final_balance_if_debit=1000, final_balance_if_credit=1000)
def testTrialBalanceNoLedger(self):
# trial balance with no filter on ledger
# it is expected to return a report on all movements
self.createLedgerDataSet()
# Document with no ledger
self._makeOne(
portal_type='Sale Invoice Transaction',
title='Ledger general',
reference='noledger',
simulation_state='delivered',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 2),
lines=(dict(source_value=self.portal.account_module.receivable,
source_debit=400.0),
dict(source_value=self.portal.account_module.goods_sales,
source_credit=400.0)))
# set request variables and render
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['stopped', 'delivered']
request_form['ledger'] = 'None'
request_form['show_empty_accounts'] = 0
request_form['expand_accounts'] = 0
request_form['per_account_class_summary'] = 0
request_form['portal_type'] = ['Sale Invoice Transaction']
request_form['group_analytic'] = []
request_form['show_detailed_balance_columns'] = 1
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewTrialBalanceReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], node_id='41',
node_title='Receivable', initial_debit_balance=0,
initial_credit_balance=0, debit=400, credit=0,
final_debit_balance=400, final_credit_balance=0,
final_balance_if_debit=400, final_balance_if_credit=0,)
self.checkLineProperties(data_line_list[1], node_id='7',
node_title='Goods Sales', initial_debit_balance=0,
initial_credit_balance=0, debit=0, credit=400, final_debit_balance=0,
final_credit_balance=400, final_balance_if_debit=0,
final_balance_if_credit=400,)
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], node_id=None, node_title=None,
initial_debit_balance=0, initial_credit_balance=0, debit=400,
credit=400, final_debit_balance=400, final_credit_balance=400,
final_balance_if_debit=400, final_balance_if_credit=400)
def testGeneralLedger(self):
# Simple test of general ledger
......@@ -3950,6 +4214,50 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], debit_price=500, credit_price=500)
def testGeneralLedgerLedger(self):
# general ledger restricted to a ledger
self.createLedgerDataSet()
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewGeneralLedgerReport')
self.assertEqual(3, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0],
Movement_getExplanationTitleAndAnalytics='Ledger general\nlag',
date=DateTime(2006, 2, 2),
debit_price=500, credit_price=0, running_total_price=500, )
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0)
line_list = self.getListBoxLineList(report_section_list[1])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0],
Movement_getExplanationTitleAndAnalytics='Ledger general\nlag',
date=DateTime(2006, 2, 2),
debit_price=0, credit_price=500, running_total_price=-500, )
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500)
line_list = self.getListBoxLineList(report_section_list[2])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], debit_price=500, credit_price=500)
def testGeneralLedgerMirrorSectionRole(self):
# general ledger restricted to a mirror section role
self.createMirrorSectionRoleDataSet()
......@@ -4113,7 +4421,101 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
credit_price=0,
debit_price=300,)
def createAgedBalanceDataSet(self):
def testOtherPartiesReportLedger(self):
# Other parties report with a filter on ledger
# This tests works because /for the moment/ any transaction between 2
# entities belong to the same ledger
self.createLedgerCategory()
account_module = self.portal.account_module
t1 = self._makeOne(
portal_type='Accounting Transaction',
title='Transaction 1',
source_reference='1',
simulation_state='delivered',
ledger='accounting/general',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 1),
lines=(dict(source_value=account_module.receivable,
source_debit=100.0),
dict(source_value=account_module.goods_sales,
source_credit=100.0)))
t2 = self._makeOne(
portal_type='Accounting Transaction',
title='Transaction 2',
source_reference='2',
simulation_state='delivered',
ledger='accounting/general',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 1, 0, 1),
lines=(dict(source_value=account_module.payable,
source_debit=200.0),
dict(source_value=account_module.goods_sales,
source_credit=200.0)))
t3 = self._makeOne(
portal_type='Accounting Transaction',
title='Transaction 3',
source_reference='3',
simulation_state='delivered',
ledger='accounting/detailed',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 1, 0, 2),
lines=(dict(source_value=account_module.payable,
source_debit=400.0),
dict(source_value=account_module.goods_sales,
source_credit=400.0)))
request_form = self.portal.REQUEST.form
request_form['at_date'] = DateTime(2006, 2, 1)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
request_form['omit_balanced_accounts'] = False
request_form['omit_grouping_reference'] = True
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewOtherPartiesReport')
self.assertEqual(1, len(report_section_list))
# the role is displayed in parenthesis
self.assertEqual(report_section_list[0].getTitle(),
'Client 1 (Client)')
# currency is present in the report
self.assertEqual('currency_module/euro', self.portal.
AccountModule_viewOtherPartiesReport.your_currency.get_value('default'))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0],
Movement_getExplanationTitle='Transaction 1',
Movement_getExplanationTranslatedPortalType='Accounting Transaction',
Movement_getNodeGapId='41',
credit_price=0,
debit_price=100,
date=DateTime('2006/02/01'),
getTranslatedSimulationStateTitle='Closed',
running_total_price=100.0)
self.checkLineProperties(data_line_list[1],
Movement_getExplanationTitle='Transaction 2',
Movement_getExplanationTranslatedPortalType='Accounting Transaction',
Movement_getNodeGapId='40',
credit_price=0,
debit_price=200,
date=DateTime(2006, 2, 1, 0, 1),
getTranslatedSimulationStateTitle='Closed',
running_total_price=300.0)
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1],
credit_price=0,
debit_price=300,)
def createAgedBalanceDataSet(self, use_ledger=False):
"""Create data set for aged balance:
2013/07/30: Purchase invoice 1 (500)
2013/07/30: Sale invoice 2 (300)
......@@ -4131,6 +4533,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_reference='no',
reference='ref1',
simulation_state='delivered',
ledger=('' if not use_ledger else 'accounting/general'),
source_section_value=self.organisation_module.supplier,
start_date=DateTime(2013, 7, 30),
lines=(dict(destination_value=account_module.goods_purchase,
......@@ -4144,6 +4547,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
destination_reference='no',
reference='ref2',
simulation_state='delivered',
ledger=('' if not use_ledger else 'accounting/general'),
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2013, 7, 30),
lines=(dict(source_value=account_module.goods_sales,
......@@ -4157,6 +4561,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_reference='3',
destination_reference='no',
simulation_state='delivered',
ledger=('' if not use_ledger else 'accounting/general'),
causality_value=purchase1,
payment_mode='payment_mode',
destination_section_value=self.organisation_module.supplier,
......@@ -4174,6 +4579,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
simulation_state='delivered',
causality_value=sale2,
payment_mode='payment_mode',
ledger=('' if not use_ledger else 'accounting/general'),
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2013, 8, 8),
lines=(dict(source_value=account_module.bank,
......@@ -4182,8 +4588,77 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=300.0)))
self.tic()
transaction_list = [purchase1, sale2, payment3, payment4]
if use_ledger:
self.createLedgerCategory()
purchase5 = self._makeOne(
portal_type='Purchase Invoice Transaction',
title='Purchase invoice 3',
destination_reference='5',
source_reference='no',
reference='ref5',
simulation_state='delivered',
ledger='accounting/detailed',
source_section_value=self.organisation_module.supplier,
start_date=DateTime(2013, 7, 30),
lines=(dict(destination_value=account_module.goods_purchase,
destination_debit=700.0),
dict(destination_value=account_module.payable,
destination_credit=700.0)))
sale6 = self._makeOne(
portal_type='Sale Invoice Transaction',
title='Sale invoice 4',
source_reference='5',
destination_reference='no',
reference='ref6',
simulation_state='delivered',
ledger='accounting/detailed',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2013, 7, 30),
lines=(dict(source_value=account_module.goods_sales,
source_credit=900.0),
dict(source_value=account_module.receivable,
source_debit=900.0),))
self.tic()
payment7 = self._makeOne(
portal_type='Payment Transaction',
title='Payment 3',
source_reference='6',
destination_reference='no',
simulation_state='delivered',
ledger='accounting/detailed',
causality_value=purchase5,
payment_mode='payment_mode',
destination_section_value=self.organisation_module.supplier,
start_date=DateTime(2013, 9, 9),
lines=(dict(source_value=account_module.payable,
source_debit=700.0),
dict(source_value=account_module.bank,
source_credit=700.0)))
payment8 = self._makeOne(
portal_type='Payment Transaction',
title='Payment 4',
source_reference='7',
destination_reference='7',
simulation_state='delivered',
causality_value=sale6,
payment_mode='payment_mode',
ledger='accounting/detailed',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2013, 8, 8),
lines=(dict(source_value=account_module.bank,
source_debit=900.0),
dict(source_value=account_module.receivable,
source_credit=900.0)))
self.tic()
transaction_list.extend([purchase5, sale6, payment7, payment8])
# we should have all receivable and payable lines grouped.
for at in (purchase1, sale2, payment3, payment4):
for at in transaction_list:
for line in at.getMovementList():
if line.getSourceValue() in (account_module.receivable,
account_module.payable) or\
......@@ -4298,6 +4773,63 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
total_price=500,
period_1=500)
def test_simple_aged_creditor_with_ledger_report_summary(self):
# Same test as above, with a filter on ledger
# If ledger works properly, results should be the same as
# test_simple_aged_creditor_report_summary
self.createAgedBalanceDataSet(use_ledger=True)
request_form = self.portal.REQUEST.form
request_form['at_date'] = DateTime(2013, 8, 1)
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['detailed'] = False
request_form['account_type'] = 'account_type/asset/receivable'
request_form['period_list'] = (1, 2, 3)
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewAgedBalanceReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0],
mirror_section_title='Client 1',
total_price=300,
period_1=300)
def test_simple_aged_debtor_with_ledger_report_summary(self):
# Same test as above, with a filter on ledger
# If ledger works properly, results should be the same as
# test_simple_aged_creditor_report_summary
self.createAgedBalanceDataSet(use_ledger=True)
request_form = self.portal.REQUEST.form
request_form['at_date'] = DateTime(2013, 8, 1)
request_form['section_category_strict'] = False
request_form['detailed'] = False
request_form['section_category'] = 'group/demo_group'
request_form['account_type'] = 'account_type/liability/payable'
request_form['period_list'] = (1, 2, 3)
request_form['simulation_state'] = ['delivered']
request_form['ledger'] = 'ledger/accounting/general'
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewAgedBalanceReport')
self.assertEqual(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0],
mirror_section_title='Supplier',
total_price=500,
period_1=500)
class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
......
......@@ -174,6 +174,9 @@ class InventoryAPITestCase(ERP5TypeTestCase):
'use/use2',
'function/function1',
'function/function1/function2',
'ledger/accounting',
'ledger/accounting/detailed',
'ledger/accounting/general',
# we create a huge group category for consolidation tests
) + self.GROUP_CATEGORIES + self.VARIATION_CATEGORIES
......@@ -463,6 +466,47 @@ class TestInventory(InventoryAPITestCase):
self.assertInventoryEquals(100,
funding_category_strict_membership='function/function1/function2')
def test_Ledger(self):
"""Tests inventory on ledger"""
self._makeMovement(quantity=100, source_value=None,
ledger='accounting/general')
self._makeMovement(quantity=50, source_value=None,
ledger='accounting/detailed')
self.assertInventoryEquals(100, ledger='ledger/accounting/general')
self.assertInventoryEquals(50, ledger='ledger/accounting/detailed')
self.assertInventoryEquals(150, ledger=['ledger/accounting/general',
'ledger/accounting/detailed'])
def test_LedgerUid(self):
"""Tests inventory on ledger uid"""
ledger = self.portal.portal_categories.ledger
self._makeMovement(quantity=100, source_value=None,
ledger='accounting/general')
self.assertInventoryEquals(100,
ledger_uid=ledger.accounting.general.getUid())
self.assertInventoryEquals(0,
ledger_uid=ledger.accounting.detailed.getUid())
def test_LedgerCategory(self):
"""Tests inventory on ledger category"""
self._makeMovement(quantity=100, source_value=None,
ledger='accounting/general')
self.assertInventoryEquals(100, ledger_category='ledger/accounting')
self.assertInventoryEquals(100, ledger='ledger/accounting/general')
def test_LedgerCategoryStrictMembership(self):
"""Tests inventory on ledger category strict membership"""
self._makeMovement(quantity=100, source_value=None,
ledger='accounting/general')
self.assertInventoryEquals(0,
ledger_category_strict_membership='ledger/accounting')
self.assertInventoryEquals(100,
ledger_category_strict_membership='ledger/accounting/general')
def test_PaymentRequest(self):
"""Tests inventory on payment_request"""
self._makeMovement(quantity=30, destination_payment_request='function/function1')
......@@ -1034,6 +1078,23 @@ class TestInventoryList(InventoryAPITestCase):
self.assertEqual([r for r in inventory_list if r.funding_uid ==
funding2.getUid()][0].inventory, 3)
def test_GroupByLedger(self):
getInventoryList = self.getSimulationTool().getInventoryList
ledger = self.portal.portal_categories.ledger
self._makeMovement(ledger='accounting/general', quantity=100)
self._makeMovement(ledger='accounting/general', quantity=30)
self._makeMovement(ledger='accounting/detailed', quantity=70)
inventory_list = getInventoryList(node_uid=self.node.getUid(),
group_by_ledger=1)
self.assertEqual(2, len(inventory_list))
self.assertEqual([r for r in inventory_list if r.ledger_uid ==
ledger.accounting.general.getUid()][0].inventory, 130)
self.assertEqual([r for r in inventory_list if r.ledger_uid ==
ledger.accounting.detailed.getUid()][0].inventory, 70)
def test_GroupByPaymentRequest(self):
getInventoryList = self.getSimulationTool().getInventoryList
payment_request1 = self.portal.portal_categories.restrictedTraverse(
......@@ -1765,6 +1826,31 @@ class TestMovementHistoryList(InventoryAPITestCase):
section_category=section_category)
self.assertEqual(len(movement_history_list), 0)
def testLedger(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
ledger = self.portal.portal_categories.ledger
mvt = self._makeMovement(quantity=100, ledger="accounting/general")
another_mvt = self._makeMovement(quantity=50, ledger="accounting/detailed")
# first ledger
mvt_history_list = getMovementHistoryList(
node_uid=self.node.getUid(),
ledger_uid=ledger.accounting.general.getUid())
self.assertEqual(1, len(mvt_history_list))
self.assertEqual(100, mvt_history_list[0].total_quantity)
# second ledger
mvt_history_list = getMovementHistoryList(
node_uid=self.node.getUid(),
ledger_uid=ledger.accounting.detailed.getUid())
self.assertEqual(1, len(mvt_history_list))
self.assertEqual(50, mvt_history_list[0].total_quantity)
# non existing ledger
self.assertEqual(0, len(getMovementHistoryList(
ledger_uid = self.node.getUid())))
# Date tests:
# ===========
......
##############################################################################
#
# Copyright (c) 2016 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type import Permissions
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from zLOG import LOG
class DeliveryType(ERP5TypeInformation):
"""
Base type for Delivery Type.
A DeliveryType is a BaseType on which a list of ledgers is set,
which is the list of ledger allowed on the delivery objects.
"""
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
portal_type = "Delivery Type"
meta_type = "ERP5 Delivery Type"
security.declarePublic('constructInstance')
def constructInstance(self, *args, **kw):
"Creates a new delivery with a default ledger found on the portal type"
delivery = super(DeliveryType, self).constructInstance(*args, **kw)
if not delivery.hasLedger():
delivery.setLedger(self.getDefaultLedger())
return delivery
InitializeClass( DeliveryType )
......@@ -261,6 +261,9 @@ class ERP5TypeInformation(XMLObject,
# Documents need to have portal types associated to them
# just to be able to spawn temporary objects with the same behavior
'abstract',
# Types defining other types: it includes Base Type but also
# portal types of portal types
'type_definition',
# Trade
'discount', 'payment_condition', 'payment_node',
'supply', 'supply_path', 'inventory_movement',
......
......@@ -94,13 +94,15 @@ def initialize( context ):
from Base import Base
import XMLObject
from ERP5Type import ERP5TypeInformation
from Products.ERP5Type.DeliveryType import DeliveryType
import CodingStyle
# Define documents, classes, constructors and tools
object_classes = ()
content_constructors = ()
content_classes = ( Base,
XMLObject.XMLObject,
ERP5TypeInformation )
ERP5TypeInformation,
DeliveryType, )
portal_tools = ( CacheTool.CacheTool,
MemcachedTool.MemcachedTool,
SessionTool.SessionTool,
......
##############################################################################
# Copyright (c) 2016 Nexedi SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
class PortalTypeOfPortalTypeTestCase(ERP5TypeTestCase):
"""
Base class to test Portal Types of other Portal Types
"""
def getBusinessTemplateList(self):
return ('erp5_core', 'erp5_base', 'erp5_accounting')
def setUpPropertyOnPortalType(self, portal_type_id, property_name, property_value):
portal_type = self.portal.portal_types.get(portal_type_id, None)
portal_type.setProperty(property_name, property_value)
def cleanPropertyOnPortalType(self, portal_type_id, property_name):
portal_type = self.portal.portal_types.get(portal_type_id, None)
portal_type.setProperty(property_name, None)
class TestDeliveryType(PortalTypeOfPortalTypeTestCase):
"""
Delivery Type is a Base Type on which a list of allowed ledgers is defined.
This suite checks that its custom features are correctly implemented.
"""
def afterSetUp(self):
self.createLedgerCategory()
@UnrestrictedMethod
def createLedgerCategory(self):
portal_categories = self.portal.portal_categories
ledger = self.portal.portal_categories.get('ledger', None)
if ledger is None:
ledger = portal_categories.newContent(portal_type='Base Category',
id='ledger')
accounting_ledger = ledger.get('accounting', None)
if accounting_ledger is None:
accounting_ledger = ledger.newContent(portal_type='Category',
id='accounting')
if accounting_ledger.get('general', None) is None:
accounting_ledger.newContent(portal_type='Category', id='general')
if accounting_ledger.get('detailed', None) is None:
accounting_ledger.newContent(portal_type='Category', id='detailed')
def testDefaultLedgerIsSetOnObjectIfSetOnPortalType(self):
"""
Sets up a list of ledger on the Accounting Transaction portal type,
which is a DeliveryType, and checks that new Accounting Transactions
have a default ledger set at their creation
"""
portal_type = "Accounting Transaction"
self.setUpPropertyOnPortalType(
portal_type,
"ledger_list",
['accounting/general', 'accounting/detailed'])
self.assertEqual(self.portal.portal_types.get(portal_type).getDefaultLedger(),
'accounting/general')
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type)
self.assertEqual(accounting_transaction.hasLedger(), True)
self.assertEqual(accounting_transaction.getLedgerList(),
['accounting/general'])
def testDefaultLedgerIsNotSetOnObjectIfNotSetOnPortalType(self):
"""
If no ledger is defined on the portal type, then it means the
"allowed ledger list" feature is not in use in this instance
"""
portal_type = "Accounting Transaction"
portal_type_object = self.portal.portal_types.get(portal_type)
self.cleanPropertyOnPortalType(portal_type, 'ledger')
# No ledger should be set on the portal type
self.assertEqual(portal_type_object.getLedgerList(), [])
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type)
self.assertEqual(accounting_transaction.getLedgerList(), [])
def testDefaultLedgerIsOverwrittenByNewContentParameter(self):
"""
If a Delivery is created with a given ledger, then it should overwrite
the default ledger
"""
portal_type = "Accounting Transaction"
self.setUpPropertyOnPortalType(
portal_type,
"ledger_list",
['accounting/general', 'accounting/detailed'])
self.assertEqual(self.portal.portal_types.get(portal_type).getDefaultLedger(),
'accounting/general')
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type,
ledger='accounting/detailed')
self.assertEqual(accounting_transaction.hasLedger(), True)
self.assertEqual(accounting_transaction.getLedgerList(),
['accounting/detailed'])
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