def SYS_FunctionList():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model(
            "SYS_FunctionList",
            [["function_id"]],
            sorting=helpers.create_field("text"),
            description=helpers.create_field("text"),
            custom_name=helpers.create_field("text"),
            style_class=helpers.create_field("text"),
            url=helpers.create_field("text"),
            image=helpers.create_field("text"),
            default_name=helpers.create_field("text", True),
            height=helpers.create_field("text"),
            parent_id=helpers.create_field("text"),
            active=helpers.create_field("bool"),
            function_id=helpers.create_field("text", True),
            type=helpers.create_field("text"),
            width=helpers.create_field("text"),
            icon=helpers.create_field("text"),
            app=helpers.create_field("text"),
            level_code=helpers.create_field("list")
        )
        _hasCreated=True
    ret = db_context.collection("SYS_FunctionList")

    return ret
def HCSSYS_Departments():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model(
            "HCSSYS_Departments",
            [["department_code"]],
            #id=helpers.create_field("numeric",True),
            department_code=helpers.create_field("text", True),
            department_name=helpers.create_field("text"),
            department_name2=helpers.create_field("text"),
            department_alias=helpers.create_field("text"),
            #parent_id=helpers.create_field("numeric"),
            parent_code=helpers.create_field("text"),
            level=helpers.create_field("numeric"),
            level_code=helpers.create_field("text"),
            level_code2=helpers.create_field("text"),
            department_tel=helpers.create_field("text"),
            department_fax=helpers.create_field("text"),
            department_email=helpers.create_field("text"),
            department_address=helpers.create_field("text"),
            #Xem lại kiểu dữ liệu
            nation_code=helpers.create_field("text"),
            province_code=helpers.create_field("text"),
            district_code=helpers.create_field("text"),
            is_company=helpers.create_field("bool"),
            is_fund=helpers.create_field("bool"),
            is_fund_bonus=helpers.create_field("bool"),
            decision_no=helpers.create_field("text"),
            decision_date=helpers.create_field("date"),
            effect_date=helpers.create_field("date"),
            license_no=helpers.create_field("text"),
            tax_code=helpers.create_field("text"),
            lock_date=helpers.create_field("date"),
            logo_image=helpers.create_field("text"),
            manager_code=helpers.create_field("text"),
            secretary_code=helpers.create_field("text"),
            ordinal=helpers.create_field("text"),
            lock=helpers.create_field("bool"),
            note=helpers.create_field("text"),
            region_code=helpers.create_field("text"),
            domain_code=helpers.create_field("text"),
            signed_by=helpers.create_field("text"),
            created_on=helpers.create_field("date"),
            created_by=helpers.create_field("text"),
            modified_on=helpers.create_field("date"),
            modified_by=helpers.create_field("text")
        )
        _hasCreated=True
    ret = db_context.collection("HCSSYS_Departments")

    return ret
def tmp_transactions():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model(
            "tmp_transactions",
            [["transaction_id"]],
            transaction_id=helpers.create_field("text", True),
            collection_name=heplers.create_field("text", True),
            path=helpers.create_field("text", True),
            session=helpers.create_field("text", True),
            ordinal=helpers.create_field("numeric"),
            data=helpers.create_field("text"),
            created_on=helpers.create_field("date"),
            created_by=helpers.create_field("text"),
        )
        _hasCreated = True
    ret = db_context.collection("tmp_transactions")

    return ret
def tmp_transactions():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model(
            "tmp_transactions",
            [["transaction_id"]],
            transaction_id=helpers.create_field("text", True),
            collection_name=heplers.create_field("text", True),
            path=helpers.create_field("text", True),
            session=helpers.create_field("text", True),
            ordinal=helpers.create_field("numeric"),
            data=helpers.create_field("text"),
            created_on=helpers.create_field("date"),
            created_by=helpers.create_field("text"),
        )
        _hasCreated=True
    ret = db_context.collection("tmp_transactions")

    return ret
def SYS_ValueList():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model("SYS_ValueList", [["language", "list_name"]],
                             language=helpers.create_field("text"),
                             list_name=helpers.create_field("text"),
                             values=helpers.create_field(
                                 "list", False,
                                 dict(value=helpers.create_field("numeric"),
                                      caption=helpers.create_field("text"),
                                      custom=helpers.create_field("text"))),
                             multi_select=helpers.create_field("bool"),
                             description=helpers.create_field("text"),
                             created_on=helpers.create_field("date"),
                             created_by=helpers.create_field("text"),
                             modified_on=helpers.create_field("date"),
                             modified_by=helpers.create_field("text"))
        _hasCreated = True
    ret = db_context.collection("SYS_ValueList")

    return ret
