예제 #1
0
파일: sheet.py 프로젝트: lluc/autonomie
    def duplicate(self, year, month):
        sheet = ExpenseSheet()
        sheet.month = month
        sheet.year = year

        sheet.user_id = self.user_id
        sheet.company_id = self.company_id

        sheet.lines = [line.duplicate(sheet) for line in self.lines]
        sheet.kmlines = [line.duplicate(sheet) for line in self.kmlines]

        return sheet
예제 #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