Commit ab7b06ee authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Xiaowu Zhang

epr5_accounting: only check valide accounting period

parent c74e8a68
...@@ -79,8 +79,10 @@ if not skip_period_validation : ...@@ -79,8 +79,10 @@ if not skip_period_validation :
section = source_section section = source_section
if section.getPortalType() == 'Organisation': if section.getPortalType() == 'Organisation':
section = section.Organisation_getMappingRelatedOrganisation() section = section.Organisation_getMappingRelatedOrganisation()
if not len(section.contentValues( if not len([ap for ap in section.contentValues(
filter=dict(portal_type="Accounting Period"))): portal_type="Accounting Period",
checked_permission="Access contents information")
if ap.getSimulationState() not in ('deleted', 'cancelled', 'draft',)]):
valid_date = True valid_date = True
else: else:
accounting_period = transaction\ accounting_period = transaction\
...@@ -109,8 +111,10 @@ if not skip_period_validation : ...@@ -109,8 +111,10 @@ if not skip_period_validation :
section = destination_section section = destination_section
if section.getPortalType() == 'Organisation': if section.getPortalType() == 'Organisation':
section = section.Organisation_getMappingRelatedOrganisation() section = section.Organisation_getMappingRelatedOrganisation()
if not len(section.contentValues( if not len([ap for ap in section.contentValues(
filter=dict(portal_type="Accounting Period"))): portal_type="Accounting Period",
checked_permission="Access contents information")
if ap.getSimulationState() not in ('deleted', 'cancelled', 'draft',)]):
valid_date = True valid_date = True
else: else:
accounting_period = transaction\ accounting_period = transaction\
......
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