[Erp5-report] r25445 - in /erp5/trunk/bt5/erp5_payroll: SkinTemplateItem/portal_skins/erp5_...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Feb 4 14:30:05 CET 2009
Author: fabien
Date: Wed Feb 4 14:30:00 2009
New Revision: 25445
URL: http://svn.erp5.org?rev=25445&view=rev
Log:
2009-02-04 fabien
* when a specialise model is defined on a paysheet, apply it automatically
* rewrite the apply model script
Added:
erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_setSpecialiseAndApplyModel.xml
Modified:
erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_applyModel.xml
erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewFieldLibrary/my_specialise_title.xml
erp5/trunk/bt5/erp5_payroll/bt/change_log
erp5/trunk/bt5/erp5_payroll/bt/revision
Modified: erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_applyModel.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_applyModel.xml?rev=25445&r1=25444&r2=25445&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_applyModel.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_applyModel.xml [utf8] Wed Feb 4 14:30:00 2009
@@ -53,8 +53,17 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>Base_translateString = context.Base_translateString\n
+ <value> <string encoding="cdata"><![CDATA[
+
+Base_translateString = context.Base_translateString\n
paysheet = context\n
+\n
+# copy categories\n
+category_list = [\n
+ \'destination_section\', \'source_section\', \'source_payment\',\n
+ \'destination_payment\', \'price_currency\', \'ressource\',\n
+]\n
+new_category_dict = {}\n
\n
model = paysheet.getSpecialiseValue()\n
\n
@@ -73,24 +82,26 @@
if v:\n
return v\n
\n
-# set source and destination from the model if there is no value yet defined\n
-if not paysheet.getDestinationSection():\n
- paysheet.setDestinationSection(getPropertyFromModel(model, \'destination_section\'))\n
-\n
-if not paysheet.getSourceSection():\n
- paysheet.setSourceSection(getPropertyFromModel(model, \'source_section\'))\n
-\n
-if not paysheet.getSourcePayment():\n
- paysheet.setSourcePayment(getPropertyFromModel(model, \'source_payment\'))\n
-\n
-if not paysheet.getDestinationPayment():\n
- paysheet.setDestinationPayment(getPropertyFromModel(model, \'destination_payment\'))\n
-\n
-if not paysheet.getPriceCurrency():\n
- paysheet.setPriceCurrency(getPropertyFromModel(model, \'price_currency\'))\n
-\n
-if not paysheet.getResource():\n
- paysheet.setResource(getPropertyFromModel(model, \'price_currency\'))\n
+for category in category_list:\n
+ if force or not paysheet.getPropertyList(category):\n
+ v = getPropertyFromModel(model, category)\n
+ if v:\n
+ new_category_dict[category] = v\n
+\n
+def copyPaymentCondition(paysheet, model):\n
+ filter_dict = {\'portal_type\': \'Payment Condition\'}\n
+ to_copy = model.contentIds(filter=filter_dict)\n
+ if len(to_copy) > 0 :\n
+ copy_data = model.manage_copyObjects(ids=to_copy)\n
+ paysheet.manage_pasteObjects(copy_data)\n
+ for other_models in model.getSpecialiseValueList():\n
+ copyPaymentCondition(paysheet, other_models)\n
+\n
+filter_dict = {\'portal_type\': \'Payment Condition\'}\n
+if force:\n
+ paysheet.manage_delObjects(list(paysheet.contentIds(filter=filter_dict)))\n
+if len(paysheet.contentIds(filter=filter_dict)) == 0:\n
+ copyPaymentCondition(paysheet, model)\n
\n
# copy model sub objects into paysheet\n
paysheet.PaySheetTransaction_copySubObject(\n
@@ -101,10 +112,14 @@
property_list=(\'quantity\',))\n
paysheet.PaySheetTransaction_copySubObject(\'Payment Condition\')\n
\n
+paysheet.edit(**new_category_dict)\n
+\n
if not batch_mode:\n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=Base_translateString(\'Pay Sheet Transaction updated.\')))\n
-</string> </value>
+
+
+]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -114,7 +129,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>form_id=\'view\', batch_mode=0</string> </value>
+ <value> <string>form_id=\'view\', batch_mode=0, force=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -134,7 +149,7 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>2</int> </value>
+ <value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
@@ -142,14 +157,26 @@
<tuple>
<string>form_id</string>
<string>batch_mode</string>
+ <string>force</string>
<string>_getattr_</string>
<string>context</string>
<string>Base_translateString</string>
<string>paysheet</string>
+ <string>category_list</string>
+ <string>new_category_dict</string>
<string>model</string>
<string>None</string>
<string>dict</string>
<string>getPropertyFromModel</string>
+ <string>_getiter_</string>
+ <string>category</string>
+ <string>v</string>
+ <string>_write_</string>
+ <string>copyPaymentCondition</string>
+ <string>filter_dict</string>
+ <string>list</string>
+ <string>len</string>
+ <string>_apply_</string>
</tuple>
</value>
</item>
@@ -164,6 +191,7 @@
<tuple>
<string>view</string>
<int>0</int>
+ <int>0</int>
</tuple>
</value>
</item>
Added: erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_setSpecialiseAndApplyModel.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_setSpecialiseAndApplyModel.xml?rev=25445&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_setSpecialiseAndApplyModel.xml (added)
+++ erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_setSpecialiseAndApplyModel.xml [utf8] Wed Feb 4 14:30:00 2009
@@ -1,0 +1,127 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ <tuple/>
+ </tuple>
+ </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>context.setSpecialiseUidList(relation_uid_list, portal_type=portal_type)\n
+\n
+if relation_uid_list:\n
+ context.PaySheetTransaction_applyModel(force=1)\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>relation_uid_list, portal_type</string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>2</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>relation_uid_list</string>
+ <string>portal_type</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>PaySheetTransaction_setSpecialiseAndApplyModel</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewFieldLibrary/my_specialise_title.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewFieldLibrary/my_specialise_title.xml?rev=25445&r1=25444&r2=25445&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewFieldLibrary/my_specialise_title.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewFieldLibrary/my_specialise_title.xml [utf8] Wed Feb 4 14:30:00 2009
@@ -18,6 +18,7 @@
<string>base_category</string>
<string>portal_type</string>
<string>catalog_index</string>
+ <string>relation_setter_id</string>
</list>
</value>
</item>
@@ -134,6 +135,10 @@
<value> <int>0</int> </value>
</item>
<item>
+ <key> <string>relation_setter_id</string> </key>
+ <value> <string>PaySheetTransaction_setSpecialiseAndApplyModel</string> </value>
+ </item>
+ <item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
Modified: erp5/trunk/bt5/erp5_payroll/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_payroll/bt/change_log?rev=25445&r1=25444&r2=25445&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_payroll/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_payroll/bt/change_log [utf8] Wed Feb 4 14:30:00 2009
@@ -1,3 +1,7 @@
+2009-02-04 fabien
+* when a specialise model is defined on a paysheet, apply it automatically
+* rewrite the apply model script
+
2009-01-28 fabien
* remove some unused script and refeactor some very similar scripts in a generic one
Modified: erp5/trunk/bt5/erp5_payroll/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_payroll/bt/revision?rev=25445&r1=25444&r2=25445&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_payroll/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_payroll/bt/revision [utf8] Wed Feb 4 14:30:00 2009
@@ -1,1 +1,1 @@
-346
+348
More information about the Erp5-report
mailing list