Esempio n. 1
0
def insert_a_company(name='test company', insert_contract=True):
    if insert_contract:
        contract = insert_a_contract()
        company = Company.create(**{
            'company_name': name,
            'contracts': [contract]
        })
    else:
        company = Company.create(**{'company_name': name})

    return company
Esempio n. 2
0
def insert_a_company(name='test company', insert_contract=True):
    if insert_contract:
        contract = insert_a_contract()
        company = Company.create(**{
            'company_name': name,
            'contracts': [contract]
        })
    else:
        company = Company.create(**{'company_name': name})

    return company
def create_new_company(company_data):
    '''
    Creates a new company and returns that company.
    '''
    try:
        assign_contract_to_company(company_data.get('contracts', []))
        company = Company.create(**company_data)
        return company
    except Exception, e:
        db.session.rollback()
        raise e
Esempio n. 4
0
def create_new_company(company_data):
    '''
    Creates a new company and returns that company.
    '''
    try:
        assign_contract_to_company(company_data.get('contracts', []))
        company = Company.create(**company_data)
        return company
    except Exception, e:
        db.session.rollback()
        raise e