Ignore:
Timestamp:
4 Dec 2014, 18:10:11 (10 years ago)
Author:
Henrik Bettermann
Message:

Add property attribute is_approvable.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py

    r12103 r12144  
    2424from zope.component.interfaces import IFactory
    2525from zope.interface import implementedBy
     26from zope.schema import getFields
    2627from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    2728from waeup.ikoba.interfaces import MessageFactory as _
    28 from waeup.ikoba.interfaces import IIkobaUtils, IObjectHistory
     29from waeup.ikoba.interfaces import IIkobaUtils, IObjectHistory, VERIFIED
    2930from waeup.ikoba.customers.interfaces import (
    3031    IContractsContainer, ICustomerNavigation,
     
    6263    grok.provides(IContract)
    6364    grok.baseclass()
     65
     66    check_docs_interface = None
    6467
    6568    contract_category = None
     
    134137
    135138    @property
     139    def is_approvable(self):
     140        for key, field in getFields(self.check_docs_interface).items():
     141            if key.endswith('_object'):
     142                obj = getattr(self, key, None)
     143                state = getattr(obj, 'state', None)
     144                if state and state != VERIFIED:
     145                    return False
     146        return True
     147
     148    @property
    136149    def translated_class_name(self):
    137150        try:
     
    153166
    154167    edit_form_fields_interface = ISampleContractEdit
     168
     169    check_docs_interface = ISampleContract
    155170
    156171SampleContract = attrs_to_fields(SampleContract)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r12143 r12144  
    276276    last_product_id = Attribute(
    277277        'Id of product recently stored with the contract')
    278     is_editable = Attribute('Document editable by customer')
     278    is_editable = Attribute('Contract editable by customer')
     279    is_approvable = Attribute('Contract approvable by officer')
    279280    translated_class_name = Attribute('Translatable class name')
    280281
Note: See TracChangeset for help on using the changeset viewer.