Commit 1eb5fb2c authored by Fabien Morin's avatar Fabien Morin

2009-01-28 fabien

* remove some unused script and refeactor some very similar scripts in a generic one

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25326 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 863cfd4d
<?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>\'\'\'\n
return the amount composed by all amount of paysheet line wich category of\n
category_list parameter is in variation_category_list of the PaySheet line \n
and wich has a base_contribution in the base_contribution_list\n
\'\'\'\n
\n
# test the list parameters\n
if base_contribution_list is None:\n
base_contribution_list = []\n
elif not (same_type(base_contribution_list, []) or\n
same_type(base_contribution_list, ())):\n
base_contribution_list = [base_contribution_list]\n
\n
if category_list is None:\n
category_list = []\n
elif not (same_type(category_list, []) or same_type(category_list, ())):\n
category_list = [category_list]\n
\n
\n
# Get Precision\n
precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
\n
paysheet = context\n
amount = 0\n
\n
for pay_sheet_line in paysheet.contentValues(portal_type=\'Pay Sheet Line\'):\n
for base_contribution in base_contribution_list:\n
if base_contribution in pay_sheet_line.getBaseContributionList():\n
if pay_sheet_line.getSalaryRangeList(base=1) != []:\n
for slice in pay_sheet_line.getSalaryRangeList(base=1):\n
for category in category_list:\n
if category in pay_sheet_line.getVariationCategoryList():\n
cell = pay_sheet_line.getCell(slice, category)\n
if cell is None:\n
continue\n
total_price = cell.getQuantity() * cell.getPrice()\n
amount += total_price\n
else:\n
for category in category_list:\n
if category in pay_sheet_line.getVariationCategoryList():\n
cell = pay_sheet_line.getCell(category)\n
if cell is None:\n
continue\n
total_price = cell.getQuantity() * cell.getPrice()\n
amount += total_price\n
\n
break # this permit to add only one time the amount even \n
# if many base_amount are in base_contribution_list\n
\n
amount = round(amount, precision)\n
return amount\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_contribution_list=None, category_list=None</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>base_contribution_list</string>
<string>category_list</string>
<string>None</string>
<string>same_type</string>
<string>_getattr_</string>
<string>context</string>
<string>precision</string>
<string>paysheet</string>
<string>amount</string>
<string>_getiter_</string>
<string>pay_sheet_line</string>
<string>base_contribution</string>
<string>slice</string>
<string>category</string>
<string>cell</string>
<string>total_price</string>
<string>_inplacevar_</string>
<string>round</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getAmountFromBaseParticipationList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,27 +53,23 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if paysheet is None:\n
paysheet = context\n
<value> <string>\'\'\'\n
return the amount composed by all amount of paysheet line wich category of\n
category_list parameter is in variation_category_list of the PaySheet line \n
and wich has a base_contribution in the base_contribution_list\n
\'\'\'\n
\n
portal = context.getPortalObject();\n
portal_simulation = portal.portal_simulation\n
total_price = 0\n
movement_list = context.getMovementList(portal_type=(\'Pay Sheet Line\', \'Pay Sheet Cell\'))\n
for movement in movement_list:\n
if movement.isMemberOf(tax_category) and movement.isMemberOf(base_contribution):\n
total_price += movement.getTotalPrice()\n
\n
params = {\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
\'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
\'section_uid\' : paysheet.getDestinationSectionUid(),\n
\'tax_category_uid\' :\\\n
portal.portal_categories.tax_category.employee_share.getUid(),\n
\'to_date\' : paysheet.getStartDate(),\n
\'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n
\'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
\'resource_category\' : [\'base_amount/overtime\',]\n
#\'src__\' : 1\n
}\n
# Get Precision\n
precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
\n
return portal_simulation.getInventoryAssetPrice(**params)\n
amount = round(total_price, precision)\n
return amount\n
</string> </value>
</item>
<item>
......@@ -84,7 +80,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>paysheet=None</string> </value>
<value> <string>base_contribution=None, tax_category=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -104,21 +100,24 @@ return portal_simulation.getInventoryAssetPrice(**params)\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>paysheet</string>
<string>None</string>
<string>context</string>
<string>base_contribution</string>
<string>tax_category</string>
<string>total_price</string>
<string>_getattr_</string>
<string>portal</string>
<string>portal_simulation</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
<string>context</string>
<string>movement_list</string>
<string>_getiter_</string>
<string>movement</string>
<string>_inplacevar_</string>
<string>precision</string>
<string>round</string>
<string>amount</string>
</tuple>
</value>
</item>
......@@ -132,12 +131,13 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateOvertimeAmount</string> </value>
<value> <string>PaySheetTransaction_getMovementTotalPriceFromCategory</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -53,12 +53,29 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if paysheet is None:\n
<value> <string>\'\'\'\n
this script return the total price of the base contribution list\n
from the first of january of the year of the paysheet and until\n
the start_date of this current paysheet.\n
\'\'\'\n
\n
if paysheet is None:\n
paysheet = context\n
\n
# test the list parameters\n
if base_contribution_list is None:\n
base_contribution_list = []\n
elif not (same_type(base_contribution_list, []) or\n
same_type(base_contribution_list, ())):\n
base_contribution_list = [base_contribution_list]\n
\n
portal = context.getPortalObject();\n
portal_simulation = portal.portal_simulation\n
\n
base_amount = portal.portal_categories.base_amount\n
context.log(base_contribution_list)\n
base_contribution_uid_list = [getattr(base_amount, category, None).getUid() for category in base_contribution_list]\n
\n
params = {\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
\'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
......@@ -69,7 +86,7 @@ params = {\n
\'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n
\'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
\'resource_category\' : [\'base_amount/base_salary\',]\n
\'base_contribution_uid\' : base_contribution_uid_list,\n
#\'src__\' : 1\n
}\n
\n
......@@ -84,7 +101,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>paysheet=None</string> </value>
<value> <string>paysheet=None, base_contribution_list=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -104,18 +121,27 @@ return portal_simulation.getInventoryAssetPrice(**params)\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>paysheet</string>
<string>base_contribution_list</string>
<string>None</string>
<string>context</string>
<string>same_type</string>
<string>_getattr_</string>
<string>portal</string>
<string>portal_simulation</string>
<string>base_amount</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>category</string>
<string>getattr</string>
<string>base_contribution_uid_list</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
......@@ -132,12 +158,13 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateBaseSalary</string> </value>
<value> <string>PaySheetTransaction_getYearToDateBaseContributionTotalPrice</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
<?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>if paysheet is None:\n
paysheet = context\n
\n
portal = context.getPortalObject();\n
portal_simulation = portal.portal_simulation\n
\n
params = {\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
\'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
\'section_uid\' : paysheet.getDestinationSectionUid(),\n
\'tax_category_uid\' :\\\n
portal.portal_categories.tax_category.employee_share.getUid(),\n
\'to_date\' : paysheet.getStartDate(),\n
\'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n
\'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
\'resource_category\' : [\'base_amount/gross_salary\',]\n
#\'src__\' : 1\n
}\n
\n
return portal_simulation.getInventoryAssetPrice(**params)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>paysheet=None</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>paysheet</string>
<string>None</string>
<string>context</string>
<string>_getattr_</string>
<string>portal</string>
<string>portal_simulation</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateGrossSalary</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>if paysheet is None:\n
paysheet = context\n
\n
portal = context.getPortalObject();\n
portal_simulation = portal.portal_simulation\n
\n
params = {\n
\'section_uid\' : paysheet.getDestinationSectionUid(),\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
\'tax_category_uid\' :\\\n
portal.portal_categories.tax_category.employee_share.getUid(),\n
\'to_date\' : paysheet.getStartDate(),\n
\'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n
\'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
\'resource_category\' : [\'base_amount/deductible_tax\', \n
\'base_amount/non_deductible_tax\'],\n
}\n
\n
deductible_tax = portal_simulation.getInventoryAssetPrice(**params)\n
over_time = paysheet.PaySheetTransaction_getYearToDateOvertimeAmount()\n
gross_salary = paysheet.PaySheetTransaction_getYearToDateGrossSalary() \n
net_pay = gross_salary - over_time - deductible_tax\n
\n
return net_pay\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>paysheet=None</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>paysheet</string>
<string>None</string>
<string>context</string>
<string>_getattr_</string>
<string>portal</string>
<string>portal_simulation</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
<string>deductible_tax</string>
<string>over_time</string>
<string>gross_salary</string>
<string>net_pay</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateNetPay</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>if paysheet is None:\n
paysheet = context\n
\n
portal = context.getPortalObject();\n
portal_simulation = portal.portal_simulation\n
\n
params = {\n
\'section_uid\' : paysheet.getDestinationSectionUid(),\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
\'tax_category_uid\' :\\\n
portal.portal_categories.tax_category.employee_share.getUid(),\n
\'to_date\' : paysheet.getStartDate(),\n
\'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n
\'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
\'resource_category\' : [\'base_amount/deductible_tax\', ],\n
}\n
\n
\n
\n
deductible_tax = portal_simulation.getInventoryAssetPrice(**params)\n
over_time = paysheet.PaySheetTransaction_getYearToDateOvertimeAmount()\n
gross_salary = paysheet.PaySheetTransaction_getYearToDateGrossSalary()\n
\n
taxable_net_pay = gross_salary - over_time - deductible_tax\n
\n
return taxable_net_pay\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>paysheet=None</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>paysheet</string>
<string>None</string>
<string>context</string>
<string>_getattr_</string>
<string>portal</string>
<string>portal_simulation</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
<string>deductible_tax</string>
<string>over_time</string>
<string>gross_salary</string>
<string>taxable_net_pay</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateTaxableNetPay</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2009-01-28 fabien
* remove some unused script and refeactor some very similar scripts in a generic one
2009-01-21 fabien
* remove unused field base_amount_list
* change error messages in PaySheetTransaction_checkParameters to be consistant with other translations
......
339
\ No newline at end of file
343
\ 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