Commit 675a0b03 authored by Jérome Perrin's avatar Jérome Perrin

base,accounting,payroll: add a Delivery_getLedgerItemList script

and use it instead of repeating that logic in field libraries
parent 0d84fdad
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> <value> <string>context/Delivery_getLedgerItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
"""Returns the possible ledger for this delivery.
This will return only ledgers allowed in the delivery type definition.
"""
portal = context.getPortalObject()
ledger_item_list = context.Base_getPreferredCategoryChildItemList(portal.portal_categories.ledger)
allowed_ledger_list = portal.portal_types[context.getPortalType()].getLedgerList()
return [('', '')] + [item for item in ledger_item_list if item[1] in allowed_ledger_list]
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_getLedgerItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> <value> <string>context/Delivery_getLedgerItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> <value> <string>context/Delivery_getLedgerItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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