Commit 7306b7af authored by Fabien Morin's avatar Fabien Morin

use getSubObjectValueList method to search sub object in all modell depencies tree

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18337 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96234e63
...@@ -70,12 +70,12 @@ ...@@ -70,12 +70,12 @@
portal_type_list) in the paysheet\n portal_type_list) in the paysheet\n
\'\'\'\n \'\'\'\n
\n \n
model = context.getSpecialiseValue()\n sub_object_list = context.getSubObjectValueList(portal_type_list)\n
subobject_list = model.contentValues(portal_type=portal_type_list)\n sub_object_uid_list = [x.getUid() for x in sub_object_list]\n
subobject_id_list = [x.getId() for x in subobject_list]\n
\n \n
# copy model object\n # copy model object\n
copy_data = model.manage_copyObjects(ids=subobject_id_list)\n model = context.getSpecialiseValue()\n
copy_data = model.manage_copyObjects(uids=sub_object_uid_list)\n
\n \n
# paste into context (paysheet) folder\n # paste into context (paysheet) folder\n
context.manage_pasteObjects(copy_data)\n context.manage_pasteObjects(copy_data)\n
...@@ -124,13 +124,13 @@ context.manage_pasteObjects(copy_data)\n ...@@ -124,13 +124,13 @@ context.manage_pasteObjects(copy_data)\n
<string>portal_type_list</string> <string>portal_type_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>model</string> <string>sub_object_list</string>
<string>subobject_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>x</string> <string>x</string>
<string>subobject_id_list</string> <string>sub_object_uid_list</string>
<string>model</string>
<string>copy_data</string> <string>copy_data</string>
</tuple> </tuple>
</value> </value>
......
...@@ -78,8 +78,15 @@ import pprint\n ...@@ -78,8 +78,15 @@ import pprint\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
\n \n
def sortByIntIndex(a, b):\n
return cmp(a.getIntIndex(), b.getIntIndex())\n
\n
model = context.getSpecialiseValue(0)\n model = context.getSpecialiseValue(0)\n
model_line_list = model.contentValues(portal_type=\'Pay Sheet Model Line\')\n portal_type_list = [\'Pay Sheet Model Line\']\n
sub_object_list = context.getSubObjectValueList(portal_type_list)\n
sub_object_list.sort(sortByIntIndex)\n
model_line_list = sub_object_list\n
\n
# remove editable model line\n # remove editable model line\n
model_line_list = [x.getObject() for x in model_line_list \\\n model_line_list = [x.getObject() for x in model_line_list \\\n
if x.getObject().isEditable()]\n if x.getObject().isEditable()]\n
...@@ -268,9 +275,12 @@ return line_list\n ...@@ -268,9 +275,12 @@ return line_list\n
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
<string>N_</string> <string>N_</string>
<string>sortByIntIndex</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>model</string> <string>model</string>
<string>portal_type_list</string>
<string>sub_object_list</string>
<string>model_line_list</string> <string>model_line_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
......
...@@ -81,8 +81,15 @@ not_editable_columns = [ (\'title\', \'Title\'),\n ...@@ -81,8 +81,15 @@ not_editable_columns = [ (\'title\', \'Title\'),\n
if not editable:\n if not editable:\n
column_list.extend(not_editable_columns)\n column_list.extend(not_editable_columns)\n
\n \n
model = context.getSpecialiseValue()\n def sortByIntIndex(a, b):\n
model_line_list = model.contentValues(portal_type=\'Pay Sheet Model Line\')\n return cmp(a.getIntIndex(), b.getIntIndex())\n
\n
model = context.getSpecialiseValue(0)\n
portal_type_list = [\'Pay Sheet Model Line\']\n
sub_object_list = context.getSubObjectValueList(portal_type_list)\n
sub_object_list.sort(sortByIntIndex)\n
model_line_list = sub_object_list\n
\n
model_line_list = [line for line in model_line_list if line.isEditable()]\n model_line_list = [line for line in model_line_list if line.isEditable()]\n
\n \n
for model_line in model_line_list:\n for model_line in model_line_list:\n
...@@ -147,8 +154,11 @@ return column_list\n ...@@ -147,8 +154,11 @@ return column_list\n
<string>column_list</string> <string>column_list</string>
<string>not_editable_columns</string> <string>not_editable_columns</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>sortByIntIndex</string>
<string>context</string> <string>context</string>
<string>model</string> <string>model</string>
<string>portal_type_list</string>
<string>sub_object_list</string>
<string>model_line_list</string> <string>model_line_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
......
...@@ -83,7 +83,13 @@ paysheet_list = accounting_module.searchFolder( **search_params)\n ...@@ -83,7 +83,13 @@ paysheet_list = accounting_module.searchFolder( **search_params)\n
\n \n
yearly_work_time = 0\n yearly_work_time = 0\n
for paysheet in paysheet_list:\n for paysheet in paysheet_list:\n
yearly_work_time += paysheet.getOvertimeAnnotationLineQuantity(0)\n annotation_line = context.getAnnotationLineFromReference(\\\n
reference=\'overtime_small_rate\')\n
nb_heures_supp = annotation_line.getQuantity()\n
annotation_line = context.getAnnotationLineFromReference(\\\n
reference=\'overtime_big_rate\')\n
nb_heures_supp += annotation_line.getQuantity()\n
yearly_work_time += nb_heures_supp \n
\n \n
return yearly_work_time\n return yearly_work_time\n
</string> </value> </string> </value>
...@@ -141,6 +147,8 @@ return yearly_work_time\n ...@@ -141,6 +147,8 @@ return yearly_work_time\n
<string>yearly_work_time</string> <string>yearly_work_time</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>paysheet</string> <string>paysheet</string>
<string>annotation_line</string>
<string>nb_heures_supp</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
</tuple> </tuple>
</value> </value>
......
...@@ -83,7 +83,10 @@ paysheet_list = accounting_module.searchFolder( **search_params)\n ...@@ -83,7 +83,10 @@ paysheet_list = accounting_module.searchFolder( **search_params)\n
\n \n
yearly_work_time = 0\n yearly_work_time = 0\n
for paysheet in paysheet_list:\n for paysheet in paysheet_list:\n
yearly_work_time += paysheet.getWorkTimeAnnotationLineQuantity(0)\n annotation_line = context.getAnnotationLineFromReference(\\\n
reference=\'work_time_annotation_line\')\n
nb_heures = annotation_line.getQuantity()\n
yearly_work_time += nb_heures\n
\n \n
return yearly_work_time\n return yearly_work_time\n
</string> </value> </string> </value>
...@@ -141,6 +144,8 @@ return yearly_work_time\n ...@@ -141,6 +144,8 @@ return yearly_work_time\n
<string>yearly_work_time</string> <string>yearly_work_time</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>paysheet</string> <string>paysheet</string>
<string>annotation_line</string>
<string>nb_heures</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
</tuple> </tuple>
</value> </value>
......
...@@ -115,15 +115,14 @@ ...@@ -115,15 +115,14 @@
<string>listbox_employer_share_price</string> <string>listbox_employer_share_price</string>
<string>listbox_employee_share_quantity</string> <string>listbox_employee_share_quantity</string>
<string>listbox_employer_share_quantity</string> <string>listbox_employer_share_quantity</string>
<string>listbox_salary_range</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list/>
<string>listbox_salary_range</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
189 193
\ 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