Commit 8c4f544c authored by Fabien Morin's avatar Fabien Morin

- add a reference on annotation line

- PaySheetTransaction_getLineListAsDict : add a method to check if the dict has
the property (getattr) instead of doing a lot of times the same thing.
Currently, there is a hack to display the % symbole in the OOoTemplate, but
when I will have time, OOoTemplate will be revriten using styles and will
well displaying percent numbers
- add Editable columns that permit to use the listbox fields (to display a %
symbol and use figure css class)
- PaySheetTransaction_getMovementList : move some variable that were calculated
a lot of times for nothing (because they were misplaced)
Add causality value
- Change employer/ee_share_rate and amount into price and quantity

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18312 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 85ab2455
......@@ -88,6 +88,7 @@
<value>
<list>
<string>my_title</string>
<string>my_reference</string>
<string>my_resource_title</string>
<string>my_source_title</string>
<string>my_destination_section_title</string>
......
......@@ -74,8 +74,28 @@ precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
\n
line_list = context.PaySheetTransaction_getMovementList(sort_on=[(\'int_index\',\n
\'ascending\')])\n
def addProperties(line, line_dict, property_list):\n
for property in property_list:\n
line_dict[property] = getattr(line, property, None)\n
\n
#XXX this is a hack wich should be removed when the OOoTemplate will be\n
# rewireted\n
if line_dict[property] is not None and property.endswith(\'_price\'):\n
line_dict[property] = \'%s %%\' % line_dict[property]\n
return line_dict\n
\n
line_dict_list = []\n
property_list = [ \'slice\',\n
\'base_participation_list\',\n
\'base_application_list\',\n
\'base_name\',\n
\'base\',\n
\'employer_share_price\',\n
\'employer_share_quantity\',\n
\'employee_share_price\',\n
\'employee_share_quantity\',\n
\'causality\',\n
]\n
for line in line_list: \n
if line.getResourceId() == \'total_employee_contributions\':\n
continue\n
......@@ -85,31 +105,7 @@ for line in line_list: \n
\'payroll_service\' : getattr(line, \'payroll_service\', None)\n
}\n
\n
line_dict[\'slice\'] = getattr(line, \'slice\', None)\n
#line_dict[\'title\'] = \'%s (%s)\' % (line_dict[\'title\'], line_dict[\'slice\'])\n
line_dict[\'base_participation_list\'] = getattr(line, \n
\'base_participation_list\', None)\n
line_dict[\'base_application_list\'] = getattr(line, \n
\'base_application_list\', None)\n
\n
line_dict[\'base_name\'] = getattr(line, \'base_name\', None)\n
\n
line_dict[\'base\'] = getattr(line, \'base\', None)\n
\n
line_dict[\'employer_share_rate\'] = getattr(line, \'employer_share_rate\', None)\n
if line_dict[\'employer_share_rate\'] != None:\n
line_dict[\'employer_share_rate\'] = \\\n
str(line_dict[\'employer_share_rate\']*100)+\'%\'\n
line_dict[\'employer_share_amount\'] = getattr(line, \'employer_share_amount\', \n
None)\n
\n
line_dict[\'employee_share_rate\'] = getattr(line, \'employee_share_rate\', None)\n
\n
if line_dict[\'employee_share_rate\'] != None:\n
line_dict[\'employee_share_rate\'] = \\\n
str(line_dict[\'employee_share_rate\']*100)+\'%\'\n
line_dict[\'employee_share_amount\'] = getattr(line, \'employee_share_amount\', \n
None)\n
addProperties(line=line, line_dict=line_dict, property_list=property_list)\n
\n
line_dict_list.append(line_dict)\n
\n
......@@ -162,15 +158,14 @@ return line_dict_list\n
<string>context</string>
<string>precision</string>
<string>line_list</string>
<string>addProperties</string>
<string>line_dict_list</string>
<string>property_list</string>
<string>_getiter_</string>
<string>line</string>
<string>getattr</string>
<string>None</string>
<string>line_dict</string>
<string>_write_</string>
<string>_getitem_</string>
<string>str</string>
</tuple>
</value>
</item>
......
......@@ -84,20 +84,20 @@ not_editable_columns = [(\'int_index\', \'Sort Index\'),\n
if not editable:\n
column_list.extend(not_editable_columns)\n
\n
for model_line in context.contentValues(portal_type=\'Pay Sheet Line\'):\n
else:\n
pass\n
# add here the editable column you want to use\n
\n
# this following columns are add for both edibales and not\n
for model_line in context.contentValues(portal_type=\'Pay Sheet Line\'):\n
for tax_category in model_line.getTaxCategoryValueList():\n
price = (tax_category.getId()+\'_rate\', tax_category.getTitle()+\' Rate\')\n
quantity = (tax_category.getId()+\'_amount\', \n
price = (tax_category.getId()+\'_price\', tax_category.getTitle()+\' Rate\')\n
quantity = (tax_category.getId()+\'_quantity\', \n
tax_category.getTitle()+\' Amount\')\n
if price not in column_list:\n
column_list.append(price)\n
column_list.append(quantity)\n
\n
else:\n
pass\n
# add here the editable column you want to use\n
# currently, it\'s not required to use editable columns\n
\n
return column_list\n
</string> </value>
</item>
......
......@@ -93,6 +93,14 @@ for paysheet_line in paysheet_line_list:\n
base_application_list = paysheet_line.getBaseAmountTitleList()\n
translated_base_application_list = [str(N_(x)) for x in base_application_list]\n
base_application_list = \', \'.join(translated_base_application_list)\n
payroll_service = paysheet_line.getResourceValue()\n
base_participation_list = payroll_service.getBaseAmountList()\n
causality = paysheet_line.getCausality()\n
\n
base_list = [str(N_(base_application)) for base_application in \\\n
paysheet_line.getBaseAmountTitleList()]\n
base_name = \'+\'.join(base_list)\n
\n
list_of_list = []\n
for base_category in base_category_list:\n
list = paysheet_line.getVariationCategoryList(base_category_list=\\\n
......@@ -113,23 +121,17 @@ for paysheet_line in paysheet_line_list:\n
\n
quantity = cell.getQuantity()\n
base = quantity\n
\n
base_list = [str(N_(base_application)) for base_application in \\\n
paysheet_line.getBaseAmountTitleList()]\n
base_name = \'+\'.join(base_list)\n
\n
payroll_service = paysheet_line.getResourceValue()\n
base_participation_list = payroll_service.getBaseAmountList()\n
\n
price = cell.getPrice()\n
share_dict[cell.getTaxCategory()+\'_rate\'] = price\n
share_dict[cell.getTaxCategory()+\'_amount\'] = round(quantity*price,\n
share_dict[cell.getTaxCategory()+\'_price\'] = price\n
share_dict[cell.getTaxCategory()+\'_quantity\'] = round(quantity*price,\n
precision)\n
\n
tuple_dict = {}\n
for item in tuple:\n
# the dict key is the base category and value is the category path\n
tuple_dict[item.split(\'/\')[0]]=context.portal_categories.restrictedTraverse(item).getTitle()\n
tuple_dict[item.split(\'/\')[0]] = \\\n
context.portal_categories.restrictedTraverse(item).getTitle()\n
tuple_dict[item.split(\'/\')[0]+\'_relative_url\']=item\n
\n
# we want to display as lines as a paysheet line as slices\n
......@@ -147,11 +149,13 @@ for paysheet_line in paysheet_line_list:\n
\'base\':base,\n
\'base_participation_list\':base_participation_list,\n
\'base_application_list\': base_application_list,\n
\'payroll_service\':payroll_service.getId()}\n
\'payroll_service\':payroll_service.getId(),\n
\'causality\': causality,}\n
object_dict[slice].update(share_dict)\n
else:\n
object_dict[slice].update(**share_dict)\n
\n
# print pprint.pformat(object_dict)\n
\n
for object_key in paysheet_line.getSalaryRangeList():\n
line_list.append(paysheet_line.asContext(**object_dict[object_key]))\n
......@@ -159,6 +163,8 @@ for paysheet_line in paysheet_line_list:\n
line_list.append(paysheet_line.asContext(**object_dict[\'no_slice\']))\n
\n
\n
#return printed\n
\n
# sort results\n
\n
def sortByTitleAscending(x, y):\n
......@@ -192,7 +198,6 @@ else:\n
\n
\n
\n
#return pprint.pformat(line_list)\n
return line_list\n
</string> </value>
</item>
......@@ -257,6 +262,12 @@ return line_list\n
<string>x</string>
<string>str</string>
<string>translated_base_application_list</string>
<string>payroll_service</string>
<string>base_participation_list</string>
<string>causality</string>
<string>base_application</string>
<string>base_list</string>
<string>base_name</string>
<string>list_of_list</string>
<string>base_category</string>
<string>list</string>
......@@ -272,11 +283,6 @@ return line_list\n
<string>cell</string>
<string>quantity</string>
<string>base</string>
<string>base_application</string>
<string>base_list</string>
<string>base_name</string>
<string>payroll_service</string>
<string>base_participation_list</string>
<string>price</string>
<string>_write_</string>
<string>round</string>
......
......@@ -96,11 +96,11 @@
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_employee_share_amount</string>
<string>listbox_employee_share_rate</string>
<string>listbox_employer_share_amount</string>
<string>listbox_employer_share_rate</string>
<string>listbox_base</string>
<string>listbox_employee_share_price</string>
<string>listbox_employee_share_quantity</string>
<string>listbox_employer_share_quantity</string>
<string>listbox_employer_share_price</string>
</list>
</value>
</item>
......
<?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>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employee_share_price</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>editable</string> </key>
<value> <string></string> </value>
</item>
<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>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_percent</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>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employee_share_quantity</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>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_money_quantity</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>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employer_share_price</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>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_percent</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>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employer_share_quantity</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>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_money_quantity</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>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -101,6 +101,10 @@
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>source_title</string>
<string>Service Provider</string>
......
......@@ -91,16 +91,16 @@ for line in line_dict_list:\n
string_to_display.append(rightPad(line[\'title\'], 40))\n
string_to_display.append(rightPad(line[\'base\'], 16))\n
\n
if line.has_key(\'employer_share_amount\'):\n
string_to_display.append(rightPad(str(line[\'employer_share_rate\']), 24))\n
string_to_display.append(rightPad(str(line[\'employer_share_amount\']), 24))\n
if line.has_key(\'employer_share_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employer_share_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employer_share_quantity\']), 24))\n
else:\n
string_to_display.append(rightPad(\' \', 24))\n
string_to_display.append(rightPad(\' \', 24))\n
\n
if line.has_key(\'employee_share_amount\'):\n
string_to_display.append(rightPad(str(line[\'employee_share_rate\']), 24))\n
string_to_display.append(rightPad(str(line[\'employee_share_amount\']), 24))\n
if line.has_key(\'employee_share_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employee_share_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employee_share_quantity\']), 24))\n
else:\n
string_to_display.append(rightPad(\' \', 24))\n
string_to_display.append(rightPad(\' \', 24))\n
......
187
\ No newline at end of file
188
\ 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