Commit 0b91c6b3 authored by Kevin Deldycke's avatar Kevin Deldycke

Use "2-space" tabbing.

Support empty category

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6753 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64680a07
......@@ -79,7 +79,7 @@ l = []\n
default_values = context.PaySheetTransaction_preCalculation()\n
\n
# function to create a new preview line\n
def createPreviewLine ( new_id = None\n
def createPreviewLine( new_id = None\n
, new_title = None\n
, new_base = None\n
, new_base_name = None\n
......@@ -90,14 +90,14 @@ def createPreviewLine ( new_id = None\n
, new_salary_range_cat = None\n
, new_tax_cat = None\n
):\n
\n
\n
global portal_object, num, l\n
num += 1\n
int_len = 3\n
o = newTempBase(portal_object, new_id)\n
o.setUid(\'new_%s\' % zfill(num, int_len)) # XXX There is a security issue here\n
o.setUid( \'new_%s\' % zfill(num, int_len)) # XXX There is a security issue here\n
o.edit(uid=\'new_%s\' % zfill(num, int_len)) # XXX There is a security issue here\n
o.edit ( id = new_id\n
o.edit( id = new_id\n
, title = new_title\n
, base = new_base\n
, base_name = new_base_name\n
......@@ -113,15 +113,18 @@ def createPreviewLine ( new_id = None\n
# get all services related to pay sheet transaction\n
paysheet_services = []\n
erp5site = context.portal_url.getPortalObject()\n
\n
# during 06/2005 service module has been renamed service_module\n
# both names are supported\n
if hasattr(erp5site, \'service_module\') : \n
if hasattr(erp5site, \'service_module\') :\n
service_module = erp5site.service_module\n
else : \n
else :\n
service_module = erp5site.service\n
\n
for service in service_module.objectValues():\n
base_cat = service.getVariationRangeBaseCategoryList()\n
# a service is related to paysheet transaction if it has \'tax_category\' et \'salary_range\' as base category\n
base_cat = service.getVariationBaseCategoryList()\n
# A service is related to paysheet transaction if it has\n
# \'tax_category\' and \'salary_range\' as base category.\n
if \'tax_category\' in base_cat and \'salary_range\' in base_cat and service.getId() != \'labour\':\n
paysheet_services.append(service)\n
\n
......@@ -141,14 +144,18 @@ for serv in paysheet_services:\n
range_cat.append(cat)\n
# create a line for every salary_range of the service\n
for base in range_cat:\n
name = serv.getId() + \'/\' + context.portal_categories.resolveCategory(base).getId()\n
mycategory=context.portal_categories.resolveCategory(base)\n
if mycategory is None:\n
context.log("PaySheetTransaction_initializePreview","WARNING : category not found : %s" % base)\n
else:\n
name = serv.getId() + \'/\' + mycategory.getId()\n
# a preview line is composed of a base calculation, an employee share rate and an employer share rate\n
if default_values.has_key(name):\n
new_base = default_values[name][\'base\']\n
new_employee_rate = default_values[name][\'employee_rate\']\n
new_employer_rate = default_values[name][\'employer_rate\']\n
# create a preview line for every salary_range value of the service\n
createPreviewLine ( new_id = serv.getId()\n
createPreviewLine( new_id = serv.getId()\n
, new_title = serv.getTitleOrId()\n
, new_base = new_base\n
, new_base_name = context.portal_categories.resolveCategory(base).getTitleOrId()\n
......@@ -238,6 +245,7 @@ return l\n
<string>cat</string>
<string>str</string>
<string>base</string>
<string>mycategory</string>
<string>name</string>
<string>_getitem_</string>
<string>new_base</string>
......
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