예제 #1
0
class TeamTaskForm(uforms.EnhancedForm):
    model_choices = {
        'user':
        User.objects.filter(is_staff=True).values_list('id', 'first_name'),
        'contractor_id': Contractor.objects.values_list('id', 'name')
    }

    form_order = [
        ['contractor_id', 'user'],
        ['contract_no', 'classification'],
        ['hr'],
        ['end_user', 'remarks'],
        ['description', 'status'],
        ['severity', 'category'],
        ['hr'],
        ['date_expected', 'date_team_task'],
        ['blank', 'date_close'],
    ]

    contractor_id = uforms.EnhancedChoiceField(label='Contractor:')

    #team_task_no = uforms.EnhancedCharField(placeholder='Eg. Alama')
    description = uforms.EnhancedTextField()
    contract_no = uforms.EnhancedCharField()
    category = uforms.EnhancedChoiceField(choices=choices_category)
    status = uforms.EnhancedChoiceField(choices=choices_status)
    severity = uforms.EnhancedChoiceField(choices=choices_severity)
    end_user = uforms.EnhancedCharField()
    remarks = uforms.EnhancedTextField()
    date_expected = uforms.EnhancedDateField(label='Expected Date')
    date_team_task = uforms.EnhancedDateField(label='Task Start Date')
    date_close = uforms.EnhancedDateField(label='Task Close Date')
    classification = uforms.EnhancedChoiceField(choices=choices_classification)

    user = uforms.EnhancedMultipleChoiceField(label="Person/s In Charge")
예제 #2
0
class TeamTaskHistoryAddForm(uforms.EnhancedForm):
    model_choices = {
        'user_id':
        User.objects.filter(is_staff=True).values_list('id', 'username')
    }

    form_order = [
        #        ['document_id'],
        ['user_id', 'status'],
        ['action_taken', 'date_action'],
        ['next_action', 'date_expected'],
        ['remarks', 'file'],
    ]

    # document_id = SelectField('Attachment:',
    #                validators=[DataRequired()],
    #                choices=ChoicesDocument(),
    #                coerce=int
    #                )

    action_taken = uforms.EnhancedTextField()
    next_action = uforms.EnhancedTextField()
    remarks = uforms.EnhancedTextField()
    user_id = uforms.EnhancedChoiceField(label='Username:'******'Task Expected Date')
    date_action = uforms.EnhancedDateField(label='Task Action Date')
    file = uforms.EnhancedFileField(label='Attachment', required=False)
예제 #3
0
class AuthorizeForm(uforms.EnhancedForm):
    model_choices = {
        'task_id': Task.objects.values_list('id', 'task_no'),
    }
    partial_choices = [False, True]
    form_order = [['task_id', 'date'], ['task_child', 'amount']]

    task_id = uforms.EnhancedChoiceField(label='Task No')
    amount = uforms.EnhancedDecimalField(label='Amount')
    date = uforms.EnhancedDateField(required=True)
    task_child = uforms.EnhancedCharField(label='Task No (Child)')
예제 #4
0
파일: forms.py 프로젝트: mpdevilleres/tbpc
class AddSpecForm(uforms.EnhancedForm):

    model_choices = {
    }

    form_order = [
        ['spec_date', 'blank',
         'file', 'blank'],
    ]

    spec_date = uforms.EnhancedDateField(label='Date of Specification:')
    file = uforms.EnhancedFileField(ext_whitelist=['.xlsx'])
예제 #5
0
class AccrualForm(uforms.EnhancedForm):
    model_choices = {
        'task_id': Task.objects.values_list('id', 'task_no'),
    }

    form_order = [
        ['task_id', 'accrual_date'],
        ['amount', 'blank'],
    ]

    task_id = uforms.EnhancedChoiceField(label='Task No')
    accrual_date = uforms.EnhancedDateField(required=True)
    amount = uforms.EnhancedDecimalField(label='Accrual Amount')
