Source code for footnotes.business_rules
"""Business rules for Footnotes and Footnote Types."""
from common.business_rules import DescriptionsRules
from common.business_rules import PreventDeleteIfInUse
from common.business_rules import UniqueIdentifyingFields
from common.business_rules import ValidityPeriodContained
[docs]class FOT2(PreventDeleteIfInUse):
"""The footnote type cannot be deleted if it is used in a footnote."""
[docs]class FO2(UniqueIdentifyingFields):
"""The combination of footnote type and code must be unique."""
[docs]class FO5(ValidityPeriodContained):
"""When a footnote is used in a measure the validity period of the footnote
must span the validity period of the measure."""
contained_field_name = "footnoteassociationmeasure__footnoted_measure"
[docs]class FO6(ValidityPeriodContained):
"""When a footnote is used in a goods nomenclature the validity period of
the footnote must span the validity period of the association with the goods
nomenclature."""
contained_field_name = "footnoteassociationgoodsnomenclature"
[docs]class FO9(ValidityPeriodContained):
"""When a footnote is used in an additional code the validity period of the
footnote must span the validity period of the association with the
additional code."""
container_field_name = "footnoteassociationadditionalcode"
[docs]class FO11(PreventDeleteIfInUse):
"""When a footnote is used in a measure then the footnote may not be
deleted."""
via_relation = "footnoteassociationmeasure"
[docs]class FO12(PreventDeleteIfInUse):
"""When a footnote is used in a goods nomenclature then the footnote may not
be deleted."""
via_relation = "footnoteassociationgoodsnomenclature"
[docs]class FO15(PreventDeleteIfInUse):
"""When a footnote is used in an additional code then the footnote may not
be deleted."""
via_relation = "footnoteassociationadditionalcode"
[docs]class FO17(ValidityPeriodContained):
"""The validity period of the footnote type must span the validity period of
the footnote."""
container_field_name = "footnote_type"