Commit 45fbd1aa authored by Fabien Morin's avatar Fabien Morin

- add a new test to be sure intermediate lines are not created and permit to...

- add a new test to be sure intermediate lines are not created and permit to be used in normal lines
- remove unused lines


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27162 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0e70681a
master DateTime.equalTo_fix TMP-2to3 UpdateValidationStateFromConsistency UserPropertySheet_backward_compatibility addToDate_implicit_localtime allow_login_change allow_login_change_wip arnau arnau-RD-Components-CacheTool arnau-RD-Components-ERP5Form-ERP5Report arnau-RD-Components-ERP5Form-SelectionTool-MemcachedTool arnau-RD-Components-ERP5OOo arnau-RD-Components-PreferenceTool-Preference arnau-RD-Components-Products-import-compat arnau-RD-Components-astroid_cache_per_component_reset arnau-RD-Components-erp5_crm arnau-RD-Components-erp5_trade-TODO-Interactor arnau-RD-ERP5ify-portal_workflow-1-seb-merged-with-recent-master arnau-RD-ERP5ify-portal_workflow-2-do-not-rename-erp5_workflow-portal_types arnau-RD-ERP5ify-portal_workflow-BAK arnau-RD-ERP5ify-portal_workflow-WIP arnau-RD-ERP5ify-portal_workflow-WITHOUT-MIGRATION arnau-RD-ERP5ify-portal_workflow-WORKFLOWS-NOT-MIGRATED arnau-RD-py3-master-TM arnau-RD-py3-master-TM-BAK arnau-RD-py3-master-WIP arnau-RD-py3-master-WIP-BAK arnau-RD-py3-master-WIP-bt5-and-tests arnau-RD-zope4py3 arnau-TM-Components-Migrate-PortalTransforms arnau-TM-Components-ModuleSecurityInfo arnau-TM-FEC-output arnau-TM-WIP arnau-TM-isBuildable-with-multiple-BusinessLinks arnau-TM-newContent-temp_object arnau-TM-runUnitTest-clear-previous-execution-catalog arnau-TM-wkhtmltopdf arnau-WIP arnau-kns arnau-kns-without-property-mapping arnau-merge arnau-my2to3 arnau-poc arnau-real-time-inventory-accounting arnau-zope4py2 aurel-zope4py2 auto_extend_select_list autoflake backup_erp5_workflow bk_erp5ish_actions_tool bk_sqlcatalog boc-interaction-drop bt5_config cache cache-control-304-response callable-jupyter-storage catalog_filter catalog_fulltext catalog_fulltext_old cedric cedriclen cedriclen-eos certificate_authority cherry-pick-4a8e045d cleanJSByJSLint clean_up_upgrader cleanup_acquisition_base_category cloud_reliability_test credential_update_action cribjs-bootloader datetimefield deferred_listbox delivery_item_barcode douglas_forum dream_distributor drop-ZServer dsn-phase3 e2e-erp5 enhance_scalability_testing eos-dev erp5-component erp5-component-bak erp5-forum erp5-imt erp5-messenger erp5-preference erp5-release erp5-slapos-upgrade erp5-util-testing erp5-vifib erp5-vifib-cleanup erp5-vifib-no-Products.DCWorkflowGraph erp5_calendar erp5_catalog erp5_catalog_final erp5_corporate_identity erp5_drone_simulator erp5_free_subscription erp5_hal_json_style_fix_restricted_access_with_traverse erp5_payslip_migration erp5_workflow erp5testnode_max_timeout extend_login_once_form feat/catalog_unhandled_search_type_raise feat/coding_style_test feat/dedup_roles_in_pickles feat/dms_implicit_predecessor_successor_fields feat/erp5_ide feat/erp5pt feat/improve_rounding_tool feat/inventory_api_group_by_time_interval_list feat/lxml-html-snapshot feat/mariadb-10.11 feat/mariadb-10.11bis feat/mariadb-10.5 feat/mariadb-10.6 feat/notification-message-ignore-missing feat/olapy feat/python_language_support feat/round_half_up feat/selenium-unexpected-success feat/slapos_agent_distributor feat/subject_set_query feat/tester_role feature/renderjs-ui-no-header fix/TALES_hide_error fix/ZMI_editor_preference fix/advance_ecommerce_coding_crimes fix/erp5_site_global_id fix/login_validate_check_consistency fix/mariadb-1927 fix/monaco-altClick fix/officejs_support_request_rss_secu fix/state_var fix/support-request-app-empty fix/testnode_proctitle fix/workflow_method_security fix_web_illustration for_testrunner_1 for_testrunner_2 for_testrunner_3 gabriel gadget-json-value graphic_gadget_js hotfix/rjs-formfields-padding improve_default_caching_policy_manager initsite interaction-drop inventory isDeletable ivan jerome-bt-reference-doc jerome_graph_editor_renderjs jerome_user_preference_time_zone jio jm/form-action-guard js-ui kns lazy_simulation_causality lignan limit_accelerated_http_cache_manager lingnan listbox_url lle-bout/metadata-modules macros_fix mame-test-stock-indexation master-erp5-test-result-scalability master-erp5-test-result-scalability-rebase master-test-fix-additionalbt5path master_w mic_wind monitoring-graph mr1362 mrp my2to3 new-render-presentation nicolas-slice-price no_longer_simulated_state notebook_roque officejs override_cache_control_header_by_caching_policy_manager pere poc/json-forms-study portal_callables portal_solver_process_security_configuration presentation publish_recursiveReindexObject rebased_mrp refactor/base_edit reindex_calendar_after_change_calendar_exception restore-from-trashbin revert-192c2000 revert-38554dbe rfc/activate_default rjs_listbox_sort_icon roque_quick scalability-master scalability-master2 scalability-master2-rebase scalability-roque scalability-roque-2 scalability-run-command scalability_crash_mariadb shop-box shop-box-rebase streaming_fix streaming_fix-0 support_legacy_sftp_server support_relative_url_in_hyperlink_field support_request syncml taskdistribution-xmlrpc-binary test-renderjs-float-field-step test_cmfactivity_isolation_level test_dynamic_methods test_page testnode_software_link timezones tomo_testnode_slap_request translatable_path_master tristan tristan-merge tristan-performance trustable-x-forwarded-for ttrm unify_predicate_edit view-aggregated-amounts vivekpab_renderjs_interfaces waitForActivities_assertionMessage wenjie wenjie_branch without_legacy_workflow wsgi wsgi-gevent wsgi_backport_setbody_lock wsgi_medusa_stream_fix yryr yryr-components-cp yryr-inventory-cache yryr-test yryr-with-components zope2 zope2zope4py2 zope4py3 zope4py3-master-rebase 0.4.59.1 0.4.59 test-ui test-rjsacc test-rjs renderjs-test nexedi-erp5-vifib-20201105 erp5.util-0.4.74 erp5.util-0.4.73 erp5.util-0.4.72 erp5.util-0.4.71 erp5.util-0.4.69 erp5.util-0.4.68 erp5.util-0.4.67 erp5.util-0.4.66 erp5.util-0.4.65 erp5.util-0.4.64 erp5.util-0.4.63 erp5.util-0.4.62 erp5.util-0.4.61 erp5.util-0.4.60 erp5.util-0.4.59.1 erp5.util-0.4.59 erp5.util-0.4.58 erp5.util-0.4.57 erp5.util-0.4.56 erp5.util-0.4.55 erp5.util-0.4.54 erp5.util-0.4.53 erp5.util-0.4.52 erp5.util-0.4.49 erp5.util-0.4.46 erp5.util-0.4.44 erp5.util-0.4.43 erp5.util-0.4.41 erp5.util-0.4.40 erp5.util-0.4.37 erp5.util-0.4.1 erp5.util-0.4 erp5.util-0.3 erp5.util-0.2 erp5.util-0.1 erp5-vifib-20240326 erp5-vifib-20230331 erp5-vifib-20230201 erp5-vifib-20220526 erp5-vifib-20220302 erp5-vifib-20210707 erp5-vifib-20201229 erp5-vifib-20200129
No related merge requests found
...@@ -86,6 +86,7 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -86,6 +86,7 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
'tax_category/employee_share', 'tax_category/employee_share',
'base_amount/deductible_tax', 'base_amount/deductible_tax',
'base_amount/base_salary', 'base_amount/base_salary',
'base_amount/net_salary',
'grade/worker', 'grade/worker',
'grade/engineer', 'grade/engineer',
'quantity_unit/time/month', 'quantity_unit/time/month',
...@@ -185,8 +186,6 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -185,8 +186,6 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
base_id='movement', base_id='movement',
mapped_value_property_list=('quantity', 'price')) mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.5, tax_category='employer_share') cell2.edit(price=0.5, tax_category='employer_share')
sequence.edit(urssaf_model_line_cell1 = cell1)
sequence.edit(urssaf_model_line_cell2 = cell2)
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')
...@@ -436,6 +435,94 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin): ...@@ -436,6 +435,94 @@ class TestNewPayrollMixin(ERP5ReportTestCase, TestBPMMixin):
self.assertCellIsNone(model_country, 'salary_range/france/forfait') self.assertCellIsNone(model_country, 'salary_range/france/forfait')
self.assertCell(model_country, 'salary_range/france/slice_c', 4, 5) self.assertCell(model_country, 'salary_range/france/slice_c', 4, 5)
def stepCreateIntermediateModelLine(self, sequence=None, **kw):
'''
create an intermediate_line wich contribute to tax and applied to
base_salary
'''
model = sequence.get('model')
model_line = self.createModelLine(model)
model_line.edit(title='intermediate line',
int_index=2,
trade_phase='trade_phase/payroll/france/urssaf',
resource_value=sequence.get('urssaf_payroll_service'),
variation_category_list=['tax_category/employee_share',
'tax_category/employer_share'],
base_contribution_list=['base_amount/deductible_tax'],
base_application_list=['base_amount/base_salary'],
create_paysheet_line=False,)
sequence.edit(intermediate_model_line = model_line)
def stepCreateModelLineAppliedOnTax(self, sequence=None, **kw):
'''
create a model line applied on tax
'''
model = sequence.get('model')
model_line = self.createModelLine(model)
model_line.edit(title='line applied on intermediate line',
int_index=3,
trade_phase='trade_phase/payroll/france/urssaf',
resource_value=sequence.get('urssaf_payroll_service'),
variation_category_list=['tax_category/employee_share',
'tax_category/employer_share'],
base_contribution_list=['base_amount/net_salary'],
base_application_list=['base_amount/deductible_tax'])
sequence.edit(model_line_applied_on_tax = model_line)
def stepCreateMovementOnIntermediateModelLine(self, sequence=None,
**kw):
model_line = sequence.get('intermediate_model_line')
cell1 = model_line.newCell('tax_category/employee_share',
portal_type='Pay Sheet Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.2, tax_category='employee_share')
cell2 = model_line.newCell('tax_category/employer_share',
portal_type='Pay Sheet Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.2, tax_category='employer_share')
def stepCreateMovementOnModelLineAppliedOnTax(self, sequence=None, **kw):
model_line = sequence.get('model_line_applied_on_tax')
cell1 = model_line.newCell('tax_category/employee_share',
portal_type='Pay Sheet Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell1.edit(price=0.1, tax_category='employee_share')
cell2 = model_line.newCell('tax_category/employer_share',
portal_type='Pay Sheet Cell',
base_id='movement',
mapped_value_property_list=('quantity', 'price'))
cell2.edit(price=0.5, tax_category='employer_share')
def stepCheckPaysheetIntermediateLines(self, sequence=None, **kw):
paysheet = sequence.get('paysheet')
# paysheet should contain only two lines (labour and urssaf, but not
# intermediate ursaff
self.assertEquals(len(paysheet.contentValues(portal_type=\
'Pay Sheet Line')), 2)
# check amounts
paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line')
for paysheet_line in paysheet_line_list:
service = paysheet_line.getResourceTitle()
if service == 'Urssaf':
cell1 = paysheet_line.getCell('tax_category/employee_share')
self.assertEquals(cell1.getQuantity(), 600) # here it's 600 of tax
# because of the intermediate line (3000*0.2)
self.assertEquals(cell1.getPrice(), 0.1)
cell2 = paysheet_line.getCell('tax_category/employer_share')
self.assertEquals(cell2.getQuantity(), 600) # here it's 600 of tax
# because of the intermediate line (3000*0.2)
self.assertEquals(cell2.getPrice(), 0.5)
elif service == 'Labour':
self.assertEqual(paysheet_line.getTotalPrice(), 3000.0)
else:
self.fail("Unknown service for line %s" % paysheet_line)
class TestNewPayroll(TestNewPayrollMixin): class TestNewPayroll(TestNewPayrollMixin):
COMMON_BASIC_DOCUMENT_CREATION_SEQUENCE_STRING = """ COMMON_BASIC_DOCUMENT_CREATION_SEQUENCE_STRING = """
CreateUrssafPayrollService CreateUrssafPayrollService
...@@ -536,6 +623,39 @@ class TestNewPayroll(TestNewPayrollMixin): ...@@ -536,6 +623,39 @@ class TestNewPayroll(TestNewPayrollMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_intermediateLines(self):
'''
Intermediate lines are paysheet model lines usefull to calcul, but we
don't want to have on paysheet. So a checkbox on paysheet model lines
permit to create it or not (created by default)
'''
sequence_list = SequenceList()
sequence_string = """
CreateUrssafPayrollService
CreateLabourPayrollService
CreateEmployer
CreateEmployee
CreateBasicModel
CreateIntermediateModelLine
CreateMovementOnIntermediateModelLine
CreateModelLineAppliedOnTax
CreateMovementOnModelLineAppliedOnTax
CreateBasicPaysheet
PaysheetCreateLabourPaySheetLine
Tic
CreateBusinessProcess
CreateBusinessPath
CreateUrssafRoubaixOrganisation
ModifyBusinessPathTradePhase
SpecialiseBusinessProcessOnModel
Tic
PaysheetApplyTransformation
Tic
CheckPaysheetIntermediateLines
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
import unittest import unittest
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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