def add_test_callfunds(simple=True, with_payoff=False): call1 = CallFunds.objects.create(date='2015-06-10', comment='uvw 987') CallDetail.objects.create(callfunds=call1, type_call=0, set_id=1, price='250.00', designation='set 1') CallDetail.objects.create(callfunds=call1, type_call=0, set_id=2, price='25.00', designation='set 2') call1.valid() # => 5 6 7 if not simple: call2 = CallFunds.objects.create(date='2015-07-14', comment='working...') CallDetail.objects.create(callfunds=call2, type_call=1, set_id=3, price='100.00', designation='set 3') call2.valid() # => 9 10 11 if with_payoff: pay1 = Payoff(supporting_id=4, date='2015-06-15', mode=0, amount=100.0) pay1.editor.before_save(None) pay1.save() pay2 = Payoff(supporting_id=7, date='2015-07-21', mode=0, amount=30.0) pay2.editor.before_save(None) pay2.save()
def _add_test_expenses(expense_account1, expense_account2, simple, with_payoff): expense1 = Expense(date=convert_date('2015-05-07'), comment='opq 666', expensetype=0, third_id=2) expense1.editor.before_save(None) expense1.save() ExpenseDetail.objects.create(expense=expense1, set_id=2, designation='set 2', expense_account=expense_account1, price='100') expense1.valid() if not simple: expense2 = Expense(date=convert_date('2015-08-28'), comment='creation', expensetype=0, third_id=2) expense2.editor.before_save(None) expense2.save() ExpenseDetail.objects.create(expense=expense2, set_id=3, designation='set 1', expense_account=expense_account2, price='75') expense2.valid() if with_payoff: pay = Payoff(supporting_id=expense1.id, date='2015-05-11', mode=0, amount=35.0) pay.editor.before_save(None) pay.save() pay = Payoff(supporting_id=expense2.id, date='2015-08-30', mode=0, amount=75.0) pay.editor.before_save(None) pay.save()