示例#1
0
 def get_tel_column(self):
     """
     Return the columns associated to telephonic expenses
     """
     teltype = ExpenseTelType.query().first()
     col = None
     if teltype:
         # Tel expenses should be visible
         col = TypedColumn(teltype, label=u"Téléphonie")
         if teltype.initialize:
             col.force_visible = True
     return col
示例#2
0
def get_new_expense_sheet(year, month, cid, uid):
    """
        Return a new expense sheet for the given 4-uple
    """
    expense = ExpenseSheet()
    expense.name = get_expense_sheet_name(month, year)
    expense.year = year
    expense.month = month
    expense.company_id = cid
    expense.user_id = uid
    query = ExpenseTelType.query()
    query = query.filter(ExpenseTelType.active == True)
    teltypes = query.filter(ExpenseTelType.initialize == True)
    for type_ in teltypes:
        line = ExpenseLine(type_id=type_.id, ht=0, tva=0, description=type_.label)
        expense.lines.append(line)
    return expense
示例#3
0
def get_new_expense_sheet(year, month, cid, uid):
    """
        Return a new expense sheet for the given 4-uple
    """
    expense = ExpenseSheet()
    expense.name = get_expense_sheet_name(month, year)
    expense.year = year
    expense.month = month
    expense.company_id = cid
    expense.user_id = uid
    query = ExpenseTelType.query()
    query = query.filter(ExpenseTelType.active == True)
    teltypes = query.filter(ExpenseTelType.initialize == True)
    for type_ in teltypes:
        line = ExpenseLine(type_id=type_.id,
                           ht=0,
                           tva=0,
                           description=type_.label)
        expense.lines.append(line)
    return expense