Commit 27d9749a authored by Fabien Morin's avatar Fabien Morin

- now getEffectiveModel handle parameter start_date and stop_date

- get Movement from Pay Sheet Line and Pay Sheet Model Line in PaySheetTransaction_getMovementList
- add base_id 'movement' to getCell
- now tax category is not mandatory, only base_contribution is
- typo
- in PaySheetTransaction_viewAsODT, remove tax_category from the getMovementTotalPriceFromCategory script
- add use_list to Payroll Service

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27442 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d48ee30b
...@@ -96,9 +96,9 @@ ...@@ -96,9 +96,9 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>your_section_category</string>
<string>your_from_date</string>
<string>your_at_date</string> <string>your_at_date</string>
<string>your_from_date</string>
<string>your_section_category</string>
<string>your_simulation_state</string> <string>your_simulation_state</string>
</list> </list>
</value> </value>
......
...@@ -96,11 +96,11 @@ ...@@ -96,11 +96,11 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>your_section_category</string>
<string>your_resource</string>
<string>your_mirror_section</string>
<string>your_from_date</string>
<string>your_at_date</string> <string>your_at_date</string>
<string>your_from_date</string>
<string>your_mirror_section</string>
<string>your_resource</string>
<string>your_section_category</string>
<string>your_simulation_state</string> <string>your_simulation_state</string>
</list> </list>
</value> </value>
......
...@@ -65,7 +65,9 @@ category_list = [\n ...@@ -65,7 +65,9 @@ category_list = [\n
]\n ]\n
new_category_dict = {}\n new_category_dict = {}\n
\n \n
model = paysheet.getSpecialiseValue().getEffectiveModel(paysheet)\n model = paysheet.getSpecialiseValue().getEffectiveModel(\\\n
start_date=paysheet.getStartDate(),\n
stop_date=paysheet.getStopDate())\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
...@@ -84,7 +86,8 @@ if price_currency:\n ...@@ -84,7 +86,8 @@ if 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
effective_model_list = model.getInheritanceEffectiveModelTreeAsList(paysheet)\n effective_model_list = model.findEffectiveSpecialiseValueList(\\\n
start_date=paysheet.getStartDate(), stop_date=paysheet.getStopDate())\n
for effective_model in effective_model_list:\n for effective_model in effective_model_list:\n
to_copy = effective_model.contentIds(filter=filter_dict)\n to_copy = effective_model.contentIds(filter=filter_dict)\n
if len(to_copy) > 0 :\n if len(to_copy) > 0 :\n
......
...@@ -94,7 +94,9 @@ else:\n ...@@ -94,7 +94,9 @@ 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().getEffectiveModel(context)\n model = context.getSpecialiseValue().getEffectiveModel(\\\n
start_date=context.getStartDate(),\n
stop_date=context.getStopDate())\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
......
...@@ -79,7 +79,7 @@ property_list = [ \'slice\',\n ...@@ -79,7 +79,7 @@ property_list = [ \'slice\',\n
\'employee_share_quantity\',\n \'employee_share_quantity\',\n
\'causality\',\n \'causality\',\n
]\n ]\n
for line in line_list: \n for line in line_list:\n
if line.getResourceId() == \'total_employee_contributions\':\n if line.getResourceId() == \'total_employee_contributions\':\n
continue\n continue\n
line_dict = {\n line_dict = {\n
...@@ -95,7 +95,6 @@ for line in line_list: \n ...@@ -95,7 +95,6 @@ for line in line_list: \n
\n \n
line_dict_list.append(line_dict)\n line_dict_list.append(line_dict)\n
\n \n
#return pprint.pformat(line_dict_list)\n
return line_dict_list\n return line_dict_list\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -66,7 +66,7 @@ import pprint\n ...@@ -66,7 +66,7 @@ import pprint\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
\n \n
portal = context.getPortalObject();\n portal = context.getPortalObject();\n
paysheet_line_list = context.contentValues(portal_type=\'Pay Sheet Line\')\n paysheet_line_list = context.contentValues(portal_type=(\'Pay Sheet Line\', \'Pay Sheet Model Line\'))\n
if context.getPriceCurrencyValue() is not None:\n if context.getPriceCurrencyValue() is not None:\n
precision = context.getPriceCurrencyValue().getQuantityPrecision()\n precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
else:\n else:\n
...@@ -100,18 +100,24 @@ for paysheet_line in paysheet_line_list:\n ...@@ -100,18 +100,24 @@ for paysheet_line in paysheet_line_list:\n
\n \n
object_dict = {}\n object_dict = {}\n
if cartesian_product == [[]] or cartesian_product == []:\n if cartesian_product == [[]] or cartesian_product == []:\n
line_list.append(paysheet_line)\n params = {\n
\'base\':paysheet_line.getTotalPrice(),\n
\'base_contribution_list\':base_contribution_list,\n
\'base_application_list\': base_application_list,\n
\'payroll_service\': payroll_service is not None and\\\n
payroll_service.getId() or \'\',\n
\'causality\': causality,}\n
line_list.append(paysheet_line.asContext(**params))\n
continue\n continue\n
\n \n
for tuple in cartesian_product:\n for product in cartesian_product:\n
indice += 1\n indice += 1\n
share_dict = {}\n share_dict = {}\n
cell = paysheet_line.getCell(*tuple)\n cell = paysheet_line.getCell(base_id=\'movement\', *product)\n
if cell is None:\n if cell is None:\n
continue\n continue\n
\n \n
quantity = cell.getQuantity()\n base = cell.getQuantity()\n
base = quantity\n
\n \n
share_dict[cell.getTaxCategory()+\'_price\'] = cell.getPrice()\n share_dict[cell.getTaxCategory()+\'_price\'] = cell.getPrice()\n
share_dict[cell.getTaxCategory()+\'_quantity\'] = cell.getQuantity()\n share_dict[cell.getTaxCategory()+\'_quantity\'] = cell.getQuantity()\n
...@@ -119,7 +125,7 @@ for paysheet_line in paysheet_line_list:\n ...@@ -119,7 +125,7 @@ for paysheet_line in paysheet_line_list:\n
round(cell.getTotalPrice(), precision)\n round(cell.getTotalPrice(), precision)\n
\n \n
tuple_dict = {}\n tuple_dict = {}\n
for item in tuple:\n for item in product:\n
# the dict key is the base category and value is the category path\n # the dict key is the base category and value is the category path\n
tuple_dict[item.split(\'/\')[0]] = \\\n tuple_dict[item.split(\'/\')[0]] = \\\n
portal.portal_categories.restrictedTraverse(item).getShortTitle() or \\\n portal.portal_categories.restrictedTraverse(item).getShortTitle() or \\\n
...@@ -127,7 +133,7 @@ for paysheet_line in paysheet_line_list:\n ...@@ -127,7 +133,7 @@ for paysheet_line in paysheet_line_list:\n
tuple_dict[item.split(\'/\')[0]+\'_relative_url\']=item\n tuple_dict[item.split(\'/\')[0]+\'_relative_url\']=item\n
\n \n
# we want to display as lines as a paysheet line as slices\n # we want to display as lines as a paysheet line as slices\n
# this is esay to read\n # this is easier to read\n
slice = cell.getSalaryRange()\n slice = cell.getSalaryRange()\n
if slice is None:\n if slice is None:\n
slice = \'no_slice\'\n slice = \'no_slice\'\n
...@@ -141,7 +147,8 @@ for paysheet_line in paysheet_line_list:\n ...@@ -141,7 +147,8 @@ for paysheet_line in paysheet_line_list:\n
\'base\':base,\n \'base\':base,\n
\'base_contribution_list\':base_contribution_list,\n \'base_contribution_list\':base_contribution_list,\n
\'base_application_list\': base_application_list,\n \'base_application_list\': base_application_list,\n
\'payroll_service\':payroll_service.getId(),\n \'payroll_service\': payroll_service is not None and\\\n
payroll_service.getId() or \'\',\n
\'causality\': causality,}\n \'causality\': causality,}\n
object_dict[slice].update(share_dict)\n object_dict[slice].update(share_dict)\n
else:\n else:\n
...@@ -260,12 +267,12 @@ return line_list\n ...@@ -260,12 +267,12 @@ return line_list\n
<string>previous_share</string> <string>previous_share</string>
<string>indice</string> <string>indice</string>
<string>object_dict</string> <string>object_dict</string>
<string>tuple</string> <string>params</string>
<string>_apply_</string>
<string>product</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>share_dict</string> <string>share_dict</string>
<string>_apply_</string>
<string>cell</string> <string>cell</string>
<string>quantity</string>
<string>base</string> <string>base</string>
<string>_write_</string> <string>_write_</string>
<string>round</string> <string>round</string>
......
...@@ -62,10 +62,16 @@ ...@@ -62,10 +62,16 @@
total_price = 0\n total_price = 0\n
movement_list = context.getMovementList(portal_type=(\'Pay Sheet Line\', \'Pay Sheet Cell\'))\n movement_list = context.getMovementList(portal_type=(\'Pay Sheet Line\', \'Pay Sheet Cell\'))\n
for movement in movement_list:\n for movement in movement_list:\n
if base_contribution is not None and tax_category is not None and\\\n if base_contribution is not None and movement.isMemberOf(base_contribution):\n
movement.isMemberOf(tax_category) and movement.isMemberOf(base_contribution):\n \n
# base_contribution is mandatory, but not tax_category. If tax_category is\n
# given, search with it, if not, care only about base_contribution\n
if tax_category is not None and movement.isMemberOf(tax_category):\n
total_price += movement.getTotalPrice()\n
elif tax_category is None or len(movement.getTaxCategoryList()) == 0:\n
total_price += movement.getTotalPrice()\n total_price += movement.getTotalPrice()\n
\n \n
\n
# Get Precision\n # Get Precision\n
precision = context.getPriceCurrencyValue().getQuantityPrecision()\n precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
\n \n
...@@ -117,6 +123,7 @@ return amount\n ...@@ -117,6 +123,7 @@ return amount\n
<string>movement</string> <string>movement</string>
<string>None</string> <string>None</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>len</string>
<string>precision</string> <string>precision</string>
<string>round</string> <string>round</string>
<string>amount</string> <string>amount</string>
......
...@@ -59,7 +59,8 @@ request = context.REQUEST\n ...@@ -59,7 +59,8 @@ 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().getEffectiveModel(context)\n model = context.getSpecialiseValue().getEffectiveModel(\\\n
start_date=context.getStartDate(), stop_date=context.getStopDate())\n
\n \n
def getFieldAsString(field):\n def getFieldAsString(field):\n
return \', \'.join(getFieldAsLineList(field))\n return \', \'.join(getFieldAsLineList(field))\n
......
...@@ -77,7 +77,7 @@ base_amount = portal.portal_categories.base_amount\n ...@@ -77,7 +77,7 @@ base_amount = portal.portal_categories.base_amount\n
for category in base_contribution_list:\n for category in base_contribution_list:\n
category_value = getattr(base_amount, category, None)\n category_value = getattr(base_amount, category, None)\n
if category_value is None:\n if category_value is None:\n
raise ValueError, \'Category "%s/%s" not found.\' % (base_amount.getPath(), category) \n raise ValueError, \'Category "%s/%s" not found.\' % (base_amount.getPath(), category)\n
base_contribution_uid_list = category_value.getUid()\n base_contribution_uid_list = category_value.getUid()\n
\n \n
params = {\n params = {\n
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<value> <string>DEBUG = 0\n <value> <string>DEBUG = 0\n
LOG = lambda msg:context.log("PaySheetTransaction_selectMovement", msg)\n LOG = lambda msg:context.log("PaySheetTransaction_selectMovement", msg)\n
\n \n
search_kw=dict( \n search_kw=dict(\n
parent_specialise_portal_type=\'Invoice Transaction Rule\',\n parent_specialise_portal_type=\'Invoice Transaction Rule\',\n
explanation_portal_type=[\'Pay Sheet Transaction\'],\n explanation_portal_type=[\'Pay Sheet Transaction\'],\n
portal_type=\'Simulation Movement\',\n portal_type=\'Simulation Movement\',\n
...@@ -70,12 +70,12 @@ kw.update(context.portal_catalog.buildSQLQuery(**search_kw))\n ...@@ -70,12 +70,12 @@ kw.update(context.portal_catalog.buildSQLQuery(**search_kw))\n
if DEBUG :\n if DEBUG :\n
LOG("SQL used (for %s) = %s" % (kw, context.InvoiceTransaction_zSelectMovement(src__=1, **kw)))\n LOG("SQL used (for %s) = %s" % (kw, context.InvoiceTransaction_zSelectMovement(src__=1, **kw)))\n
\n \n
movement_list = [] \n movement_list = []\n
for movement in context.InvoiceTransaction_zSelectMovement(**kw) :\n for movement in context.InvoiceTransaction_zSelectMovement(**kw) :\n
movement = movement.getObject()\n movement = movement.getObject()\n
if movement.getDeliveryValue() is None :\n if movement.getDeliveryValue() is None :\n
movement_list.append(movement)\n movement_list.append(movement)\n
else : \n else :\n
LOG("simulation movement %s should not have been selected !" % movement.getPath())\n LOG("simulation movement %s should not have been selected !" % movement.getPath())\n
\n \n
if DEBUG :\n if DEBUG :\n
......
...@@ -420,7 +420,7 @@ AAA=</string> </value> ...@@ -420,7 +420,7 @@ AAA=</string> </value>
<text:p text:style-name=\'Item_20_Table_20_Title_20_Left\' tal:content=\'python: here.Base_translateString("Gross Salary")\'>1</text:p>\n <text:p text:style-name=\'Item_20_Table_20_Title_20_Left\' tal:content=\'python: here.Base_translateString("Gross Salary")\'>1</text:p>\n
</table:table-cell>\n </table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n <table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Table_20_Contents_20_Right\' tal:content=\'python:quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution="base_contribution/base_amount/gross_salary", tax_category="tax_category/employee_share"))\'>400 000</text:p>\n <text:p text:style-name=\'Table_20_Contents_20_Right\' tal:content=\'python:quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution="base_contribution/base_amount/gross_salary"))\'>400 000</text:p>\n
</table:table-cell>\n </table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n <table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Table_20_Contents\'/>\n <text:p text:style-name=\'Table_20_Contents\'/>\n
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_quantity_unit</string> <string>my_quantity_unit</string>
<string>my_product_line</string> <string>my_product_line</string>
<string>my_use_list</string>
</list> </list>
</value> </value>
</item> </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>title</string>
<string>items</string>
<string>hash_script_id</string>
<string>required</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_use_list</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>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</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>field_id</string> </key>
<value> <string>my_parallel_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPDMFieldLibrary</string> </value>
</item>
<item>
<key> <string>hash_script_id</string> </key>
<value> <string>Base_hashCategoryList</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </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>Use</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', filter_node=1)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
448 449
\ 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