예제 #6
0
class PccForm(uforms.EnhancedForm):
    model_choices = {
        'task_id': Task.objects.values_list('id', 'task_no'),
    }
    complete_choices = [False, True]
    form_order = [
        ['task_id', 'rfs_ref'],
        ['amount', 'is_complete'],
        ['pcc_date', 'rfs_date'],
        ['file'],
    ]

    task_id = uforms.EnhancedChoiceField(label='Task No')
    amount = uforms.EnhancedDecimalField(label='PCC Amount')
    rfs_ref = uforms.EnhancedCharField()
    file = uforms.EnhancedFileField(label='Attachment', required=False)
    # ref_no

    rfs_date = uforms.EnhancedDateField(required=True)
    pcc_date = uforms.EnhancedDateField(required=True)
    is_complete = uforms.EnhancedChoiceField(label="PCC Complete?",
                                             choices=[(x, x)
                                                      for x in complete_choices
                                                      ])
예제 #7
0
class InvoiceForm(uforms.EnhancedForm):
    model_choices = {
        'contractor_id': Contractor.objects.values_list('id', 'name'),
        #        'task_id': Task.objects.exclude(tags__name='Backlog').values_list('id', 'task_no'),
        'task_id': Task.objects.values_list('id', 'task_no'),
        'contract_id': Contract.objects.values_list('id', 'contract_no'),
    }

    status_choices = ['Open', 'Close', 'Reject']

    region_choices = ['HO', 'DXB', 'AUH', 'NE']

    invoice_type_choices = [
        'Civil', 'Cable', 'Development', 'Service Provisioning',
        'Supply of Material', 'FTTM', 'Mega Projects'
    ]

    payment_type_choices = ['Delivery', 'RFS', 'Services', 'Support', 'Others']

    form_order = [
        ['region', 'status'],
        ['blank', 'reject_date'],
        ['contractor_id', 'task_id'],
        ['contract_id', 'proj_no'],
        ['invoice_no', 'cost_center'],
        ['invoice_type', 'expense_code'],
        ['payment_type'],
        ['description'],
        ['hr'],
        ['revenue_amount', 'penalty'],
        ['opex_amount', 'blank'],
        ['capex_amount', 'remarks'],
        ['hr'],
        ['invoice_date', 'start_date'],
        ['invoice_cert_date', 'end_date'],
        ['received_date', 'rfs_date'],
        ['hr'],
        ['signed_date', 'sent_finance_date'],
    ]

    contract_id = uforms.EnhancedChoiceField(label='Contract No.')
    contractor_id = uforms.EnhancedChoiceField(label='Contractor Name')
    task_id = uforms.EnhancedChoiceField(label='Task No')

    # state not included

    region = uforms.EnhancedChoiceField(choices=[(x, x)
                                                 for x in region_choices])
    invoice_no = uforms.EnhancedCharField()
    invoice_type = uforms.EnhancedChoiceField(
        choices=[(x, x) for x in invoice_type_choices])
    payment_type = uforms.EnhancedChoiceField(
        choices=[(x, x) for x in payment_type_choices])
    revenue_amount = uforms.EnhancedDecimalField()
    opex_amount = uforms.EnhancedDecimalField()
    capex_amount = uforms.EnhancedDecimalField()

    # invoice_amount not included

    penalty = uforms.EnhancedDecimalField()
    invoice_date = uforms.EnhancedDateField()
    invoice_cert_date = uforms.EnhancedDateField()
    received_date = uforms.EnhancedDateField()
    signed_date = uforms.EnhancedDateField()
    start_date = uforms.EnhancedDateField()
    end_date = uforms.EnhancedDateField()
    rfs_date = uforms.EnhancedDateField()
    reject_date = uforms.EnhancedDateField()
    sent_finance_date = uforms.EnhancedDateField()
    cost_center = uforms.EnhancedCharField()
    expense_code = uforms.EnhancedCharField()
    remarks = uforms.EnhancedTextField()
    description = uforms.EnhancedTextField()
    proj_no = uforms.EnhancedCharField()
    status = uforms.EnhancedChoiceField(choices=[(x, x)
                                                 for x in status_choices])

    def clean(self):
        cleaned_data = super(InvoiceForm, self).clean()
        status = cleaned_data.get('status')
        reject_date = cleaned_data.get('reject_date')

        if status == 'Reject' and not reject_date:
            msg = forms.ValidationError("This field is required.")
            self.add_error('reject_date', msg)

        return self.cleaned_data