From 9e4c36d56ce88f93fff947b6451582c522c85a1e Mon Sep 17 00:00:00 2001 From: Kevin Deldycke <kevin@nexedi.com> Date: Tue, 7 Mar 2006 17:48:39 +0000 Subject: [PATCH] 2006-02-27 Kevin * Update AccountingTransactionModule_viewAnnualSalaryReport to show more paysheet conflicts by default. * Add AccountingModule_checkPaySheetConsistency, a usefull, but dirty, script to track bad destination and destination_section on Pay Sheet Lines. 2006-02-24 Kevin * Update PaySheetTransaction_viewAccountingLineList form. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6027 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...ountingModule_checkPaySheetConsistency.xml | 201 ++++++++++++++++++ ...ansactionModule_viewAnnualSalaryReport.xml | 41 ++-- ...heetTransaction_viewAccountingLineList.xml | 2 +- .../listbox.xml | 20 +- bt5/erp5_payroll/bt/change_log | 7 + 5 files changed, 247 insertions(+), 24 deletions(-) create mode 100755 bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingModule_checkPaySheetConsistency.xml diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingModule_checkPaySheetConsistency.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingModule_checkPaySheetConsistency.xml new file mode 100755 index 0000000000..fbac9a6c1d --- /dev/null +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingModule_checkPaySheetConsistency.xml @@ -0,0 +1,201 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> <string encoding="base64">O/INCg==</string> </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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 encoding="cdata"><![CDATA[ + +"""\n + Usefull, but dirty, script to track bad destination and destination_section on pay sheet line.\n +"""\n +\n +print "<html>"\n +print "<h1>Check PaySheets Consistency</h1>"\n +for pay_sheet in context.accounting_module.objectValues(portal_type = [\'Pay Sheet Transaction\']):\n + if pay_sheet.getSimulationState() not in (\'cancelled\', \'delivered\'):\n + if str(pay_sheet.getStartDate()).split(\'/\')[0] == \'2005\':\n + print "<br/>"\n + print "<h2><a href=\'%s\'>%s - %s</a> [%s]</h2>" % (pay_sheet.absolute_url(), pay_sheet.getTitle(), pay_sheet.getStartDate(), pay_sheet.getSimulationState())\n + for pay_sheet_line in pay_sheet.objectValues(portal_type = [\'Pay Sheet Line\']):\n + social_service = pay_sheet_line.getResourceValue()\n + supplier = social_service.getSourceValue()\n + ps_destination = pay_sheet_line.getDestinationValue()\n + ps_destination_section = pay_sheet_line.getDestinationSectionValue()\n + if supplier != None:\n + if supplier != ps_destination:\n + print "<a href=\'%s\'>%s [%s]</a> has bad destination (%s instead of %s) <br/>" % ( pay_sheet_line.absolute_url()\n + , pay_sheet_line.getPath()\n + , pay_sheet_line.getTitle()\n + , repr(ps_destination).replace(\'>\', \']\').replace(\'<\', \'[\')\n + , repr(supplier).replace(\'>\', \']\').replace(\'<\', \'[\')\n + )\n + # pay_sheet_line.setDestinationValue(supplier)\n + if supplier != ps_destination_section:\n + print "<a href=\'%s\'>%s [%s]</a> has bad destination_section (%s instead of %s) <br/>" % ( pay_sheet_line.absolute_url()\n + , pay_sheet_line.getPath()\n + , pay_sheet_line.getTitle()\n + , repr(ps_destination_section).replace(\'>\', \']\').replace(\'<\', \'[\')\n + , repr(supplier).replace(\'>\', \']\').replace(\'<\', \'[\')\n + )\n + # pay_sheet_line.setDestinationSectionValue(supplier)\n + elif social_service.getId() != \'labour\':\n + print "<font color=\'#f00\'><a href=\'%s\'>%s [%s]</a> <b>Supplier is None !</b></font><br/>" % ( pay_sheet_line.absolute_url()\n + , pay_sheet_line.getPath()\n + , pay_sheet_line.getTitle()\n + )\n +print "</html>"\n +return printed\n + + +]]></string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/AccountingModule_checkPaySheetConsistency</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_print_</string> + <string>_print</string> + <string>_getiter_</string> + <string>_getattr_</string> +<string>context</string> + <string>pay_sheet</string> + <string>_getitem_</string> + <string>str</string> + <string>pay_sheet_line</string> + <string>social_service</string> + <string>supplier</string> + <string>ps_destination</string> + <string>ps_destination_section</string> + <string>None</string> + <string>repr</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>AccountingModule_checkPaySheetConsistency</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_viewAnnualSalaryReport.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_viewAnnualSalaryReport.xml index 585aa18f91..dcb11d2065 100755 --- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_viewAnnualSalaryReport.xml +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_viewAnnualSalaryReport.xml @@ -73,8 +73,9 @@ portal_catalog = context.getPortalObject().portal_catalog\n \n query = {\n "portal_type" : "Pay Sheet Transaction",\n - "simulation_state" : ["confirmed", "stopped", "delivered"],\n + "simulation_state" : ["confirmed", "stopped", "delivered", "draft", "planned"],\n "delivery.stop_date" : ">2004-12-31",\n + "delivery.start_date" : "<2005-12-31",\n "sort_on" : ("delivery.start_date", "ASC")\n }\n \n @@ -104,20 +105,21 @@ for p, paysheets in paysheet_par_person.items() :\n gathered_data[p] = {}\n for paysheet in paysheets :\n start_month = paysheet.start_date.month() - 1\n - if not gathered_data[p].has_key (start_month) :\n + if not gathered_data[p].has_key(start_month) :\n gathered_data[p][start_month] = {}\n - if gathered_data[p][start_month].has_key ("salary") :\n - if not gathered_data[p][start_month].has_key("doubles") :\n - gathered_data[p][start_month]["doubles"] = 0\n - gathered_data[p][start_month]["doubles"] = gathered_data [p][start_month]["doubles"] + 1\n + if gathered_data[p][start_month].has_key("salary") :\n + if not gathered_data[p][start_month].has_key("duplicates") :\n + gathered_data[p][start_month]["duplicates"] = []\n + gathered_data[p][start_month]["duplicates"].append(paysheet)\n else :\n # get the taxable salary\n ps_details = paysheet.PaySheetTransaction_getDetails()\n salary_value = ps_details[salary_type]\n # Round the value the same way it is printed by PaySheetTransaction_viewPaySheetTransactionAsPDF.\n # In fact the rounding must be done by PaySheetTransaction_getDetails to homogenize the value in the paysheet module.\n - gathered_data [p][start_month]["salary"] = float(\'%.2f\' % salary_value)\n - gathered_data [p][start_month]["url"] = paysheet.getPath()\n + gathered_data[p][start_month]["salary"] = float(\'%.2f\' % salary_value)\n + gathered_data[p][start_month]["url"] = paysheet.getPath()\n + gathered_data[p][start_month]["state"] = paysheet.getSimulationState()\n \n # DISPLAY part\n \n @@ -129,12 +131,14 @@ print """\n <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n <title>R\xc3\xa9capitulatif des salaires bruts</title>\n <style>\n -a {\n - text-decoration : none;\n -}\n -a:hover {\n - text-decoration : underline;\n -}\n +a {text-decoration : none;}\n +a:hover {text-decoration : underline;}\n +\n +.warning {color: #f00;}\n +.warning a:link {color: #f00;}\n +.warning a:visited {color: #f00;}\n +.warning a:hover {color: #f00;}\n +\n table {\n border-collapse : collapse;\n }\n @@ -194,8 +198,10 @@ for person_path, person_dict in gathered_data.items() :\n monthly_total[month] = 0\n monthly_total[month] = monthly_total[month] + person_dict[month]["salary"]\n print "<a href=\\"%s\\">%s</a>" % (person_dict[month]["url"], person_dict[month]["salary"])\n - if person_dict[month].has_key("doubles") :\n - print "!" * person_dict[month]["doubles"]\n + if person_dict[month].has_key("duplicates"):\n + print "[%s]<br/>" % (person_dict[month]["state"])\n + for dup_ps in person_dict[month]["duplicates"]:\n + print "<span class=\'warning\'><a href=\'%s\'><b>%s !</b> [%s]</a></span><br/>" % (dup_ps.absolute_url(), dup_ps.getGrossSalary(), dup_ps.getSimulationState())\n print "</td>"\n print "<td>%s</td></tr>" % person_total\n total += person_total\n @@ -273,7 +279,7 @@ return printed\n <string>_print</string> <string>DateTime</string> <string>_getattr_</string> -<string>context</string> + <string>context</string> <string>portal_catalog</string> <string>query</string> <string>paysheet_par_person</string> @@ -297,6 +303,7 @@ return printed\n <string>person_total</string> <string>range</string> <string>month</string> + <string>dup_ps</string> <string>check_total</string> </tuple> </value> diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList.xml index d4c3e2c574..6bd8266864 100755 --- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList.xml +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList.xml @@ -139,7 +139,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Sale Invoice Transaction</string> </value> + <value> <string>Pay Sheet Transaction</string> </value> </item> <item> <key> <string>unicode_mode</string> </key> diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList/listbox.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList/listbox.xml index 477d380f80..9f20b11b4d 100755 --- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList/listbox.xml +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_viewAccountingLineList/listbox.xml @@ -338,12 +338,16 @@ <string>ID</string> </tuple> <tuple> - <string>title</string> - <string>Title</string> + <string>getSourceSectionTitle</string> + <string>Source Section</string> </tuple> <tuple> <string>source</string> - <string>Account</string> + <string>Source Account</string> + </tuple> + <tuple> + <string>getDestinationSectionTitle</string> + <string>Third Party</string> </tuple> <tuple> <string>source_debit</string> @@ -356,6 +360,10 @@ </list> </value> </item> + <item> + <key> <string>count_method</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>css_class</string> </key> <value> <string></string> </value> @@ -448,7 +456,7 @@ </item> <item> <key> <string>lines</string> </key> - <value> <int>10</int> </value> + <value> <int>20</int> </value> </item> <item> <key> <string>list_action</string> </key> @@ -497,7 +505,7 @@ </item> <item> <key> <string>search</string> </key> - <value> <string></string> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>search_columns</string> </key> @@ -586,7 +594,7 @@ <dictionary> <item> <key> <string>method_name</string> </key> - <value> <unicode>AccountingTransaction_searchInvoiceTransactionLines</unicode> </value> + <value> <string>AccountingTransaction_searchInvoiceTransactionLines</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_payroll/bt/change_log b/bt5/erp5_payroll/bt/change_log index af1f7d4629..3bdbeaf406 100755 --- a/bt5/erp5_payroll/bt/change_log +++ b/bt5/erp5_payroll/bt/change_log @@ -1,3 +1,10 @@ +2006-02-27 Kevin +* Update AccountingTransactionModule_viewAnnualSalaryReport to show more paysheet conflicts by default. +* Add AccountingModule_checkPaySheetConsistency, a usefull, but dirty, script to track bad destination and destination_section on Pay Sheet Lines. + +2006-02-24 Kevin +* Update PaySheetTransaction_viewAccountingLineList form. + 2006-02-15 Kevin * Add an Annual Report generator (must be refactored and cleaned up). * Update dependencies. -- 2.30.9