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
No related merge requests found
......@@ -50,15 +50,15 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = context\n
\n
if kw.get(\'created_by_builder\', 0): \n
<value> <string>if kw.get(\'created_by_builder\', 0): \n
return\n
\n
transaction.newContent(portal_type=\'Accounting Transaction Line\', )\n
transaction.newContent(portal_type=\'Accounting Transaction Line\', )\n
preference_tool = context.getPortalObject().portal_preferences\n
context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n
context.AccountingTransaction_initFromPreferences()\n
context.newContent(portal_type=\'Accounting Transaction Line\', )\n
context.newContent(portal_type=\'Accounting Transaction Line\', )\n
</string> </value>
</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 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = context\n
\n
if kw.get(\'created_by_builder\', 0): \n
<value> <string>if kw.get(\'created_by_builder\', 0): \n
return\n
\n
transaction.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
transaction.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
\n
from Products.CMFCore.utils import getToolByName\n
\n
transaction = context\n
preference_tool = getToolByName(context, \'portal_preferences\')\n
preference_tool = context.getPortalObject().portal_preferences\n
context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n
transaction.edit (\n
source_section = preference_tool.getPreferredAccountingTransactionSourceSection(),\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
context.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
context.newContent(portal_type=\'Internal Invoice Transaction Line\', )\n
</string> </value>
</item>
<item>
......
......@@ -50,19 +50,19 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = context\n
\n
if kw.get(\'created_by_builder\', 0): \n
<value> <string>if kw.get(\'created_by_builder\', 0): \n
return\n
\n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'receivable\', )\n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'payable\', )\n
transaction.newContent(portal_type=\'Accounting Transaction Line\',\n
id=\'bank\', )\n
preference_tool = context.getPortalObject().portal_preferences\n
context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\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>
</item>
<item>
......
......@@ -50,24 +50,21 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = context\n
\n
if kw.get(\'created_by_builder\', 0): \n
<value> <string>if kw.get(\'created_by_builder\', 0): \n
return\n
\n
from Products.CMFCore.utils import getToolByName\n
preference_tool = getToolByName(context, \'portal_preferences\')\n
preference_tool = context.getPortalObject().portal_preferences\n
context.setDestinationSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n
transaction.edit (\n
# XXX getPreferredAccountingTransactionSourceSection is definitively a bad name ...\n
destination_section = preference_tool.getPreferredAccountingTransactionSourceSection(),\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
if \'Invoice Line\' in context.getVisibleAllowedContentTypeList():\n
return\n
\n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
context.newContent(portal_type=\'Purchase Invoice Transaction Line\',\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
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
context.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'refundable_vat\', )\n
</string> </value>
</item>
......
......@@ -50,19 +50,22 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = context\n
<value> <string>if kw.get(\'created_by_builder\', 0): \n
return\n
\n
if kw.get(\'created_by_builder\', 0): \n
preference_tool = context.getPortalObject().portal_preferences\n
context.setSourceSection(preference_tool.getPreferredAccountingTransactionSourceSection())\n
context.setResource(preference_tool.getPreferredAccountingTransactionCurrency())\n
\n
if \'Invoice Line\' in context.getVisibleAllowedContentTypeList():\n
return\n
\n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'income\',)\n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'receivable\', )\n
transaction.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'collected_vat\',)\n
\n
context.AccountingTransaction_initFromPreferences()\n
</string> </value>
</item>
<item>
......
1505
\ No newline at end of file
1506
\ 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