Commit 5d2dd07c authored by Aurel's avatar Aurel

new version of the test for payroll : we no longer need to use base_amount as services' variations,

instead use variations as it was done before


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43555 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 457fab2e
...@@ -88,52 +88,51 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -88,52 +88,51 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def afterSetUp(self): def afterSetUp(self):
"""Prepare the test.""" """Prepare the test."""
super(TestPayrollMixin, self).afterSetUp() TestTradeModelLineMixin.afterSetUp(self)
self.createCategories() self.createCategories()
self.fixed_quantity = self.setBaseAmountQuantityMethod('fixed_quantity', self.fixed_quantity = self.setBaseAmountQuantityMethod('fixed_quantity',
"return lambda *args, **kw: 1") "return lambda *args, **kw: 1")
self.setPayrollBaseAmountQuantityMethod("base_amount/payroll/base/contribution", self.setPayrollBaseAmountQuantityMethod("base_amount/payroll/base/contribution",
"""\ """\
def returnZeroQuantity(*args, **kw): def getBaseAmountQuantity(delivery_amount, base_application,
return 0 variation_category_list=(), **kw):
context.log('context %s, ba = %s' %(context, context.getBaseApplicationList())) if variation_category_list:
for application in context.getBaseApplicationList(): for variation in variation_category_list:
if 'salary_range' in application: if variation.startswith('salary_range'):
context.log('method is zeroQ') cell = delivery_amount.getSpecialiseValue().getCell(variation)
return returnZeroQuantity
context.log('method is default')
return context.getBaseAmountQuantity
""")
self.setPayrollBaseAmountQuantityMethod("base_amount/payroll/l10n/fr/salary_range",
"""\
def getBaseAmountQuantity(delivery_amount, base_application, **kw):
quantity = 0
salary_range = base_application.split('/')[-1]
salary_range_cat = 'salary_range/france/%s' %(salary_range)
cell = delivery_amount.getSpecialiseValue().getCell(salary_range_cat)
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) base_application = delivery_amount.getTotalPrice(0.0)
if base_application <= model_slice_min: if base_application <= model_slice_min:
# if base_application is not in the slice range, quantity is 0 # if base_application is not in the slice range, quantity is 0
quantity = 0 return 0
elif base_application-model_slice_min > 0: elif base_application-model_slice_min > 0:
if base_application <= model_slice_max: if base_application <= model_slice_max:
quantity = base_application - model_slice_min quantity = base_application - 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
else:
quantity = delivery_amount.getTotalPrice()
context.log('quantity is', quantity)
return quantity return quantity
quantity = delivery_amount.getGeneratedAmountQuantity(base_application)
return quantity
return context.getBaseAmountQuantity(delivery_amount, base_application, **kw)
return getBaseAmountQuantity return getBaseAmountQuantity
""") """)
self.setPayrollBaseAmountQuantityMethod("base_amount/payroll/base/income_tax",
"""\
def getBaseAmountQuantity(delivery_amount, base_application,
variation_category_list=(), **kw):
if variation_category_list:
return delivery_amount.getGeneratedAmountQuantity(base_application)
return context.getBaseAmountQuantity(delivery_amount, base_application, **kw)
return getBaseAmountQuantity
""")
@reindex @reindex
def beforeTearDown(self): def beforeTearDown(self):
super(TestPayrollMixin, self).beforeTearDown() TestTradeModelLineMixin.beforeTearDown(self)
transaction.abort() transaction.abort()
for module in ( for module in (
self.portal.organisation_module, self.portal.organisation_module,
...@@ -147,7 +146,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -147,7 +146,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
self.portal.business_process_module.manage_delObjects(list([x for x in self.portal.business_process_module.objectIds() if x != "erp5_default_business_process"])) self.portal.business_process_module.manage_delObjects(list([x for x in self.portal.business_process_module.objectIds() if x != "erp5_default_business_process"]))
def login(self): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser('admin', '', ['Manager', 'Assignee', 'Assignor', uf._doAddUser('admin', '', ['Manager', 'Assignee', 'Assignor',
...@@ -187,8 +185,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -187,8 +185,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
'contribution_share/employee', 'contribution_share/employee',
'base_amount/payroll/base/income_tax', 'base_amount/payroll/base/income_tax',
'base_amount/payroll/base/contribution', 'base_amount/payroll/base/contribution',
'base_amount/payroll/base/contribution/employer',
'base_amount/payroll/base/contribution/employee',
'base_amount/payroll/report/salary/net', 'base_amount/payroll/report/salary/net',
'base_amount/payroll/report/salary/gross', 'base_amount/payroll/report/salary/gross',
'base_amount/payroll/l10n/fr/salary_range/a', 'base_amount/payroll/l10n/fr/salary_range/a',
...@@ -227,7 +223,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -227,7 +223,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
) )
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return TestTradeModelLineMixin.getBusinessTemplateList(self) + ('erp5_payroll', 'erp5_core_proxy_field_legacy') return TestTradeModelLineMixin.getBusinessTemplateList(self) + ('erp5_payroll', )
def stepCreatePriceCurrency(self, sequence): def stepCreatePriceCurrency(self, sequence):
sequence.edit(price_currency = self.createResource('Currency', sequence.edit(price_currency = self.createResource('Currency',
...@@ -248,13 +244,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -248,13 +244,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
node = self.createService() node = self.createService()
node.edit(title='Urssaf', node.edit(title='Urssaf',
product_line='state_insurance', quantity_unit='time/month', product_line='state_insurance', quantity_unit='time/month',
variation_base_category_list=['base_application'], variation_base_category_list=['contribution_share', 'salary_range'],
use='payroll/tax') use='payroll/tax')
node.setVariationCategoryList(['base_application/base_amount/payroll/base/contribution/employee', node.setVariationCategoryList(['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer' 'contribution_share/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200', 'salary_range/france/slice_0_to_200',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000', 'salary_range/france/slice_400_to_5000',
'salary_range/france/slice_600_to_800',
]) ])
sequence.edit(urssaf_service = node) sequence.edit(urssaf_service = node)
...@@ -276,31 +273,28 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -276,31 +273,28 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def stepCreateBonusService(self, sequence=None, **kw): def stepCreateBonusService(self, sequence=None, **kw):
node = self.createService() node = self.createService()
node.edit(title='Bonus', quantity_unit='time/month', node.edit(title='Bonus', quantity_unit='time/month',
variation_base_category_list=['base_contribution'], variation_base_category_list=['contribution_share'],
product_line='labour', use='payroll/base_salary') product_line='labour', use='payroll/base_salary')
node.setVariationCategoryList(['base_contribution/base_amount/payroll/base/contribution/employee', node.setVariationCategoryList(['contribution_share/employee',
'base_contribution/base_amount/payroll/base/contribution/employer' 'contribution_share/employer'])
])
sequence.edit(bonus_service = node) sequence.edit(bonus_service = node)
def stepCreateOldAgeInsuranaceService(self, sequence=None, **kw): def stepCreateOldAgeInsuranaceService(self, sequence=None, **kw):
node = self.createService() node = self.createService()
node.edit(title='Old Age Insurance', quantity_unit='time/month', node.edit(title='Old Age Insurance', quantity_unit='time/month',
variation_base_category_list=['base_application'], variation_base_category_list=['contribution_share', 'salary_range'],
product_line='state_insurance', use='payroll/tax') product_line='state_insurance', use='payroll/tax')
node.setVariationCategoryList(['base_application/base_amount/payroll/base/contribution/employee', node.setVariationCategoryList(['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer' 'contribution_share/employer'])
])
sequence.edit(old_age_insurance_service = node) sequence.edit(old_age_insurance_service = node)
def stepCreateSicknessInsuranceService(self, sequence=None, **kw): def stepCreateSicknessInsuranceService(self, sequence=None, **kw):
node = self.createService() node = self.createService()
node.edit(title='Sickness Insurance', quantity_unit='time/month', node.edit(title='Sickness Insurance', quantity_unit='time/month',
variation_base_category_list=['base_application'], variation_base_category_list=['contribution_share', 'salary_range'],
product_line='state_insurance', use='payroll/tax') product_line='state_insurance', use='payroll/tax')
node.setVariationCategoryList(['base_application/base_amount/payroll/base/contribution/employee', node.setVariationCategoryList(['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer' 'contribution_share/employer'])
])
sequence.edit(sickness_insurance_service = node) sequence.edit(sickness_insurance_service = node)
def createModel(self): def createModel(self):
...@@ -377,10 +371,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -377,10 +371,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
reference='urssaf_model_line', reference='urssaf_model_line',
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('urssaf_service'), resource_value=sequence.get('urssaf_service'),
variation_category_list = ['base_application/base_amount/payroll/base/contribution/employee', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer'], 'contribution_share/employer'],
base_contribution_list=['base_amount/payroll/base/income_tax'], base_application_list=[ 'base_amount/payroll/base/contribution'],
) base_contribution_list=['base_amount/payroll/base/income_tax'])
#model_line.setQuantity(0.0)
sequence.edit(urssaf_model_line = model_line) sequence.edit(urssaf_model_line = model_line)
def stepModelCreateUrssafModelLineWithSlices(self, sequence=None, **kw): def stepModelCreateUrssafModelLineWithSlices(self, sequence=None, **kw):
...@@ -390,11 +385,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -390,11 +385,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
reference='urssaf_model_line_2', reference='urssaf_model_line_2',
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('urssaf_service'), resource_value=sequence.get('urssaf_service'),
variation_category_list=['base_application/base_amount/payroll/base/contribution/employee', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer', 'contribution_share/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200', 'salary_range/france/slice_0_to_200',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',], 'salary_range/france/slice_400_to_5000'],
base_application_list=[ 'base_amount/payroll/base/contribution',],
base_contribution_list=['base_amount/payroll/base/income_tax']) base_contribution_list=['base_amount/payroll/base/income_tax'])
sequence.edit(urssaf_model_line_with_slices = model_line) sequence.edit(urssaf_model_line_with_slices = model_line)
...@@ -405,182 +401,156 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -405,182 +401,156 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
reference='urssaf_model_line_3', reference='urssaf_model_line_3',
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('urssaf_service'), resource_value=sequence.get('urssaf_service'),
variation_category_list=['base_application/base_amount/payroll/base/contribution/employer', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'contribution_share/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_600_to_800',], 'salary_range/france/slice_600_to_800'],
base_application_list=[ 'base_amount/payroll/base/contribution'],
base_contribution_list=['base_amount/payroll/base/income_tax']) base_contribution_list=['base_amount/payroll/base/income_tax'])
#model_line.setQuantity(0.0) #model_line.setQuantity(0.0)
sequence.edit(urssaf_model_line_with_slices = model_line) sequence.edit(urssaf_model_line_with_slices = model_line)
def stepUrssafModelLineCreateMovements(self, sequence=None, **kw): def stepUrssafModelLineCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('urssaf_model_line') model_line = sequence.get('urssaf_model_line')
cell1 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employee', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employee',
base_id='movement', base_id='movement',
base_application = "contribution_share/employee",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.1, quantity=None) cell1.edit(price=0.1, contribution_share='employee', quantity=None)
cell2 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employer', cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employer',
base_id='movement', base_id='movement',
base_application = "contribution_share/employer",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.5, quantity=None) cell2.edit(price=0.5, contribution_share='employer', quantity=None)
def stepUrssafModelLineCreateMovementsWithQuantityOnly(self, sequence=None, **kw): def stepUrssafModelLineCreateMovementsWithQuantityOnly(self, sequence=None, **kw):
model_line = sequence.get('urssaf_model_line') model_line = sequence.get('urssaf_model_line')
cell1 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employee', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employee',
base_id='movement', base_id='movement',
base_application = "contribution_share/employee",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(quantity=-100.0, contribution_share='employee') cell1.edit(quantity=-100.0, contribution_share='employee')
cell2 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employer', cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employer',
base_id='movement', base_id='movement',
base_application = "contribution_share/employer",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(quantity=-200.0, contribution_share='employer') cell2.edit(quantity=-200.0, contribution_share='employer')
def stepUrssafModelLineWithSlicesCreateMovements(self, sequence=None, **kw): def stepUrssafModelLineWithSlicesCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('urssaf_model_line_with_slices') model_line = sequence.get('urssaf_model_line_with_slices')
cell1 = model_line.newCell( cell1 = model_line.newCell('contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_0_to_200',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employee',
'base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_0_to_200',],
'base_amount/payroll/l10n/fr/salary_range/slice_0_to_200',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.1, quantity=None,) cell1.edit(price=0.1, contribution_share='employee', quantity=None,
salary_range='france/slice_0_to_200')
cell2 = model_line.newCell( cell2 = model_line.newCell('contribution_share/employer',
'base_application/base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_0_to_200',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employer',
'base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_0_to_200',],
'base_amount/payroll/l10n/fr/salary_range/slice_0_to_200',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.2, quantity=None,) cell2.edit(price=0.2, contribution_share='employer', quantity=None,
salary_range='france/slice_0_to_200')
cell3 = model_line.newCell( cell3 = model_line.newCell('contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employee',
'base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400',],
'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell3.edit(price=0.3,quantity=None) cell3.edit(price=0.3, contribution_share='employee', quantity=None,
salary_range='france/slice_200_to_400')
cell4 = model_line.newCell( cell4 = model_line.newCell('contribution_share/employer',
'base_application/base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employer',
'base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_200_to_400',],
'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell4.edit(price=0.4, quantity=None,) cell4.edit(price=0.4, contribution_share='employer', quantity=None,
salary_range='france/slice_200_to_400')
cell5 = model_line.newCell( cell5 = model_line.newCell('contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_400_to_5000',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employee',
'base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_400_to_5000',],
'base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell5.edit(price=0.5, quantity=None,) cell5.edit(price=0.5, contribution_share='employee', quantity=None,
salary_range='france/slice_400_to_5000')
cell6 = model_line.newCell( cell6 = model_line.newCell('contribution_share/employer',
'base_application/base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_400_to_5000',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employer',
'base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_400_to_5000',],
'base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell6.edit(price=0.6, quantity=None,) cell6.edit(price=0.6, contribution_share='employer', quantity=None,
salary_range='france/slice_400_to_5000')
def stepUrssafModelLineWithComplexSlicesCreateMovements(self, def stepUrssafModelLineWithComplexSlicesCreateMovements(self,
sequence=None, **kw): sequence=None, **kw):
model_line = sequence.get('urssaf_model_line_with_slices') model_line = sequence.get('urssaf_model_line_with_slices')
cell1 = model_line.newCell( cell1 = model_line.newCell('contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employee',
'base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400',],
'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.1, quantity=None) cell1.edit(price=0.1, contribution_share='employee', quantity=None,
salary_range='france/slice_200_to_400')
cell2 = model_line.newCell( cell2 = model_line.newCell('contribution_share/employer',
'base_application/base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_200_to_400',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employer',
'base_amount/payroll/base/contribution/employer', 'salary_range/france/slice_200_to_400',],
'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.2, quantity=None) cell2.edit(price=0.2, contribution_share='employer', quantity=None,
salary_range='france/slice_200_to_400')
cell3 = model_line.newCell( cell3 = model_line.newCell('contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_600_to_800',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_600_to_800',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application_list=['contribution_share/employee',
'base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_600_to_800',],
'base_amount/payroll/l10n/fr/salary_range/slice_600_to_800',
],
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell3.edit(price=0.1, quantity=None) cell3.edit(price=0.3, contribution_share='employee', quantity=None,
salary_range='france/slice_600_to_800')
cell4 = model_line.newCell('contribution_share/employer',
'salary_range/france/slice_600_to_800',
portal_type='Pay Sheet Model Cell',
base_id='movement',
base_application_list=['contribution_share/employer',
'salary_range/france/slice_600_to_800',],
mapped_value_property_list=('quantity', 'price'))
cell4.edit(price=0.4, contribution_share='employer', quantity=None,
salary_range='france/slice_600_to_800')
cell4 = model_line.newCell( def stepPaysheetUrssafModelLineCreateMovements(self, sequence=None, **kw):
'base_application/base_amount/payroll/base/contribution/employer', model_line = sequence.get('urssaf_model_line')
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_600_to_800', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application_list=[ base_application = "contribution_share/employee",
'base_amount/payroll/base/contribution/employer', mapped_value_property_list=('quantity', 'price'))
'base_amount/payroll/l10n/fr/salary_range/slice_600_to_800', cell1.edit(price=0.3, contribution_share='employee', quantity=None)
], cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell',
base_id='movement',
base_application = "contribution_share/employer",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell4.edit(price=0.2, quantity=None) cell2.edit(price=0.7, contribution_share='employer', quantity=None)
# def stepPaysheetUrssafModelLineCreateMovements(self, sequence=None, **kw):
# return
# model_line = sequence.get('urssaf_model_line')
# cell1 = model_line.newCell('contribution_share/employee',
# portal_type='Pay Sheet Model Cell',
# base_id='movement',
# mapped_value_property_list=('quantity', 'price'))
# cell1.edit(price=0.3, contribution_share='employee', quantity=None)
# cell2 = model_line.newCell('contribution_share/employer',
# portal_type='Pay Sheet Model Cell',
# base_id='movement',
# mapped_value_property_list=('quantity', 'price'))
# cell2.edit(price=0.7, contribution_share='employer', quantity=None)
def createPaysheet(self, sequence=None, **kw): def createPaysheet(self, sequence=None, **kw):
module = self.portal.getDefaultModule(portal_type='Pay Sheet Transaction') module = self.portal.getDefaultModule(portal_type='Pay Sheet Transaction')
...@@ -607,8 +577,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -607,8 +577,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
price=20, price=20,
quantity=150, quantity=150,
resource_value=sequence.get('labour_service'), resource_value=sequence.get('labour_service'),
base_contribution_list=['base_amount/payroll/base/contribution/employee', base_contribution_list=['base_amount/payroll/base/contribution',
'base_amount/payroll/base/contribution/employer',
'base_amount/payroll/l10n/fr/salary_range/slice_0_to_200', 'base_amount/payroll/l10n/fr/salary_range/slice_0_to_200',
'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400', 'base_amount/payroll/l10n/fr/salary_range/slice_200_to_400',
'base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000', 'base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000',
...@@ -621,26 +590,10 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -621,26 +590,10 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
paysheet_line = self.createPaysheetLine(paysheet) paysheet_line = self.createPaysheetLine(paysheet)
paysheet_line.edit(title='Bonus', paysheet_line.edit(title='Bonus',
resource_value=sequence.get('bonus_service'), resource_value=sequence.get('bonus_service'),
variation_category_list=['base_contribution/base_amount/payroll/base/contribution/employer', quantity=1000, price=1,
'base_contribution/base_amount/payroll/base/contribution/employee'], base_contribution_list=[ 'base_amount/payroll/base/contribution'])
)
sequence.edit(bonus_paysheet_line = paysheet_line) sequence.edit(bonus_paysheet_line = paysheet_line)
def stepPaysheetCreateBonusPaySheetLineMovements(self, sequence=None, **kw):
paysheet_line = sequence.get('bonus_paysheet_line')
cell1 = paysheet_line.newCell('base_contribution/base_amount/payroll/base/contribution/employee',
portal_type='Pay Sheet Cell',
base_contribution='base_amount/payroll/base/contribution/employee',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell1.edit(quantity=1000, price=1)
cell2 = paysheet_line.newCell('base_contribution/base_amount/payroll/base/contribution/employer',
portal_type='Pay Sheet Cell',
base_id='movement',
base_contribution='base_amount/payroll/base/contribution/employer',
mapped_value_property_list=('quantity', 'price'))
cell2.edit(quantity=1000, price=1)
def checkUpdateAggregatedAmountListReturn(self, paysheet, def checkUpdateAggregatedAmountListReturn(self, paysheet,
expected_movement_to_delete_count, expected_movement_to_add_count): expected_movement_to_delete_count, expected_movement_to_add_count):
movement_dict = paysheet.updateAggregatedAmountList() movement_dict = paysheet.updateAggregatedAmountList()
...@@ -690,7 +643,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -690,7 +643,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def stepCheckPaysheetLineAreCreated(self, sequence=None, **kw): def stepCheckPaysheetLineAreCreated(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')
self.assertEqual(len(paysheet_line_list), 3) self.assertEqual(len(paysheet_line_list), 2)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 2) # 2 because labour line contain no movement 'Pay Sheet Cell')), 2) # 2 because labour line contain no movement
...@@ -699,14 +652,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -699,14 +652,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line') paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line')
self.assertEqual(len(paysheet_line_list), 0) self.assertEqual(len(paysheet_line_list), 0)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 0) # 0 because labour line contain no movement 'Pay Sheet Cell')), 0) # 2 because labour line contain no movement
def stepCheckPaysheetLineAreCreatedUsingBonus(self, sequence=None, **kw): def stepCheckPaysheetLineAreCreatedUsingBonus(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')
self.assertEqual(len(paysheet_line_list), 4) self.assertEqual(len(paysheet_line_list), 3)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 4) # 2 for bonus 2 for urssaf 'Pay Sheet Cell')), 2) # 2 because labour line contain no movement
# 2 for urssaf
def stepCheckThereIsOnlyOnePaysheetLine(self, sequence=None, **kw): def stepCheckThereIsOnlyOnePaysheetLine(self, sequence=None, **kw):
paysheet = sequence.get('paysheet') paysheet = sequence.get('paysheet')
...@@ -718,7 +672,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -718,7 +672,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def stepCheckPaysheetLineAreCreatedUsingSlices(self, sequence=None, **kw): def stepCheckPaysheetLineAreCreatedUsingSlices(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')
self.assertEqual(len(paysheet_line_list), 7) self.assertEqual(len(paysheet_line_list), 2)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'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
...@@ -726,7 +680,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -726,7 +680,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
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')
self.assertEqual(len(paysheet_line_list), 5) self.assertEqual(len(paysheet_line_list), 2)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 4) # 4 because labour line contain no movement and 'Pay Sheet Cell')), 4) # 4 because labour line contain no movement and
# because of the 2 slice and 2 contribution_shares # because of the 2 slice and 2 contribution_shares
...@@ -734,14 +688,17 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -734,14 +688,17 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def stepCheckPaysheetLineAreCreatedUsingWith3Lines(self, sequence=None, **kw): def stepCheckPaysheetLineAreCreatedUsingWith3Lines(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')
self.assertEqual(len(paysheet_line_list), 5) self.assertEqual(len(paysheet_line_list), 3)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 4) # 2 for urssaf 2 for sickness insurrance 'Pay Sheet Cell')), 4) # 4 because labour line contain no movement and
# because of the two lines and 2 contribution_shares
# (urssaf and sickness insurance. old age
# insurance does not match predicate)
def stepCheckPaysheetLineAreCreatedAfterUpdateWithLinesWithSameResource(self, sequence=None, **kw): def stepCheckPaysheetLineAreCreatedAfterUpdateWithLinesWithSameResource(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')
self.assertEqual(len(paysheet_line_list), 9) self.assertEqual(len(paysheet_line_list), 3)
self.assertEqual(len(paysheet.getMovementList(portal_type=\ self.assertEqual(len(paysheet.getMovementList(portal_type=\
'Pay Sheet Cell')), 8) # 8 because labour line contain no movement and 'Pay Sheet Cell')), 8) # 8 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
...@@ -753,14 +710,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -753,14 +710,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee') self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(cell.getQuantity(), 3000) self.assertEquals(cell1.getPrice(), 0.1)
self.assertEquals(cell.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer')
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employer": self.assertEquals(cell2.getQuantity(), 3000)
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer') self.assertEquals(cell2.getPrice(), 0.5)
self.assertEquals(cell.getQuantity(), 3000)
self.assertEquals(cell.getPrice(), 0.5)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -772,27 +727,16 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -772,27 +727,16 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employer": cell1 = paysheet_line.getCell('contribution_share/employee')
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer') self.assertEquals(cell1.getQuantity(), 4000)
self.assertEquals(cell.getQuantity(), 4000) self.assertEquals(cell1.getPrice(), 0.1)
self.assertEquals(cell.getPrice(), 0.5) cell2 = paysheet_line.getCell('contribution_share/employer')
elif paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employee": self.assertEquals(cell2.getQuantity(), 4000)
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee') self.assertEquals(cell2.getPrice(), 0.5)
self.assertEquals(cell.getQuantity(), 4000)
self.assertEquals(cell.getPrice(), 0.1)
else:
self.fail("Unknown contribution for line %s" % paysheet_line.getBaseContribution())
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
elif service == 'Bonus': elif service == 'Bonus':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": self.assertEqual(paysheet_line.getTotalPrice(), 1000.0)
cell = paysheet_line.getCell('base_contribution/base_amount/payroll/base/contribution/employer')
self.assertEquals(cell.getTotalPrice(), 1000)
elif paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee":
cell = paysheet_line.getCell('base_contribution/base_amount/payroll/base/contribution/employee')
self.assertEquals(cell.getTotalPrice(), 1000)
else:
self.fail("Unknown contribution for line %s" % paysheet_line.getBaseContribution())
else: else:
self.fail("Unknown service for line %s" % paysheet_line.getTitle()) self.fail("Unknown service for line %s" % paysheet_line.getTitle())
...@@ -802,16 +746,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -802,16 +746,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
# XXX-Aurel quantity from model line is multiply by total price of labour line # XXX-Aurel quantity from model line is multiply by total price of labour line
# price remains None # price remains None
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee') self.assertEquals(cell1.getQuantity(), -300000)
self.assertEquals(cell.getQuantity(), -300000) self.assertEquals(cell1.getPrice(), None)
self.assertEquals(cell.getPrice(), None) cell2 = paysheet_line.getCell('contribution_share/employer')
elif paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": self.assertEquals(cell2.getQuantity(), -600000)
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer') self.assertEquals(cell2.getPrice(), None)
self.assertEquals(cell.getQuantity(), -600000)
self.assertEquals(cell.getPrice(), None)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -823,45 +765,35 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -823,45 +765,35 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
app_list = paysheet_line.getBaseApplicationList() if paysheet_line.getSalaryRange() == 'france/slice_0_to_200':
if 'base_amount/payroll/base/contribution/employee' in app_list: cell1 = paysheet_line.getCell('contribution_share/employee',
if "base_amount/payroll/l10n/fr/salary_range/slice_0_to_200" in app_list: 'salary_range/france/slice_0_to_200')
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200')
self.assertEquals(cell1.getQuantity(), 200) self.assertEquals(cell1.getQuantity(), 200)
self.assertEquals(cell1.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
elif "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list: cell2 = paysheet_line.getCell('contribution_share/employer',
cell3 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_0_to_200')
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400')
self.assertEquals(cell3.getQuantity(), 200)
self.assertEquals(cell3.getPrice(), 0.3)
elif "base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000" in app_list:
cell5 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000')
self.assertEquals(cell5.getQuantity(), 2600)
self.assertEquals(cell5.getPrice(), 0.5)
else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle()))
elif 'base_amount/payroll/base/contribution/employer' in app_list:
if "base_amount/payroll/l10n/fr/salary_range/slice_0_to_200" in app_list:
cell2 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200')
self.assertEquals(cell2.getQuantity(), 200) self.assertEquals(cell2.getQuantity(), 200)
self.assertEquals(cell2.getPrice(), 0.2) self.assertEquals(cell2.getPrice(), 0.2)
elif "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list: elif paysheet_line.getSalaryRange() == 'france/slice_200_to_400':
cell4 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer', cell3 = paysheet_line.getCell('contribution_share/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400') '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.getQuantity(), 200)
self.assertEquals(cell4.getPrice(), 0.4) self.assertEquals(cell4.getPrice(), 0.4)
elif "base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000" in app_list: elif paysheet_line.getSalaryRange() == 'france/slice_400_to_5000':
cell6 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer', cell5 = paysheet_line.getCell('contribution_share/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000') '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.getQuantity(), 2600)
self.assertEquals(cell6.getPrice(), 0.6) self.assertEquals(cell6.getPrice(), 0.6)
else: else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle())) self.fail("Unknown salary range for line %s" % paysheet_line.getTitle())
else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle()))
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -873,35 +805,26 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -873,35 +805,26 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
app_list = paysheet_line.getBaseApplicationList() if paysheet_line.getSalaryRange() == 'france/slice_200_to_400':
if 'base_amount/payroll/base/contribution/employee' in app_list: cell1 = paysheet_line.getCell('contribution_share/employee',
if "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list: 'salary_range/france/slice_200_to_400')
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400')
self.assertEquals(cell1.getQuantity(), 200) self.assertEquals(cell1.getQuantity(), 200)
self.assertEquals(cell1.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
elif "base_amount/payroll/l10n/fr/salary_range/slice_600_to_800" in app_list: cell2 = paysheet_line.getCell('contribution_share/employer',
cell3 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400')
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_600_to_800')
self.assertEquals(cell3.getQuantity(), 200)
self.assertEquals(cell3.getPrice(), 0.1)
else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle()))
elif 'base_amount/payroll/base/contribution/employer' in app_list:
if "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list:
cell2 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400')
self.assertEquals(cell2.getQuantity(), 200) self.assertEquals(cell2.getQuantity(), 200)
self.assertEquals(cell2.getPrice(), 0.2) self.assertEquals(cell2.getPrice(), 0.2)
elif "base_amount/payroll/l10n/fr/salary_range/slice_600_to_800" in app_list: elif paysheet_line.getSalaryRange() == 'france/slice_600_to_800':
cell4 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer', cell3 = paysheet_line.getCell('contribution_share/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_600_to_800') 'salary_range/france/slice_600_to_800')
self.assertEquals(cell3.getQuantity(), 200)
self.assertEquals(cell3.getPrice(), 0.3)
cell4 = paysheet_line.getCell('contribution_share/employer',
'salary_range/france/slice_600_to_800')
self.assertEquals(cell4.getQuantity(), 200) self.assertEquals(cell4.getQuantity(), 200)
self.assertEquals(cell4.getPrice(), 0.2) self.assertEquals(cell4.getPrice(), 0.4)
else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle()))
else: else:
self.fail("Unknown application %s for line %s" % (app_list,paysheet_line.getTitle())) self.fail("Unknown salary range for line %s" % paysheet_line.getTitle())
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -914,47 +837,40 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -914,47 +837,40 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
app_list = paysheet_line.getBaseApplicationList() if paysheet_line.getSalaryRange() == 'france/slice_0_to_200':
if 'base_amount/payroll/base/contribution/employee' in app_list: cell1 = paysheet_line.getCell('contribution_share/employee',
if "base_amount/payroll/l10n/fr/salary_range/slice_0_to_200" in app_list: 'salary_range/france/slice_0_to_200')
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200')
self.assertEquals(cell1.getQuantity(), 200) self.assertEquals(cell1.getQuantity(), 200)
self.assertEquals(cell1.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
elif "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list: cell2 = paysheet_line.getCell('contribution_share/employer',
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_0_to_200')
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400') self.assertEquals(cell2.getQuantity(), 200)
self.assertEquals(cell1.getQuantity(), 200) self.assertEquals(cell2.getPrice(), 0.2)
self.assertEquals(cell1.getPrice(), 0.3) elif paysheet_line.getSalaryRange() == 'france/slice_200_to_400':
elif "base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000" in app_list: cell3 = paysheet_line.getCell('contribution_share/employee',
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee', 'salary_range/france/slice_200_to_400')
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000') self.assertEquals(cell3.getQuantity(), 200)
self.assertEquals(cell1.getQuantity(), 2600) self.assertEquals(cell3.getPrice(), 0.3)
self.assertEquals(cell1.getPrice(), 0.5) 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: else:
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee') cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(cell1.getQuantity(), 3000) self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(cell1.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
elif 'base_amount/payroll/base/contribution/employer' in app_list: cell2 = paysheet_line.getCell('contribution_share/employer')
if "base_amount/payroll/l10n/fr/salary_range/slice_0_to_200" in app_list: self.assertEquals(cell2.getQuantity(), 3000)
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer', self.assertEquals(cell2.getPrice(), 0.5)
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_0_to_200')
self.assertEquals(cell1.getQuantity(), 200)
self.assertEquals(cell1.getPrice(), 0.2)
elif "base_amount/payroll/l10n/fr/salary_range/slice_200_to_400" in app_list:
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_200_to_400')
self.assertEquals(cell1.getQuantity(), 200)
self.assertEquals(cell1.getPrice(), 0.4)
elif "base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000" in app_list:
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer',
'base_application/base_amount/payroll/l10n/fr/salary_range/slice_400_to_5000')
self.assertEquals(cell1.getQuantity(), 2600)
self.assertEquals(cell1.getPrice(), 0.6)
else:
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer')
self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(cell1.getPrice(), 0.5)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -966,21 +882,21 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -966,21 +882,21 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": cell2 = paysheet_line.getCell('contribution_share/employer')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell2.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.5) self.assertEquals(cell2.getPrice(), 0.5)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
elif service == 'Sickness Insurance': elif service == 'Sickness Insurance':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.4) self.assertEquals(cell1.getPrice(), 0.4)
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": cell2 = paysheet_line.getCell('contribution_share/employer')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell2.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.3) self.assertEquals(cell2.getPrice(), 0.3)
else: else:
self.fail("Unknown service for line %s" % paysheet_line.getTitle()) self.fail("Unknown service for line %s" % paysheet_line.getTitle())
...@@ -990,21 +906,21 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -990,21 +906,21 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": cell2 = paysheet_line.getCell('contribution_share/employer')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell2.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.5) self.assertEquals(cell2.getPrice(), 0.5)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
elif service == 'Old Age Insurance': elif service == 'Old Age Insurance':
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.5) self.assertEquals(cell1.getPrice(), 0.5)
if paysheet_line.getBaseContribution() == "base_amount/payroll/base/contribution/employer": cell2 = paysheet_line.getCell('contribution_share/employer')
self.assertEquals(paysheet_line.getQuantity(), 3000) self.assertEquals(cell2.getQuantity(), 3000)
self.assertEquals(paysheet_line.getPrice(), 0.8) self.assertEquals(cell2.getPrice(), 0.8)
else: else:
self.fail("Unknown service for line %s" % paysheet_line.getTitle()) self.fail("Unknown service for line %s" % paysheet_line.getTitle())
...@@ -1040,7 +956,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1040,7 +956,6 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
source_section_value=urssaf_roubaix, source_section_value=urssaf_roubaix,
) )
def stepModelSpecialiseBusinessProcess(self, sequence=None, **kw): def stepModelSpecialiseBusinessProcess(self, sequence=None, **kw):
model = sequence.get('model') model = sequence.get('model')
business_process = sequence.get('business_process') business_process = sequence.get('business_process')
...@@ -1056,10 +971,10 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1056,10 +971,10 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
self.assertEquals(paysheet_line.getSourceSectionValue(), urssaf_roubaix) self.assertEquals(cell1.getSourceSectionValue(), urssaf_roubaix)
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employer": cell2 = paysheet_line.getCell('contribution_share/employer')
self.assertEquals(paysheet_line.getSourceSectionValue(), urssaf_roubaix) self.assertEquals(cell2.getSourceSectionValue(), urssaf_roubaix)
elif service == 'Labour': elif service == 'Labour':
pass pass
else: else:
...@@ -1235,9 +1150,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1235,9 +1150,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
int_index = 10, int_index = 10,
reference='intermediate_line', reference='intermediate_line',
price=0.2, price=0.2,
base_contribution_list=['base_amount/payroll/base/income_tax/employee', base_contribution_list=['base_amount/payroll/base/income_tax'],
'base_amount/payroll/base/income_tax/employer'], base_application_list=['base_amount/payroll/base/contribution'])
base_application_list=['base_amount/payroll/base/contribution/employee',])
sequence.edit(intermediate_model_line = model_line) sequence.edit(intermediate_model_line = model_line)
def stepModelCreateAppliedOnTaxModelLine(self, sequence=None, **kw): def stepModelCreateAppliedOnTaxModelLine(self, sequence=None, **kw):
...@@ -1251,25 +1165,26 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1251,25 +1165,26 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('urssaf_service'), resource_value=sequence.get('urssaf_service'),
reference='line_applied_on_intermediate_line', reference='line_applied_on_intermediate_line',
variation_category_list=['base_application/base_amount/payroll/base/income_tax/employee', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/income_tax/employer'], 'contribution_share/employer'],
base_contribution_list=['base_amount/payroll/report/salary/net'],) base_contribution_list=['base_amount/payroll/report/salary/net'],
base_application_list=['base_amount/payroll/base/income_tax'])
sequence.edit(model_line_applied_on_tax = model_line) sequence.edit(model_line_applied_on_tax = model_line)
def stepAppliedOnTaxModelLineCreateMovements(self, sequence=None, **kw): def stepAppliedOnTaxModelLineCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('model_line_applied_on_tax') model_line = sequence.get('model_line_applied_on_tax')
cell1 = model_line.newCell('base_application/base_amount/payroll/base/income_tax/employee', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application='base_amount/payroll/base/income_tax/employee', base_application = "contribution_share/employee",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.1, quantity=None) cell1.edit(price=0.1, quantity=None, contribution_share='employee')
cell2 = model_line.newCell('base_application/base_amount/payroll/base/income_tax/employer', cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_id='movement', base_id='movement',
base_application='base_amount/payroll/base/income_tax/employer', base_application = "contribution_share/employer",
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.5, quantity=None) cell2.edit(price=0.5, quantity=None, contribution_share='employer')
def stepModelCreateOldAgeInsuranceModelLine(self, sequence=None, **kw): def stepModelCreateOldAgeInsuranceModelLine(self, sequence=None, **kw):
model = sequence.get('model') model = sequence.get('model')
...@@ -1278,25 +1193,28 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1278,25 +1193,28 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('old_age_insurance_service'), resource_value=sequence.get('old_age_insurance_service'),
reference='old_age_insurance', reference='old_age_insurance',
variation_category_list=['base_application/base_amount/payroll/base/contribution/employee', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer'], 'contribution_share/employer'],
base_application_list=[ 'base_amount/payroll/base/contribution'],
base_contribution_list=['base_amount/payroll/base/income_tax']) base_contribution_list=['base_amount/payroll/base/income_tax'])
sequence.edit(old_age_insurance = model_line) sequence.edit(old_age_insurance = model_line)
def stepOldAgeInsuranceModelLineCreateMovements(self, sequence=None, **kw): def stepOldAgeInsuranceModelLineCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('old_age_insurance') model_line = sequence.get('old_age_insurance')
cell1 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employee', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employee',
base_id='movement', base_id='movement',
base_application = "contribution_share/employee",
quantity=None,
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.5, quantity=None) cell1.edit(price=0.5, contribution_share='employee')
cell2 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employer', cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employer',
base_id='movement', base_id='movement',
base_application = "contribution_share/employer",
quantity=None,
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.8, quantity=None) cell2.edit(price=0.8, contribution_share='employer')
def stepModelCreateSicknessInsuranceModelLine(self, sequence=None, **kw): def stepModelCreateSicknessInsuranceModelLine(self, sequence=None, **kw):
model = sequence.get('model') model = sequence.get('model')
...@@ -1305,51 +1223,50 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1305,51 +1223,50 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
trade_phase='payroll/france/urssaf', trade_phase='payroll/france/urssaf',
resource_value=sequence.get('sickness_insurance_service'), resource_value=sequence.get('sickness_insurance_service'),
reference='sickness_insurance', reference='sickness_insurance',
variation_category_list=['base_application/base_amount/payroll/base/contribution/employee', variation_category_list=['contribution_share/employee',
'base_application/base_amount/payroll/base/contribution/employer'], 'contribution_share/employer'],
base_contribution_list=['base_amount/payroll/base/income_tax'],) base_application_list=[ 'base_amount/payroll/base/contribution'],
base_contribution_list=['base_amount/payroll/base/income_tax'])
sequence.edit(sickness_insurance = model_line) sequence.edit(sickness_insurance = model_line)
def stepSicknessInsuranceModelLineCreateMovements(self, sequence=None, **kw): def stepSicknessInsuranceModelLineCreateMovements(self, sequence=None, **kw):
model_line = sequence.get('sickness_insurance') model_line = sequence.get('sickness_insurance')
cell1 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employee', cell1 = model_line.newCell('contribution_share/employee',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employee',
base_id='movement', base_id='movement',
base_application = "contribution_share/employee",
quantity=None,
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.4, quantity=None) cell1.edit(price=0.4, contribution_share='employee')
cell2 = model_line.newCell('base_application/base_amount/payroll/base/contribution/employer', cell2 = model_line.newCell('contribution_share/employer',
portal_type='Pay Sheet Model Cell', portal_type='Pay Sheet Model Cell',
base_application='base_amount/payroll/base/contribution/employer',
base_id='movement', base_id='movement',
base_application = "contribution_share/employer",
quantity=None,
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.3, quantity=None) cell2.edit(price=0.3, contribution_share='employer')
def stepCheckPaysheetIntermediateLines(self, sequence=None, **kw): def stepCheckPaysheetIntermediateLines(self, sequence=None, **kw):
paysheet = sequence.get('paysheet') paysheet = sequence.get('paysheet')
# paysheet should contain only three lines (labour and 2 urssaf, but not # paysheet should contain only two lines (labour and urssaf, but not
# intermediate urssaf # intermediate urssaf
self.assertEquals(len(paysheet.contentValues(portal_type=\ self.assertEquals(len(paysheet.contentValues(portal_type=\
'Pay Sheet Line')), 3) 'Pay Sheet Line')), 2)
# check amounts # check amounts
paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line') paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line')
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseApplication() == 'base_amount/payroll/base/income_tax/employee': cell1 = paysheet_line.getCell('contribution_share/employee')
cell1 = paysheet_line.getCell('base_application/base_amount/payroll/base/income_tax/employee')
self.assertEquals(cell1.getQuantity(), 600) # here it's 600 of tax self.assertEquals(cell1.getQuantity(), 600) # here it's 600 of tax
# because of the intermediate line (3000*0.2) # because of the intermediate line (3000*0.2)
self.assertEquals(cell1.getPrice(), 0.1) self.assertEquals(cell1.getPrice(), 0.1)
elif paysheet_line.getBaseApplication() == 'base_amount/payroll/base/income_tax/employer': cell2 = paysheet_line.getCell('contribution_share/employer')
cell2 = paysheet_line.getCell('base_application/base_amount/payroll/base/income_tax/employer')
self.assertEquals(cell2.getQuantity(), 600) # here it's 600 of tax self.assertEquals(cell2.getQuantity(), 600) # here it's 600 of tax
# because of the intermediate line (3000*0.2) # because of the intermediate line (3000*0.2)
self.assertEquals(cell2.getPrice(), 0.5) self.assertEquals(cell2.getPrice(), 0.5)
else:
self.fail("Unknown application for %s line %s" % (paysheet_line.getBaseApplication(), paysheet_line.getTitle()))
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -1357,14 +1274,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1357,14 +1274,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
def stepModelModifyUrssafModelLine(self, sequence=None, **kw): def stepModelModifyUrssafModelLine(self, sequence=None, **kw):
model_line = sequence.get('urssaf_model_line') model_line = sequence.get('urssaf_model_line')
cell_1 = model_line.getCell('base_application/base_amount/payroll/base/contribution/employee', # modify price on movements :
cell_1 = model_line.getCell('contribution_share/employee',
base_id='movement') base_id='movement')
self.assertNotEquals(cell_1, None) self.assertNotEquals(cell_1, None)
cell_1.edit(price=0.2, quantity=None) cell_1.edit(price=0.2)
cell_2 = model_line.getCell('base_application/base_amount/payroll/base/contribution/employer', cell_2 = model_line.getCell('contribution_share/employer',
base_id='movement') base_id='movement')
self.assertNotEquals(cell_2, None) self.assertNotEquals(cell_2, None)
cell_2.edit(price=0.6, quantity=None) cell_2.edit(price=0.6)
def stepModelDelUrssafModelLine(self, sequence=None, **kw): def stepModelDelUrssafModelLine(self, sequence=None, **kw):
model_line = sequence.get('urssaf_model_line') model_line = sequence.get('urssaf_model_line')
...@@ -1377,14 +1295,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1377,14 +1295,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
for paysheet_line in paysheet_line_list: for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle() service = paysheet_line.getResourceTitle()
if service == 'Urssaf': if service == 'Urssaf':
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employee": cell1 = paysheet_line.getCell('contribution_share/employee')
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employee') self.assertEquals(cell1.getQuantity(), 3000)
self.assertEquals(cell.getQuantity(), 3000) self.assertEquals(cell1.getPrice(), 0.2)
self.assertEquals(cell.getPrice(), 0.2) cell2 = paysheet_line.getCell('contribution_share/employer')
if paysheet_line.getBaseApplication() == "base_amount/payroll/base/contribution/employer": self.assertEquals(cell2.getQuantity(), 3000)
cell = paysheet_line.getCell('base_application/base_amount/payroll/base/contribution/employer') self.assertEquals(cell2.getPrice(), 0.6)
self.assertEquals(cell.getQuantity(), 3000)
self.assertEquals(cell.getPrice(), 0.6)
elif service == 'Labour': elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else: else:
...@@ -1521,24 +1437,19 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): ...@@ -1521,24 +1437,19 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
# if the line has cells with different tax categories, new properties are # if the line has cells with different tax categories, new properties are
# added to this line. # added to this line.
urssaf_service = sequence.get('urssaf_service') urssaf_service = sequence.get('urssaf_service')
urssaf_service.edit(variation_base_category_list=['base_contribution'])
urssaf_service.setVariationCategoryList(['base_contribution/base_amount/payroll/base/contribution/employee',
'base_contribution/base_amount/payroll/base/contribution/employer'
])
line.setResourceValue(urssaf_service) line.setResourceValue(urssaf_service)
line.setVariationCategoryList(['base_contribution/base_amount/payroll/base/contribution/employee', line.setVariationCategoryList(['contribution_share/employee',
'base_contribution/base_amount/payroll/base/contribution/employer' 'contribution_share/employer'])
]) cell0 = line.newCell('contribution_share/employee',
cell0 = line.newCell('base_contribution/base_amount/payroll/base/contribution/employee',
portal_type='Pay Sheet Cell', base_id='movement') portal_type='Pay Sheet Cell', base_id='movement')
cell0.setMappedValuePropertyList(['quantity', 'price']) cell0.setMappedValuePropertyList(['quantity', 'price'])
cell0.setVariationCategoryList(('base_contribution/base_amount/payroll/base/contribution/employee',)) cell0.setVariationCategoryList(('contribution_share/employee',))
cell0.setPrice(2.0) cell0.setPrice(2.0)
cell0.setQuantity(3.0) cell0.setQuantity(3.0)
cell1 = line.newCell('base_contribution/base_amount/payroll/base/contribution/employer', cell1 = line.newCell('contribution_share/employer',
portal_type='Pay Sheet Cell', base_id='movement') portal_type='Pay Sheet Cell', base_id='movement')
cell1.setMappedValuePropertyList(['quantity', 'price']) cell1.setMappedValuePropertyList(['quantity', 'price'])
cell1.setVariationCategoryList(('base_contribution/base_amount/payroll/base/contribution/employer',)) cell1.setVariationCategoryList(('contribution_share/employer',))
cell1.setPrice(4.0) cell1.setPrice(4.0)
cell1.setQuantity(5.0) cell1.setQuantity(5.0)
...@@ -2406,7 +2317,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -2406,7 +2317,6 @@ class TestPayroll(TestPayrollMixin):
sequence_string = self.COMMON_BASIC_DOCUMENT_CREATION_SEQUENCE_STRING + """ sequence_string = self.COMMON_BASIC_DOCUMENT_CREATION_SEQUENCE_STRING + """
CreateBonusService CreateBonusService
PaysheetCreateBonusPaySheetLine PaysheetCreateBonusPaySheetLine
PaysheetCreateBonusPaySheetLineMovements
CheckUpdateAggregatedAmountListReturn CheckUpdateAggregatedAmountListReturn
PaysheetApplyTransformation PaysheetApplyTransformation
Tic Tic
...@@ -2470,7 +2380,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -2470,7 +2380,6 @@ class TestPayroll(TestPayrollMixin):
variation_base_category_list=('contribution_share',), variation_base_category_list=('contribution_share',),
variation_category_list=('contribution_share/employee', variation_category_list=('contribution_share/employee',
'contribution_share/employer')) 'contribution_share/employer'))
self.createPayrollBusinesProcess() self.createPayrollBusinesProcess()
employer = self.portal.organisation_module.newContent( employer = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -2524,8 +2433,8 @@ class TestPayroll(TestPayrollMixin): ...@@ -2524,8 +2433,8 @@ class TestPayroll(TestPayrollMixin):
ps2 = self.portal.accounting_module.newContent( ps2 = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction', portal_type='Pay Sheet Transaction',
title='Employee 2', title='Employee 2',
destination_section_value=employer,
specialise_value=self.business_process, specialise_value=self.business_process,
destination_section_value=employer,
source_section_value=employee2, source_section_value=employee2,
start_date=DateTime(2006, 1, 1),) start_date=DateTime(2006, 1, 1),)
line = ps2.newContent(portal_type='Pay Sheet Line', line = ps2.newContent(portal_type='Pay Sheet Line',
...@@ -2636,7 +2545,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -2636,7 +2545,6 @@ class TestPayroll(TestPayrollMixin):
'contribution_share/employer', 'contribution_share/employer',
'salary_range/france/slice_a', 'salary_range/france/slice_a',
'salary_range/france/slice_b')) 'salary_range/france/slice_b'))
self.createPayrollBusinesProcess() self.createPayrollBusinesProcess()
employer = self.portal.organisation_module.newContent( employer = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -2861,7 +2769,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -2861,7 +2769,6 @@ class TestPayroll(TestPayrollMixin):
variation_base_category_list=('contribution_share',), variation_base_category_list=('contribution_share',),
variation_category_list=('contribution_share/employee', variation_category_list=('contribution_share/employee',
'contribution_share/employer')) 'contribution_share/employer'))
self.createPayrollBusinesProcess() self.createPayrollBusinesProcess()
employer = self.portal.organisation_module.newContent( employer = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -3004,7 +2911,6 @@ class TestPayroll(TestPayrollMixin): ...@@ -3004,7 +2911,6 @@ class TestPayroll(TestPayrollMixin):
line_list[-1], line_list[-1],
total_price=3000 + 2000 - (2000 * .5) - (3000 * .5)) total_price=3000 + 2000 - (2000 * .5) - (3000 * .5))
def createPayrollBusinesProcess(self): def createPayrollBusinesProcess(self):
currency_module = self.getCurrencyModule() currency_module = self.getCurrencyModule()
if not hasattr(currency_module, 'EUR'): if not hasattr(currency_module, 'EUR'):
......
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