Commit 941a1c74 authored by Fabien Morin's avatar Fabien Morin

- Now we use effective model, so we need to define some more properties on...

- Now we use effective model, so we need to define some more properties on model like reference, effective en exiparation date and version
- Dynamic date was not good, it's easier to understand and debug with static dates
- some date formats were not good
- udpate test_modelWithoutDateValidity to check the new behaviour
- add some Tic steps after creating the model because effective model are found using catalog


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28047 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6168e710
...@@ -53,6 +53,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -53,6 +53,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
CreateEmployee CreateEmployee
CreatePriceCurrency CreatePriceCurrency
CreateBasicModel CreateBasicModel
Tic
ModelCreateUrssafModelLine ModelCreateUrssafModelLine
UrssafModelLineCreateMovements UrssafModelLineCreateMovements
CreateBasicPaysheet CreateBasicPaysheet
...@@ -268,7 +269,12 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -268,7 +269,12 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
employer = sequence.get('employer') employer = sequence.get('employer')
employee = sequence.get('employee') employee = sequence.get('employee')
model.edit(destination_section_value=employer, model.edit(destination_section_value=employer,
source_section_value=employee) source_section_value=employee,
effective_date=DateTime(2009,01,01),
expiration_date=DateTime(2009,12,31),
version='001',
reference='basic_model',
)
sequence.edit(model = model) sequence.edit(model = model)
def addSlice(self, model, slice, min_value, max_value, base_id='cell'): def addSlice(self, model, slice, min_value, max_value, base_id='cell'):
...@@ -488,8 +494,8 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -488,8 +494,8 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
source_section_value=sequence.get('employee'), source_section_value=sequence.get('employee'),
destination_section_value=sequence.get('employer'), destination_section_value=sequence.get('employer'),
resource_value=sequence.get('price_currency'), resource_value=sequence.get('price_currency'),
start_date=DateTime(), start_date=DateTime(2009,06,01),
stop_date=DateTime()+1) stop_date=DateTime(2009,06,30))
sequence.edit(paysheet = paysheet) sequence.edit(paysheet = paysheet)
def createPaysheetLine(self, document, **kw): def createPaysheetLine(self, document, **kw):
...@@ -912,7 +918,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -912,7 +918,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
model.edit(\ model.edit(\
price_currency_value=currency, price_currency_value=currency,
default_payment_condition_trade_date='custom', default_payment_condition_trade_date='custom',
default_payment_condition_payment_date=DateTime(2009/05/25), default_payment_condition_payment_date=DateTime(2009,05,25),
work_time_annotation_line_quantity=151.67, work_time_annotation_line_quantity=151.67,
work_time_annotation_line_quantity_unit='time/hours', work_time_annotation_line_quantity_unit='time/hours',
) )
...@@ -922,7 +928,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -922,7 +928,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
model = sequence.get('model') model = sequence.get('model')
paysheet.setSpecialiseValue(model) paysheet.setSpecialiseValue(model)
paysheet.PaySheetTransaction_applyModel(force=1) paysheet.PaySheetTransaction_applyModel(force=1)
def stepCheckCategoriesOnPaySheet(self, sequence=None, **kw): def stepCheckCategoriesOnPaySheet(self, sequence=None, **kw):
paysheet = sequence.get('paysheet') paysheet = sequence.get('paysheet')
employer = sequence.get('employer') employer = sequence.get('employer')
...@@ -933,7 +939,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -933,7 +939,7 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
self.assertEquals(paysheet.getPriceCurrencyValue(), currency) self.assertEquals(paysheet.getPriceCurrencyValue(), currency)
self.assertEquals(paysheet.getDefaultPaymentConditionTradeDate(), 'custom') self.assertEquals(paysheet.getDefaultPaymentConditionTradeDate(), 'custom')
self.assertEquals(paysheet.getDefaultPaymentConditionPaymentDate(), self.assertEquals(paysheet.getDefaultPaymentConditionPaymentDate(),
DateTime(2009/05/25)) DateTime(2009,05,25))
self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantity(), 151.67) self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantity(), 151.67)
self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantityUnit(), self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantityUnit(),
'time/hours') 'time/hours')
...@@ -1507,8 +1513,8 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -1507,8 +1513,8 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
# create the paysheet # create the paysheet
paysheet = self.createPaysheet() paysheet = self.createPaysheet()
paysheet.edit(specialise_value=model_without_ref, paysheet.edit(specialise_value=model_without_ref,
start_date=DateTime(2008, 1, 1), start_date=DateTime(2009, 1, 1),
stop_date=DateTime(2008, 1, 31), stop_date=DateTime(2009, 1, 31),
price_currency_value=eur) price_currency_value=eur)
paysheet.PaySheetTransaction_applyModel() paysheet.PaySheetTransaction_applyModel()
self.stepTic() self.stepTic()
...@@ -1531,9 +1537,10 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -1531,9 +1537,10 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
def stepCheckModelWithoutDateValidity(self, sequence=None, **kw): def stepCheckModelWithoutDateValidity(self, sequence=None, **kw):
''' '''
If no date are defined on a model, the behavior is that this model If no date are defined on a model, the behavior is that this model
is always valid. (XXX check if it's what we want) is valid only for paysheet that don't have dates.
So check that a line is created after calling calculation script, even if So check that a line is created after calling calculation script on a
there is no start_date or stop_date paysheet with no dates and check nothing is created on a paysheet that uses
dates
''' '''
eur = sequence.get('currency') eur = sequence.get('currency')
labour = sequence.get('labour_service_output') labour = sequence.get('labour_service_output')
...@@ -1553,29 +1560,48 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -1553,29 +1560,48 @@ class TestPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
'base_amount/gross_salary'], 'base_amount/gross_salary'],
quantity=10000) quantity=10000)
# create the paysheet # create a paysheet without date
paysheet = self.createPaysheet() paysheet_without_date = self.createPaysheet()
paysheet.edit(specialise_value=model_without_date, paysheet_without_date.edit(specialise_value=model_without_date,
start_date=DateTime(2008, 1, 1),
stop_date=DateTime(2008, 1, 31),
price_currency_value=eur) price_currency_value=eur)
paysheet.PaySheetTransaction_applyModel() paysheet_without_date.PaySheetTransaction_applyModel()
self.stepTic() self.stepTic()
portal_type_list = ['Pay Sheet Model Line',] portal_type_list = ['Pay Sheet Model Line',]
# if no dates, we don't care about dates # check the paysheet contail no lines before calculation
sub_object_list = paysheet.getInheritedObjectValueList(portal_type_list) self.assertEquals(len(paysheet_without_date.contentValues(\
self.assertEquals(len(paysheet.contentValues(\
portal_type='Pay Sheet Line')), 0) portal_type='Pay Sheet Line')), 0)
# calculate the pay sheet # calculate the pay sheet
paysheet.applyTransformation() paysheet_without_date.applyTransformation()
self.stepTic() self.stepTic()
self.assertEquals(len(paysheet.contentValues(\ self.assertEquals(len(paysheet_without_date.contentValues(\
portal_type='Pay Sheet Line')), 1) portal_type='Pay Sheet Line')), 1)
# check values on the paysheet # check values on the paysheet_without_date
self.assertEquals(paysheet.contentValues()[0].getTotalPrice(), 10000) self.assertEquals(paysheet_without_date.contentValues()[0].getTotalPrice(),
10000)
# create a paysheet with dates
paysheet_with_date = self.createPaysheet()
paysheet_with_date.edit(specialise_value=model_without_date,
start_date=DateTime(2009, 1, 1),
stop_date=DateTime(2009, 1, 31),
price_currency_value=eur)
paysheet_with_date.PaySheetTransaction_applyModel()
self.stepTic()
portal_type_list = ['Pay Sheet Model Line',]
# check the paysheet contail no lines before calculation
self.assertEquals(len(paysheet_with_date.contentValues(\
portal_type='Pay Sheet Line')), 0)
# calculate the pay sheet
paysheet_with_date.applyTransformation()
self.stepTic()
# after calculation, paysheet should contain no lines because no effective
# model could be found for this paysheet
self.assertEquals(len(paysheet_with_date.contentValues(\
portal_type='Pay Sheet Line')), 0)
def stepCheckModelDateValidity(self, sequence=None, **kw): def stepCheckModelDateValidity(self, sequence=None, **kw):
''' '''
...@@ -1936,6 +1962,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -1936,6 +1962,7 @@ class TestPayroll(TestPayrollMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = """ sequence_string = """
CreateModelTree CreateModelTree
Tic
CheckgetCellResults CheckgetCellResults
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -1954,6 +1981,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -1954,6 +1981,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployer CreateEmployer
CreateEmployee CreateEmployee
CreateBasicModel CreateBasicModel
Tic
CreatePriceCurrency CreatePriceCurrency
ModelSetCategories ModelSetCategories
CreateBasicPaysheet CreateBasicPaysheet
...@@ -1974,6 +2002,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -1974,6 +2002,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployer CreateEmployer
CreateEmployee CreateEmployee
CreateBasicModel CreateBasicModel
Tic
CreatePriceCurrency CreatePriceCurrency
ModelSetCategories ModelSetCategories
CreateBasicPaysheet CreateBasicPaysheet
...@@ -2033,6 +2062,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -2033,6 +2062,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployer CreateEmployer
CreateEmployee CreateEmployee
CreateBasicModel CreateBasicModel
Tic
ModelCreateIntermediateModelLine ModelCreateIntermediateModelLine
ModelCreateAppliedOnTaxModelLine ModelCreateAppliedOnTaxModelLine
IntermediateModelLineCreateMovements IntermediateModelLineCreateMovements
...@@ -2253,6 +2283,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -2253,6 +2283,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployee CreateEmployee
CreatePriceCurrency CreatePriceCurrency
CreateBasicModel CreateBasicModel
Tic
ModelCreateUrssafModelLine ModelCreateUrssafModelLine
UrssafModelLineCreateMovementsWithQuantityOnly UrssafModelLineCreateMovementsWithQuantityOnly
CreateBasicPaysheet CreateBasicPaysheet
...@@ -2279,6 +2310,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -2279,6 +2310,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployee CreateEmployee
CreatePriceCurrency CreatePriceCurrency
CreateBasicModel CreateBasicModel
Tic
CreateModelLineZeroPrice CreateModelLineZeroPrice
CreateBasicPaysheet CreateBasicPaysheet
""" + self.BUSINESS_PATH_CREATION_SEQUENCE_STRING + """ """ + self.BUSINESS_PATH_CREATION_SEQUENCE_STRING + """
...@@ -3343,6 +3375,7 @@ class TestPayroll(TestPayrollMixin): ...@@ -3343,6 +3375,7 @@ class TestPayroll(TestPayrollMixin):
CreateEmployee CreateEmployee
CreatePriceCurrency CreatePriceCurrency
CreateModelWithSlices CreateModelWithSlices
Tic
ModelCreateUrssafModelLine ModelCreateUrssafModelLine
UrssafModelLineCreateMovements UrssafModelLineCreateMovements
CreateBasicPaysheet CreateBasicPaysheet
......
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