Commit d730e0b6 authored by Jérome Perrin's avatar Jérome Perrin

erp5_accounting: reorganise init scripts and do not initialise some accounting...

erp5_accounting: reorganise init scripts and do not initialise some accounting lines if the user is allowed to add invoice lines.
parent f3736094
...@@ -50,15 +50,15 @@ ...@@ -50,15 +50,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>transaction = context\n <value> <string>if kw.get(\'created_by_builder\', 0): \n
\n
if kw.get(\'created_by_builder\', 0): \n
return\n return\n
\n \n
transaction.newContent(portal_type=\'Accounting Transaction Line\', )\n preference_tool = context.getPortalObject().portal_preferences\n
transaction.newContent(portal_type=\'Accounting Transaction Line\', )\n context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n \n
context.AccountingTransaction_initFromPreferences()\n context.newContent(portal_type=\'Accounting Transaction Line\', )\n
context.newContent(portal_type=\'Accounting Transaction Line\', )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?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>_body</string> </key>
<value> <string>preference_tool = context.getPortalObject().portal_preferences\n
context.edit(\n
source_section = preference_tool.getPreferredAccountingTransactionSourceSection(),\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingTransaction_initFromPreferences</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,22 +50,15 @@ ...@@ -50,22 +50,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>transaction = context\n <value> <string>if kw.get(\'created_by_builder\', 0): \n
\n
if kw.get(\'created_by_builder\', 0): \n
return\n return\n
\n \n
transaction.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n preference_tool = context.getPortalObject().portal_preferences\n
transaction.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
\n context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
from Products.CMFCore.utils import getToolByName\n
\n
transaction = context\n
preference_tool = getToolByName(context, \'portal_preferences\')\n
\n \n
transaction.edit (\n context.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
source_section = preference_tool.getPreferredAccountingTransactionSourceSection(),\n context.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,19 +50,19 @@ ...@@ -50,19 +50,19 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>transaction = context\n <value> <string>if kw.get(\'created_by_builder\', 0): \n
\n
if kw.get(\'created_by_builder\', 0): \n
return\n return\n
\n \n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n preference_tool = context.getPortalObject().portal_preferences\n
id=\'receivable\', )\n context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
id=\'payable\', )\n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'bank\', )\n
\n \n
context.AccountingTransaction_initFromPreferences()\n context.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'receivable\')\n
context.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'payable\')\n
context.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'bank\')\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,25 +50,22 @@ ...@@ -50,25 +50,22 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>transaction = context\n <value> <string>if kw.get(\'created_by_builder\', 0): \n
\n
if kw.get(\'created_by_builder\', 0): \n
return\n return\n
\n \n
from Products.CMFCore.utils import getToolByName\n preference_tool = context.getPortalObject().portal_preferences\n
preference_tool = getToolByName(context, \'portal_preferences\')\n context.setDestinationSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n \n
transaction.edit (\n if \'Invoice Line\' in context.getVisibleAllowedContentTypeList():\n
# XXX getPreferredAccountingTransactionSourceSection is definitively a bad name ...\n return\n
destination_section = preference_tool.getPreferredAccountingTransactionSourceSection(),\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
\n \n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n context.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'expense\', )\n id=\'expense\', )\n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n context.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'payable\', )\n id=\'payable\', )\n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n context.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'refundable_vat\', )\n id=\'refundable_vat\', )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,19 +50,22 @@ ...@@ -50,19 +50,22 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>transaction = context\n <value> <string>if kw.get(\'created_by_builder\', 0): \n
\n
if kw.get(\'created_by_builder\', 0): \n
return\n return\n
\n \n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n preference_tool = context.getPortalObject().portal_preferences\n
id=\'income\',)\n context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
id=\'receivable\', )\n \n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n if \'Invoice Line\' in context.getVisibleAllowedContentTypeList():\n
id=\'collected_vat\',)\n return\n
\n \n
context.AccountingTransaction_initFromPreferences()\n context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'income\',)\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'receivable\', )\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'collected_vat\',)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
1505 1506
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment