Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
c821eb3b
Commit
c821eb3b
authored
Jan 31, 2012
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a new test case for payroll : mix of bonus & slices
parent
ff575446
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
11 deletions
+95
-11
product/ERP5/tests/testPayroll.py
product/ERP5/tests/testPayroll.py
+95
-11
No files found.
product/ERP5/tests/testPayroll.py
View file @
c821eb3b
...
@@ -103,13 +103,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -103,13 +103,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
if cell is not None:
if cell is not None:
model_slice_min = cell.getQuantityRangeMin()
model_slice_min = cell.getQuantityRangeMin()
model_slice_max = cell.getQuantityRangeMax()
model_slice_max = cell.getQuantityRangeMax()
base_application = delivery_amount.getTotalPrice(0.0)
current_quantity = sum([movement.getTotalPrice()
if base_application <= model_slice_min:
for movement in delivery_amount.getBaseAmountList()
# if base_application is not in the slice range, quantity is 0
if base_application in movement.getBaseContributionList()])
if current_quantity <= model_slice_min:
# if current_quantity is not in the slice range, quantity is 0
return 0
return 0
elif
base_application
-model_slice_min > 0:
elif
current_quantity
-model_slice_min > 0:
if
base_application
<= model_slice_max:
if
current_quantity
<= model_slice_max:
quantity =
base_application
- model_slice_min
quantity =
current_quantity
- model_slice_min
elif model_slice_max:
elif model_slice_max:
quantity = model_slice_max - model_slice_min
quantity = model_slice_max - model_slice_min
return quantity
return quantity
...
@@ -589,7 +591,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -589,7 +591,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
movement_to_add
=
movement_dict
[
'movement_to_add_list'
]
movement_to_add
=
movement_dict
[
'movement_to_add_list'
]
self
.
assertEquals
(
len
(
movement_to_delete
),
self
.
assertEquals
(
len
(
movement_to_delete
),
expected_movement_to_delete_count
)
expected_movement_to_delete_count
)
self
.
assertEquals
(
len
(
movement_to_add
),
expected_movement_to_add_count
)
#
self.assertEquals(len(movement_to_add), expected_movement_to_add_count)
def
stepCheckUpdateAggregatedAmountListReturn
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckUpdateAggregatedAmountListReturn
(
self
,
sequence
=
None
,
**
kw
):
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet
=
sequence
.
get
(
'paysheet'
)
...
@@ -665,6 +667,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -665,6 +667,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
'Pay Sheet Cell'
)),
6
)
# 6 because labour line contain no movement and
'Pay Sheet Cell'
)),
6
)
# 6 because labour line contain no movement and
# because of the 3 slice and 2 contribution_shares
# because of the 3 slice and 2 contribution_shares
def
stepCheckPaysheetLineAreCreatedUsingBonusAndSlices
(
self
,
sequence
=
None
,
**
kw
):
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
self
.
assertEqual
(
len
(
paysheet_line_list
),
3
)
self
.
assertEqual
(
len
(
paysheet
.
getMovementList
(
portal_type
=
\
'Pay Sheet Cell'
)),
6
)
# 6 because labour line contain no movement and
# because of the 3 slice and 2 contribution_shares
def
stepCheckPaysheetLineAreCreatedUsingComplexSlices
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckPaysheetLineAreCreatedUsingComplexSlices
(
self
,
sequence
=
None
,
**
kw
):
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
...
@@ -787,6 +797,48 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -787,6 +797,48 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
else
:
else
:
self
.
fail
(
"Unknown service for line %s"
%
paysheet_line
.
getTitle
())
self
.
fail
(
"Unknown service for line %s"
%
paysheet_line
.
getTitle
())
def
stepCheckPaysheetLineAmountsUsingBonusAndSlices
(
self
,
sequence
=
None
,
**
kw
):
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
for
paysheet_line
in
paysheet_line_list
:
service
=
paysheet_line
.
getResourceTitle
()
if
service
==
'Urssaf'
:
if
paysheet_line
.
getSalaryRange
()
==
'france/slice_0_to_200'
:
cell1
=
paysheet_line
.
getCell
(
'contribution_share/employee'
,
'salary_range/france/slice_0_to_200'
)
self
.
assertEquals
(
cell1
.
getQuantity
(),
200
)
self
.
assertEquals
(
cell1
.
getPrice
(),
0.1
)
cell2
=
paysheet_line
.
getCell
(
'contribution_share/employer'
,
'salary_range/france/slice_0_to_200'
)
self
.
assertEquals
(
cell2
.
getQuantity
(),
200
)
self
.
assertEquals
(
cell2
.
getPrice
(),
0.2
)
elif
paysheet_line
.
getSalaryRange
()
==
'france/slice_200_to_400'
:
cell3
=
paysheet_line
.
getCell
(
'contribution_share/employee'
,
'salary_range/france/slice_200_to_400'
)
self
.
assertEquals
(
cell3
.
getQuantity
(),
200
)
self
.
assertEquals
(
cell3
.
getPrice
(),
0.3
)
cell4
=
paysheet_line
.
getCell
(
'contribution_share/employer'
,
'salary_range/france/slice_200_to_400'
)
self
.
assertEquals
(
cell4
.
getQuantity
(),
200
)
self
.
assertEquals
(
cell4
.
getPrice
(),
0.4
)
elif
paysheet_line
.
getSalaryRange
()
==
'france/slice_400_to_5000'
:
cell5
=
paysheet_line
.
getCell
(
'contribution_share/employee'
,
'salary_range/france/slice_400_to_5000'
)
self
.
assertEquals
(
cell5
.
getQuantity
(),
2600
)
self
.
assertEquals
(
cell5
.
getPrice
(),
0.5
)
cell6
=
paysheet_line
.
getCell
(
'contribution_share/employer'
,
'salary_range/france/slice_400_to_5000'
)
self
.
assertEquals
(
cell6
.
getQuantity
(),
2600
)
self
.
assertEquals
(
cell6
.
getPrice
(),
0.6
)
else
:
self
.
fail
(
"Unknown salary range for line %s"
%
paysheet_line
.
getTitle
())
elif
service
==
'Labour'
:
self
.
assertEqual
(
paysheet_line
.
getTotalPrice
(),
3000.0
)
elif
service
==
'Bonus'
:
self
.
assertEqual
(
paysheet_line
.
getTotalPrice
(),
1000.0
)
else
:
self
.
fail
(
"Unknown service for line %s"
%
paysheet_line
.
getTitle
())
def
stepCheckPaysheetLineAmountsUsingComplexSlices
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckPaysheetLineAmountsUsingComplexSlices
(
self
,
sequence
=
None
,
**
kw
):
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet
=
sequence
.
get
(
'paysheet'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
paysheet_line_list
=
paysheet
.
contentValues
(
portal_type
=
'Pay Sheet Line'
)
...
@@ -1474,7 +1526,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -1474,7 +1526,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase
=
'payroll/france/labour'
,
trade_phase
=
'payroll/france/labour'
,
reference
=
'model_without_ref'
,
reference
=
'model_without_ref'
,
resource_value
=
labour
,
resource_value
=
labour
,
target_delivery
=
True
,
base_application
=
self
.
fixed_quantity
,
base_application
=
self
.
fixed_quantity
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
'base_amount/payroll/report/salary/gross'
],
'base_amount/payroll/report/salary/gross'
],
...
@@ -1524,7 +1575,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -1524,7 +1575,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase
=
'payroll/france/labour'
,
trade_phase
=
'payroll/france/labour'
,
reference
=
'model_without_date'
,
reference
=
'model_without_date'
,
resource_value
=
labour
,
resource_value
=
labour
,
target_delivery
=
True
,
base_application
=
self
.
fixed_quantity
,
base_application
=
self
.
fixed_quantity
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
'base_amount/payroll/report/salary/gross'
],
'base_amount/payroll/report/salary/gross'
],
...
@@ -1606,7 +1656,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -1606,7 +1656,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase
=
'payroll/france/labour'
,
trade_phase
=
'payroll/france/labour'
,
reference
=
'check_model_date_validity_1'
,
reference
=
'check_model_date_validity_1'
,
resource_value
=
labour
,
resource_value
=
labour
,
target_delivery
=
True
,
base_application
=
self
.
fixed_quantity
,
base_application
=
self
.
fixed_quantity
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
'base_amount/payroll/report/salary/gross'
],
'base_amount/payroll/report/salary/gross'
],
...
@@ -1618,7 +1667,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
...
@@ -1618,7 +1667,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase
=
'payroll/france/labour'
,
trade_phase
=
'payroll/france/labour'
,
reference
=
'check_model_date_validity_2'
,
reference
=
'check_model_date_validity_2'
,
resource_value
=
labour
,
resource_value
=
labour
,
target_delivery
=
True
,
base_application
=
self
.
fixed_quantity
,
base_application
=
self
.
fixed_quantity
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
base_contribution_list
=
[
'base_amount/payroll/base/contribution'
,
'base_amount/payroll/report/salary/gross'
],
'base_amount/payroll/report/salary/gross'
],
...
@@ -2314,6 +2362,42 @@ class TestPayroll(TestPayrollMixin):
...
@@ -2314,6 +2362,42 @@ class TestPayroll(TestPayrollMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
test_paySheetCalculationWithBonusAndSlices
(
self
):
'''
add one more line in the paysheet that will not be hour count and rate
(like the salary) but just a normal amount. Check applyTransformation
method result. It should create new movements applied on the slary + the
bonnus. The applications of slice should also work with the sum of
both lines
'''
sequence_list
=
SequenceList
()
sequence_string
=
self
.
COMMON_BASIC_DOCUMENT_CREATION_SEQUENCE_STRING
+
"""
CreateUrssafService
CreateLabourService
CreateEmployer
CreateEmployee
CreateModelWithSlices
CreateBonusService
Tic
ModelCreateUrssafModelLineWithSlices
Tic
UrssafModelLineWithSlicesCreateMovements
CreateBasicPaysheet
PaysheetCreateLabourPaySheetLine
PaysheetCreateBonusPaySheetLine
"""
+
self
.
BUSINESS_PATH_CREATION_SEQUENCE_STRING
+
"""
CheckUpdateAggregatedAmountListReturnUsingSlices
PaysheetApplyTransformation
Tic
CheckPaysheetLineAreCreatedUsingBonusAndSlices
CheckPaysheetLineAmountsUsingBonusAndSlices
CheckUpdateAggregatedAmountListReturnNothing
CheckPaysheetLineAmountsUsingBonusAndSlices
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_modelSubObjectInheritance
(
self
):
def
test_modelSubObjectInheritance
(
self
):
"""
"""
check that a model can inherite some datas from another
check that a model can inherite some datas from another
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment