[Erp5-report] r36763 gregory - in /erp5/trunk/bt5: erp5_banking_check/SkinTemplateItem/port...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jul 1 09:40:52 CEST 2010
Author: gregory
Date: Thu Jul 1 09:40:51 2010
New Revision: 36763
URL: http://svn.erp5.org?rev=36763&view=rev
Log:
Use requirements instead of version to lookup a check model.
Added:
erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/BankAccount_getCheckModel.xml
- copied, changed from r36701, erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml
Modified:
erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml
Copied: erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/BankAccount_getCheckModel.xml (from r36701, erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml)
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/BankAccount_getCheckModel.xml?p2=erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/BankAccount_getCheckModel.xml&p1=erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml&r1=36701&r2=36763&rev=36763&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/BankAccount_getCheckModel.xml [utf8] Thu Jul 1 09:40:51 2010
@@ -53,26 +53,19 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string encoding="cdata"><![CDATA[
-
-from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
-from Products.ERP5Type.Message import Message\n
-if reference is None:\n
- msg = Message(domain=\'ui\', message="Check not defined.")\n
- raise ValidationFailed, (msg,)\n
-model_list = [x for x in context.checkbook_model_module.objectValues()\n
- if x.getReference()==reference]\n
-model_list_len = len(model_list)\n
-if model_list_len == 0:\n
- msg = Message(domain=\'ui\', message="Check not defined.")\n
- raise ValidationFailed, (msg,)\n
-if model_list_len > 1:\n
- msg = Message(domain=\'ui\', message="Two many check models with this reference.")\n
- raise ValidationFailed, (msg,)\n
-return model_list[0]\n
-
-
-]]></string> </value>
+ <value> <string>PORTAL_TYPE_TO_CHECK_MODEL_REFERENCE = {\n
+ \'Person\': \'CCOP\',\n
+ \'Organisation\': \'CCCO\',\n
+}\n
+\n
+entity_portal_type = context.getParentValue().getPortalType()\n
+reference = PORTAL_TYPE_TO_CHECK_MODEL_REFERENCE[entity_portal_type]\n
+check_resource = context.Base_getCheckModelByReference(\n
+ reference=reference,\n
+ unique_per_account=unique_per_account,\n
+)\n
+return check_resource\n
+</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -82,7 +75,15 @@ return model_list[0]\n
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>reference=None</string> </value>
+ <value> <string>unique_per_account=False</string> </value>
+ </item>
+ <item>
+ <key> <string>_proxy_roles</string> </key>
+ <value>
+ <tuple>
+ <string>Manager</string>
+ </tuple>
+ </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -108,23 +109,14 @@ return model_list[0]\n
<key> <string>co_varnames</string> </key>
<value>
<tuple>
- <string>reference</string>
- <string>Products.DCWorkflow.DCWorkflow</string>
- <string>ValidationFailed</string>
- <string>Products.ERP5Type.Message</string>
- <string>Message</string>
- <string>None</string>
- <string>msg</string>
- <string>append</string>
- <string>$append0</string>
- <string>_getiter_</string>
+ <string>unique_per_account</string>
+ <string>PORTAL_TYPE_TO_CHECK_MODEL_REFERENCE</string>
<string>_getattr_</string>
<string>context</string>
- <string>x</string>
- <string>model_list</string>
- <string>len</string>
- <string>model_list_len</string>
+ <string>entity_portal_type</string>
<string>_getitem_</string>
+ <string>reference</string>
+ <string>check_resource</string>
</tuple>
</value>
</item>
@@ -137,13 +129,13 @@ return model_list[0]\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
- <none/>
+ <int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
- <value> <string>Base_getCheckModelByReference</string> </value>
+ <value> <string>BankAccount_getCheckModel</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml?rev=36763&r1=36762&r2=36763&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml [utf8] Thu Jul 1 09:40:51 2010
@@ -108,11 +108,11 @@ if bank_account is None:\n
# Check the check.\n
check_number = transaction.getAggregateFreeText()\n
\n
-# always verify check model as the version may have changed\n
-version = transaction.isUniquePerAccount() and 1 or 2\n
-check_resource = bank_account.BankAccount_getCheckModel(version=version).getRelativeUrl()\n
-if transaction.getAggregateResource() != check_resource:\n
- transaction.edit(aggregate_resource=check_resource)\n
+# bind check payment with check model\n
+check_resource = bank_account.BankAccount_getCheckModel(\n
+ unique_per_account=transaction.isUniquePerAccount(),\n
+).getRelativeUrl()\n
+transaction.edit(aggregate_resource=check_resource)\n
\n
if not check_number:\n
msg = Message(domain=\'ui\', message="Check not defined.")\n
@@ -212,10 +212,9 @@ elif error[\'error_code\'] != 0:\n
<string>price</string>
<string>bank_account</string>
<string>check_number</string>
- <string>version</string>
<string>check_resource</string>
- <string>context</string>
<string>check</string>
+ <string>context</string>
<string>error</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml?rev=36763&r1=36762&r2=36763&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getCheckModelByReference.xml [utf8] Thu Jul 1 09:40:51 2010
@@ -60,8 +60,11 @@ from Products.ERP5Type.Message import Me
if reference is None:\n
msg = Message(domain=\'ui\', message="Check not defined.")\n
raise ValidationFailed, (msg,)\n
-model_list = [x for x in context.checkbook_model_module.objectValues()\n
- if x.getReference()==reference]\n
+model_list = [x\n
+ for x in context.checkbook_model_module.objectValues()\n
+ if x.getReference() == reference\n
+ and x.isUniquePerAccount() == unique_per_account\n
+]\n
model_list_len = len(model_list)\n
if model_list_len == 0:\n
msg = Message(domain=\'ui\', message="Check not defined.")\n
@@ -82,7 +85,7 @@ return model_list[0]\n
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>reference=None</string> </value>
+ <value> <string>reference=None, unique_per_account=False</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -102,13 +105,14 @@ return model_list[0]\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>1</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>reference</string>
+ <string>unique_per_account</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
@@ -138,6 +142,7 @@ return model_list[0]\n
<value>
<tuple>
<none/>
+ <int>0</int>
</tuple>
</value>
</item>
More information about the Erp5-report
mailing list