[Erp5-report] r23717 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Sep 19 17:16:20 CEST 2008
Author: jerome
Date: Fri Sep 19 17:16:14 2008
New Revision: 23717
URL: http://svn.erp5.org?rev=23717&view=rev
Log:
Change AccountingTransaction_isDestination/SourceCurrencyConvertible so that conversion tab is always visible when conversion is set on lines, even if the resource is the same as the section's accounting currency.
Change accounting workflow to refuse validation of a transaction if conversion is set on lines (to a value different from quantity) when it should not be.
Modified:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isDestinationCurrencyConvertible.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isSourceCurrencyConvertible.xml
erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
erp5/trunk/bt5/erp5_accounting/bt/revision
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isDestinationCurrencyConvertible.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isDestinationCurrencyConvertible.xml?rev=23717&r1=23716&r2=23717&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isDestinationCurrencyConvertible.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isDestinationCurrencyConvertible.xml Fri Sep 19 17:16:14 2008
@@ -10,20 +10,8 @@
<pickle>
<dictionary>
<item>
- <key> <string>Python_magic</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
- </item>
- <item>
- <key> <string>__ac_local_roles__</string> </key>
- <value>
- <none/>
- </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
@@ -73,18 +61,23 @@
return 0\n
\n
transaction_currency = context.getResource()\n
-return transaction_currency is not None and\\\n
- transaction_currency != section_value.getProperty(\'price_currency\', None)\n
+if transaction_currency is not None and\\\n
+ transaction_currency != section_value.getProperty(\'price_currency\', None):\n
+ return 1\n
+\n
+for line in context.getMovementList(\n
+ portal_type=context.getPortalAccountingMovementTypeList()):\n
+ if ((line.getDestinationCredit() !=\n
+ line.getDestinationInventoriatedTotalAssetCredit()) or (\n
+ line.getDestinationDebit() !=\n
+ line.getDestinationInventoriatedTotalAssetDebit())):\n
+ return 1\n
+\n
+return 0\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_filepath</string> </key>
<value>
<none/>
</value>
@@ -122,6 +115,8 @@
<string>section_value</string>
<string>None</string>
<string>transaction_currency</string>
+ <string>_getiter_</string>
+ <string>line</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isSourceCurrencyConvertible.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isSourceCurrencyConvertible.xml?rev=23717&r1=23716&r2=23717&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isSourceCurrencyConvertible.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_isSourceCurrencyConvertible.xml Fri Sep 19 17:16:14 2008
@@ -10,20 +10,8 @@
<pickle>
<dictionary>
<item>
- <key> <string>Python_magic</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
- </item>
- <item>
- <key> <string>__ac_local_roles__</string> </key>
- <value>
- <none/>
- </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
@@ -73,18 +61,23 @@
return 0\n
\n
transaction_currency = context.getResource()\n
-return transaction_currency is not None and\\\n
- transaction_currency != section_value.getProperty(\'price_currency\', None)\n
+if transaction_currency is not None and\\\n
+ transaction_currency != section_value.getProperty(\'price_currency\', None):\n
+ return 1\n
+\n
+for line in context.getMovementList(\n
+ portal_type=context.getPortalAccountingMovementTypeList()):\n
+ if ((line.getSourceCredit() !=\n
+ line.getSourceInventoriatedTotalAssetCredit()) or (\n
+ line.getSourceDebit() !=\n
+ line.getSourceInventoriatedTotalAssetDebit())):\n
+ return 1\n
+\n
+return 0\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_filepath</string> </key>
<value>
<none/>
</value>
@@ -122,6 +115,8 @@
<string>section_value</string>
<string>None</string>
<string>transaction_currency</string>
+ <string>_getiter_</string>
+ <string>line</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml?rev=23717&r1=23716&r2=23717&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml Fri Sep 19 17:16:14 2008
@@ -71,6 +71,7 @@
\n
# first of all, validate the transaction itself\n
container.validateTransaction(state_change)\n
+\n
\n
# Check that all lines uses open accounts, and doesn\'t use invalid third\n
# parties or bank accounts\n
@@ -117,6 +118,32 @@
"uses ${bank_account_currency} as default currency.",\n
mapping=dict(bank_account_reference=unicode(bank_account.getReference(), \'utf8\'),\n
bank_account_currency=unicode(bank_account.getPriceCurrencyReference(), \'utf8\')))\n
+\n
+ source_currency = None\n
+ source_section = line.getSourceSectionValue()\n
+ if source_section is not None:\n
+ source_currency = source_section.getProperty(\'price_currency\')\n
+\n
+ if source_currency == line.getResource():\n
+ if ((line.getSourceCredit() !=\n
+ line.getSourceInventoriatedTotalAssetCredit()) or (\n
+ line.getSourceDebit() !=\n
+ line.getSourceInventoriatedTotalAssetDebit())):\n
+ raise ValidationFailed(translateString(\n
+ "Source conversion should not be set."))\n
+\n
+ destination_currency = None\n
+ destination_section = line.getDestinationSectionValue()\n
+ if destination_section is not None:\n
+ destination_currency = destination_section.getProperty(\'price_currency\')\n
+\n
+ if destination_currency == line.getResource():\n
+ if ((line.getDestinationCredit() !=\n
+ line.getDestinationInventoriatedTotalAssetCredit()) or (\n
+ line.getDestinationDebit() !=\n
+ line.getDestinationInventoriatedTotalAssetDebit())):\n
+ raise ValidationFailed(translateString(\n
+ "Destination conversion should not be set."))\n
\n
# Delete empty lines\n
transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
@@ -197,6 +224,10 @@
<string>None</string>
<string>unicode</string>
<string>bank_account_currency</string>
+ <string>source_currency</string>
+ <string>source_section</string>
+ <string>destination_currency</string>
+ <string>destination_section</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=23717&r1=23716&r2=23717&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Fri Sep 19 17:16:14 2008
@@ -1,1 +1,1 @@
-775
+777
More information about the Erp5-report
mailing list