示例#1
0
def general_operations(dbsession, general_upload, company):
    from autonomie.models.accounting.operations import (
        AccountingOperation,
    )
    operations = []
    for month, general, label, debit, credit in (
        (1, "70100", u"", 1000, 0),
        (1, "70200", u"", 1000, 0),
        (1, "602", u"avoir", 0, 1000),
        (1, "601", u"achats", 0, 1000),
        (2, "70100", u"", 2000, 0),
        (2, "70200", u"", 2000, 0),
        (2, "602", u"avoir", 0, 2000),
        (2, "601", u"achats", 0, 2000),
    ):
        op = AccountingOperation(
            date=datetime.date(2017, month, 1),
            analytical_account=company.code_compta,
            general_account=general,
            label=label,
            debit=debit,
            credit=credit,
            upload_id=general_upload.id,
            company_id=company.id,
        )
        dbsession.add(op)
        operations.append(op)
    return operations
示例#2
0
 def query(self):
     query = AccountingOperation.query().options(
         load_only(
             AccountingOperation.id,
             AccountingOperation.analytical_account,
             AccountingOperation.general_account,
             AccountingOperation.company_id,
             AccountingOperation.label,
             AccountingOperation.debit,
             AccountingOperation.credit,
             AccountingOperation.balance,
         ))
     return query.filter_by(upload_id=self.context.id)
示例#3
0
 def query(self):
     query = AccountingOperation.query().options(
         load_only(
             AccountingOperation.id,
             AccountingOperation.analytical_account,
             AccountingOperation.general_account,
             AccountingOperation.company_id,
             AccountingOperation.label,
             AccountingOperation.debit,
             AccountingOperation.credit,
             AccountingOperation.balance,
         )
     )
     return query.filter_by(upload_id=self.context.id)
示例#4
0
def analytical_operations(dbsession, analytical_upload, company):
    from autonomie.models.accounting.operations import (
        AccountingOperation,
    )
    operations = []
    for general, label, debit, credit in (
        ("50000", u"depot banque 1", 1000, 0),
        ("51000", u"depo banque 2", 1000, 0),
        ("42000", u"cotisation", 0, 1000),
        ("425000", u"dépenses", 0, 1000),
    ):
        op = AccountingOperation(
            analytical_account=company.code_compta,
            general_account=general,
            label=label,
            debit=debit,
            credit=credit,
            upload_id=analytical_upload.id,
            company_id=company.id,
        )
        dbsession.add(op)
        operations.append(op)
    return operations
示例#5
0
 def collection_get(self):
     return AccountingOperation.query().all()