def SYS_FunctionList():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model("SYS_FunctionList", [["function_id"]],
                             sorting=helpers.create_field("text"),
                             description=helpers.create_field("text"),
                             custom_name=helpers.create_field("text"),
                             style_class=helpers.create_field("text"),
                             url=helpers.create_field("text"),
                             image=helpers.create_field("text"),
                             default_name=helpers.create_field("text", True),
                             height=helpers.create_field("text"),
                             parent_id=helpers.create_field("text"),
                             active=helpers.create_field("bool"),
                             function_id=helpers.create_field("text", True),
                             type=helpers.create_field("text"),
                             width=helpers.create_field("text"),
                             icon=helpers.create_field("text"))
        _hasCreated = True
    ret = db_context.collection("SYS_FunctionList")

    return ret
def SYS_ValueList():
    global _hasCreated
    if not _hasCreated:
        helpers.define_model(
            "SYS_ValueList",
            [["language", "list_name"]],
            language=helpers.create_field("text"),
            list_name=helpers.create_field("text"),
            values=helpers.create_field("list",False,dict(
                value = helpers.create_field("numeric"),
                caption = helpers.create_field("text"),
                custom = helpers.create_field("text")
                )),
            multi_select=helpers.create_field("bool"),
            description=helpers.create_field("text"),
            created_on=helpers.create_field("date"),
            created_by=helpers.create_field("text"),
            modified_on=helpers.create_field("date"),
            modified_by=helpers.create_field("text")
        )
        _hasCreated=True
    ret = db_context.collection("SYS_ValueList")

    return ret
Exemple #8
0
from config import database, helpers, db_context
_hasCreated = False
helpers.define_model("LMSSYS_Value_List", [["language", "list_name"]],
                     language=helpers.create_field("text"),
                     list_name=helpers.create_field("text"),
                     values=helpers.create_field(
                         "list", False,
                         dict(value=helpers.create_field("numeric"),
                              caption=helpers.create_field("text"),
                              custom=helpers.create_field("text"))),
                     multi_select=helpers.create_field("bool"),
                     description=helpers.create_field("text"),
                     created_on=helpers.create_field("date"),
                     created_by=helpers.create_field("text"),
                     modified_on=helpers.create_field("date"),
                     modified_by=helpers.create_field("text"))


def LMSSYS_Value_List():
    global _hasCreated
    if not _hasCreated:
        _hasCreated = True
    ret = db_context.collection("LMSSYS_Value_List")

    return ret
from config import database, helpers, db_context
helpers.define_model(
    "tmp_transactions",
    [["transaction_id"]],
    transaction_id=("text", True),
    collection_name=("text", True),
    path=("text", True),
    session=("text", True),
    ordinal=("numeric"),
    data=("text"),
    created_on=("date"),
    created_by=("text"),
)


def tmp_transactions():
    ret = db_context.collection("tmp_transactions")
    return ret
Exemple #10
0
def on_before_insert(data):
    user = "******"
    if hasattr(threading.current_thread(), "user"):
        user = threading.current_thread().user.username
    if data.get('created_by', None) == None:
        data.update({
            "created_on": datetime.datetime.now(),
            "created_by": user
        })


def on_before_update(data):
    user = "******"
    if hasattr(threading.current_thread(), "user"):
        user = threading.current_thread().user.username
    if data.get('modified_by', None) == None:
        data.update({
            "modified_on": datetime.datetime.now(),
            "modified_by": user
        })


helpers.define_model(
    "base", [],
    dict(created_on=helpers.create_field("date", True),
         created_by=helpers.create_field("text", True),
         modified_on=helpers.create_field("date", True),
         modified_by=helpers.create_field("text", True)))

helpers.events("base").on_before_insert(on_before_insert).on_before_update(
    on_before_update)
Exemple #11
0
from config import database, helpers, db_context
from ...api import common

_hasCreated=False
helpers.define_model(
            "LMS_SetupProcessApproveLevel",
            [['rec_id']],
            rec_id =helpers.create_field("text", True),
            process_id=helpers.create_field("int", True),
            approve_level=helpers.create_field("int", True),
            approver_value=helpers.create_field("int"),
            email_approve_code=helpers.create_field("text"),
            email_approve_to=helpers.create_field("int"),
            email_approve_cc=helpers.create_field("text"),
            email_reject_code=helpers.create_field("text"),
            email_reject_to=helpers.create_field("int"),
            email_reject_cc=helpers.create_field("text"),
            default_approver_code=helpers.create_field("text"),
            not_receive_email=helpers.create_field("bool"),
            created_on=helpers.create_field("date"),
            created_by=helpers.create_field("text"),
            modified_on=helpers.create_field("date"),
            modified_by=helpers.create_field("text"),
        )
