Commit b07a6159 authored by Fabien Morin's avatar Fabien Morin

2009-03-16 fabien

* add a field version on Pay Sheet Model
* use new methods from PaySheetModel class

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26055 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 45dad6fe
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
<string>my_work_time_annotation_line_quantity</string> <string>my_work_time_annotation_line_quantity</string>
<string>my_work_time_annotation_line_quantity_unit</string> <string>my_work_time_annotation_line_quantity_unit</string>
<string>my_variation_settings_category_list</string> <string>my_variation_settings_category_list</string>
<string>my_version</string>
<string>my_translated_validation_state_title</string> <string>my_translated_validation_state_title</string>
</list> </list>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>display_width</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_version</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>display_width</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Version</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -65,42 +65,31 @@ category_list = [\n ...@@ -65,42 +65,31 @@ category_list = [\n
]\n ]\n
new_category_dict = {}\n new_category_dict = {}\n
\n \n
model = paysheet.getSpecialiseValue()\n model = paysheet.getSpecialiseValue().getEffectiveModel(paysheet)\n
\n \n
if model is None:\n if model is None:\n
return context.Base_redirect(form_id,\n return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=Base_translateString(\'No pay sheet model.\')))\n keep_items=dict(portal_status_message=Base_translateString(\'No pay sheet model.\')))\n
\n \n
def getPropertyFromModel(model, property_name):\n
"""Get a property from the paysheet model, or from a specialised model.\n
"""\n
v = model.getProperty(property_name)\n
if v:\n
return v\n
for specialised_model in model.getSpecialiseValueList():\n
v = getPropertyFromModel(specialised_model, property_name)\n
if v:\n
return v\n
\n
for category in category_list:\n for category in category_list:\n
if force or not paysheet.getPropertyList(category):\n if force or not paysheet.getPropertyList(category):\n
v = getPropertyFromModel(model, category)\n v = model.getModelIneritanceEffectiveProperty(paysheet, category)\n
if v:\n if v:\n
new_category_dict[category] = v\n new_category_dict[category] = v\n
\n \n
# copy the price_currency into the ressource :\n # copy the price_currency into the ressource :\n
price_currency = getPropertyFromModel(model, category)\n price_currency = model.getModelIneritanceEffectiveProperty(paysheet, \'price_currency\')\n
if price_currency:\n if price_currency:\n
new_category_dict[\'resource\'] = price_currency\n new_category_dict[\'resource\'] = price_currency\n
\n \n
def copyPaymentCondition(paysheet, model):\n def copyPaymentCondition(paysheet, model):\n
filter_dict = {\'portal_type\': \'Payment Condition\'}\n filter_dict = {\'portal_type\': \'Payment Condition\'}\n
to_copy = model.contentIds(filter=filter_dict)\n effective_model_list = model.getInheritanceEffectiveModelTreeAsList(paysheet)\n
if len(to_copy) > 0 :\n for effective_model in effective_model_list:\n
copy_data = model.manage_copyObjects(ids=to_copy)\n to_copy = effective_model.contentIds(filter=filter_dict)\n
paysheet.manage_pasteObjects(copy_data)\n if len(to_copy) > 0 :\n
for other_models in model.getSpecialiseValueList():\n copy_data = effective_model.manage_copyObjects(ids=to_copy)\n
copyPaymentCondition(paysheet, other_models)\n paysheet.manage_pasteObjects(copy_data)\n
\n \n
filter_dict = {\'portal_type\': \'Payment Condition\'}\n filter_dict = {\'portal_type\': \'Payment Condition\'}\n
if force:\n if force:\n
...@@ -121,7 +110,8 @@ paysheet.edit(**new_category_dict)\n ...@@ -121,7 +110,8 @@ paysheet.edit(**new_category_dict)\n
\n \n
if not batch_mode:\n if not batch_mode:\n
return context.Base_redirect(form_id,\n return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=Base_translateString(\'Pay Sheet Transaction updated.\')))\n keep_items=dict(portal_status_message=\\\n
Base_translateString(\'Pay Sheet Transaction updated.\')))\n
]]></string> </value> ]]></string> </value>
...@@ -172,7 +162,6 @@ if not batch_mode:\n ...@@ -172,7 +162,6 @@ if not batch_mode:\n
<string>model</string> <string>model</string>
<string>None</string> <string>None</string>
<string>dict</string> <string>dict</string>
<string>getPropertyFromModel</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>category</string> <string>category</string>
<string>v</string> <string>v</string>
......
...@@ -94,7 +94,7 @@ else:\n ...@@ -94,7 +94,7 @@ else:\n
model_slice_min = 0\n model_slice_min = 0\n
model_slice_max = 0\n model_slice_max = 0\n
if salary_range:\n if salary_range:\n
model = context.getSpecialiseValue()\n model = context.getSpecialiseValue().getEffectiveModel(context)\n
cell = model.getCell(salary_range)\n cell = model.getCell(salary_range)\n
if cell is None:\n if cell is None:\n
context.log("Warning ! Can\'t find cell corresponding to : %s" %\n context.log("Warning ! Can\'t find cell corresponding to : %s" %\n
......
...@@ -68,7 +68,6 @@ from Products.ERP5Type.Message import translateString\n ...@@ -68,7 +68,6 @@ from Products.ERP5Type.Message import translateString\n
def sortByIntIndex(a, b):\n def sortByIntIndex(a, b):\n
return cmp(a.getIntIndex(), b.getIntIndex())\n return cmp(a.getIntIndex(), b.getIntIndex())\n
\n \n
model = context.getSpecialiseValue(0)\n
portal_type_list = [\'Pay Sheet Model Line\']\n portal_type_list = [\'Pay Sheet Model Line\']\n
sub_object_list = context.getInheritedObjectValueList(portal_type_list)\n sub_object_list = context.getInheritedObjectValueList(portal_type_list)\n
sub_object_list.sort(sortByIntIndex)\n sub_object_list.sort(sortByIntIndex)\n
...@@ -257,10 +256,9 @@ return line_list\n ...@@ -257,10 +256,9 @@ return line_list\n
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>translateString</string> <string>translateString</string>
<string>sortByIntIndex</string> <string>sortByIntIndex</string>
<string>portal_type_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>model</string>
<string>portal_type_list</string>
<string>sub_object_list</string> <string>sub_object_list</string>
<string>model_line_list</string> <string>model_line_list</string>
<string>append</string> <string>append</string>
......
...@@ -72,7 +72,6 @@ if not editable:\n ...@@ -72,7 +72,6 @@ if not editable:\n
def sortByIntIndex(a, b):\n def sortByIntIndex(a, b):\n
return cmp(a.getIntIndex(), b.getIntIndex())\n return cmp(a.getIntIndex(), b.getIntIndex())\n
\n \n
model = context.getSpecialiseValue(0)\n
portal_type_list = [\'Pay Sheet Model Line\']\n portal_type_list = [\'Pay Sheet Model Line\']\n
sub_object_list = context.getInheritedObjectValueList(portal_type_list)\n sub_object_list = context.getInheritedObjectValueList(portal_type_list)\n
sub_object_list.sort(sortByIntIndex)\n sub_object_list.sort(sortByIntIndex)\n
...@@ -83,7 +82,7 @@ model_line_list = [line for line in model_line_list if line.isEditable()]\n ...@@ -83,7 +82,7 @@ model_line_list = [line for line in model_line_list if line.isEditable()]\n
for model_line in model_line_list:\n for model_line in model_line_list:\n
for tax_category in model_line.getTaxCategoryValueList():\n for tax_category in model_line.getTaxCategoryValueList():\n
price = (tax_category.getId()+\'_price\', tax_category.getTitle()+\' Rate\')\n price = (tax_category.getId()+\'_price\', tax_category.getTitle()+\' Rate\')\n
quantity = (tax_category.getId()+\'_quantity\', \n quantity = (tax_category.getId()+\'_quantity\',\n
tax_category.getTitle()+\' Amount\')\n tax_category.getTitle()+\' Amount\')\n
if price not in column_list:\n if price not in column_list:\n
column_list.append(price)\n column_list.append(price)\n
...@@ -137,9 +136,8 @@ return column_list\n ...@@ -137,9 +136,8 @@ return column_list\n
<string>not_editable_columns</string> <string>not_editable_columns</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>sortByIntIndex</string> <string>sortByIntIndex</string>
<string>context</string>
<string>model</string>
<string>portal_type_list</string> <string>portal_type_list</string>
<string>context</string>
<string>sub_object_list</string> <string>sub_object_list</string>
<string>model_line_list</string> <string>model_line_list</string>
<string>append</string> <string>append</string>
......
...@@ -59,17 +59,7 @@ request = context.REQUEST\n ...@@ -59,17 +59,7 @@ request = context.REQUEST\n
# display only title line instead of description\n # display only title line instead of description\n
use_line_title = request.get(\'use_line_title\', 0)\n use_line_title = request.get(\'use_line_title\', 0)\n
\n \n
model = context.getSpecialiseValue()\n model = context.getSpecialiseValue().getEffectiveModel(context)\n
def getPropertyFromModel(model, property_name):\n
"""Get a property from the paysheet model, or from a specialised model.\n
"""\n
v = model.getProperty(property_name)\n
if v:\n
return v\n
for specialised_model in model.getSpecialiseValueList():\n
v = getPropertyFromModel(specialised_model, property_name)\n
if v:\n
return v\n
\n \n
def getFieldAsString(field):\n def getFieldAsString(field):\n
return \', \'.join(getFieldAsLineList(field))\n return \', \'.join(getFieldAsLineList(field))\n
...@@ -385,7 +375,7 @@ data_dict = {\n ...@@ -385,7 +375,7 @@ data_dict = {\n
\n \n
\'total_price_novat\': total_price,\n \'total_price_novat\': total_price,\n
\'description\': getFieldAsLineList(context.getDescription() or\n \'description\': getFieldAsLineList(context.getDescription() or\n
getPropertyFromModel(model, \'description\') or \'\'),\n model.getModelIneritanceEffectiveProperty(context, \'description\') or \'\'),\n
\'specialise_title\': context.getProperty(\'specialise_title\',\'\'),\n \'specialise_title\': context.getProperty(\'specialise_title\',\'\'),\n
\n \n
\'line_list\': line_list,\n \'line_list\': line_list,\n
...@@ -434,7 +424,6 @@ return unicodeDict(data_dict)\n ...@@ -434,7 +424,6 @@ return unicodeDict(data_dict)\n
<string>request</string> <string>request</string>
<string>use_line_title</string> <string>use_line_title</string>
<string>model</string> <string>model</string>
<string>getPropertyFromModel</string>
<string>getFieldAsLineList</string> <string>getFieldAsLineList</string>
<string>getFieldAsString</string> <string>getFieldAsString</string>
<string>getProductAndLineDesc</string> <string>getProductAndLineDesc</string>
......
2009-03-16 fabien
* add a field version on Pay Sheet Model
* use new methods from PaySheetModel class
2009-03-10 fabien 2009-03-10 fabien
* fix some minor problems * fix some minor problems
* add a default action on Pay Sheet Transaction portal type to be able to print a Payslip * add a default action on Pay Sheet Transaction portal type to be able to print a Payslip
......
364 377
\ 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