def LMS_SetupProcessApproveLevel():
    global _hasCreated
    if not _hasCreated:
        def on_before_insert(data):
            data.update({
                "rec_id": common.generate_guid()
                })
Exemple #12
0
    user = "******"
    if hasattr(threading.current_thread(),"user"):
        user = threading.current_thread().user.username
    if data.get('created_by',None)==None:
        data.update({
            "created_on":datetime.datetime.now(),
            "created_by":user
            })
def on_before_update(data):
    user = "******"
    if hasattr(threading.current_thread(),"user"):
        user = threading.current_thread().user.username
    if data.get('modified_by',None)==None:
        data.update({
            "modified_on":datetime.datetime.now(),
            "modified_by":user
            })

helpers.define_model(
    "base",
    [],
    dict(
        _id=helpers.create_field("text"),
        created_on=helpers.create_field("date",True),
        created_by=helpers.create_field("text",True),
        modified_on=helpers.create_field("date"),
        modified_by=helpers.create_field("text")
    )
)

helpers.events("base").on_before_insert(on_before_insert).on_before_update(on_before_update)
from config import database, helpers, db_context
helpers.define_model(
    "SYS_FunctionList_Favorite",
    [["function_id"]],
    sorting=("text"),
    description=("text"),
    custom_name=("text"),
    style_class=("text"),
    url=("text"),
    image=("text"),
    default_name=("text", True),
    height=("text"),
    parent_id=("text"),
    active=("bool"),
    function_id=("text", True),
    type=("text"),
    width=float,
    icon=str,
    app=str,
    level_code=list,
    color=object,
)


def SYS_FunctionList_Favorite():
    ret = db_context.collection("SYS_FunctionList_Favorite")
    return ret
helpers.define_model(
    "HCSSYS_Departments",
    [["department_code"]],
    #id=helpers.create_field("numeric",True),
    department_code=helpers.create_field("text", True),
    department_name=helpers.create_field("text"),
    department_name2=helpers.create_field("text"),
    department_alias=helpers.create_field("text"),
    #parent_id=helpers.create_field("numeric"),
    parent_code=helpers.create_field("text"),
    level=helpers.create_field("numeric"),
    level_code=helpers.create_field("text"),
    level_code2=helpers.create_field("text"),
    department_tel=helpers.create_field("text"),
    department_fax=helpers.create_field("text"),
    department_email=helpers.create_field("text"),
    department_address=helpers.create_field("text"),
    #Xem lại kiểu dữ liệu
    nation_code=helpers.create_field("text"),
    province_code=helpers.create_field("text"),
    district_code=helpers.create_field("text"),
    is_company=helpers.create_field("bool"),
    is_fund=helpers.create_field("bool"),
    is_fund_bonus=helpers.create_field("bool"),
    decision_no=helpers.create_field("text"),
    decision_date=helpers.create_field("date"),
    effect_date=helpers.create_field("date"),
    license_no=helpers.create_field("text"),
    tax_code=helpers.create_field("text"),
    lock_date=helpers.create_field("date"),
    logo_image=helpers.create_field("text"),
    manager_code=helpers.create_field("text"),
    secretary_code=helpers.create_field("text"),
    ordinal=helpers.create_field("text"),
    lock=helpers.create_field("bool"),
    note=helpers.create_field("text"),
    region_code=helpers.create_field("text"),
    domain_code=helpers.create_field("text"),
    signed_by=helpers.create_field("text"),
    created_on=helpers.create_field("date"),
    created_by=helpers.create_field("text"),
    modified_on=helpers.create_field("date"),
    modified_by=helpers.create_field("text"))
Exemple #15
0
from config import database, helpers, db_context
_hasCreated = False
helpers.define_model(
    "SYS_FunctionList",
    [["function_id"]],
    sorting=helpers.create_field("text"),
    description=helpers.create_field("text"),
    custom_name=helpers.create_field("text"),
    style_class=helpers.create_field("text"),
    url=helpers.create_field("text"),
    image=helpers.create_field("text"),
    default_name=helpers.create_field("text", True),
    height=helpers.create_field("text"),
    parent_id=helpers.create_field("text"),
    active=helpers.create_field("bool"),
    function_id=helpers.create_field("text", True),
    type=helpers.create_field("text"),
    width=helpers.create_field("text"),
    icon=helpers.create_field("text"),
    level_code=helpers.create_field("list"),
    app=helpers.create_field("text"),
    color=helpers.create_field("object"),
)


def SYS_FunctionList():
    global _hasCreated
    if not _hasCreated:
        _hasCreated = True
    ret = db_context.collection("SYS_FunctionList")