예제 #1
0
    def test_begin_withbenef(self):
        self.assertEqual(FiscalYear.objects.get(id=1).status, 0)
        add_entry(1, 1, "2015-04-11", "Report à nouveau bénèf", "-1|6|0|123.45|None|\n-2|2|0|123.45|None|", True)

        self.factory.xfer = ChartsAccountList()
        self.call("/diacamma.accounting/chartsAccountList", {"year": "1", "type_of_account": "2"}, False)
        self.assert_observer("core.custom", "diacamma.accounting", "chartsAccountList")
        self.assert_count_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD', 3)
        self.assert_xml_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD[1]/VALUE[@name="code"]', "106")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="chartsaccount"]/RECORD[1]/VALUE[@name="last_year_total"]',
            '{[font color="green"]}Crédit: 1250.38€{[/font]}',
        )
        self.assert_xml_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD[2]/VALUE[@name="code"]', "110")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="chartsaccount"]/RECORD[2]/VALUE[@name="last_year_total"]',
            '{[font color="green"]}Crédit: 123.45€{[/font]}',
        )

        self.factory.xfer = FiscalYearBegin()
        self.call("/diacamma.accounting/fiscalYearBegin", {"year": "1", "type_of_account": "-1"}, False)
        self.assert_observer("core.custom", "diacamma.accounting", "fiscalYearBegin")
        self.assert_count_equal("COMPONENTS/*", 4)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="info"]', "{[i]}Vous avez un bénéfice de 123.45€.{[br/]}", True
        )
        self.assert_xml_equal('COMPONENTS/SELECT[@name="profit_account"]', "5")
        self.assert_count_equal('COMPONENTS/SELECT[@name="profit_account"]/CASE', 1)
        self.assert_count_equal("ACTIONS/ACTION", 2)

        self.factory.xfer = FiscalYearBegin()
        self.call(
            "/diacamma.accounting/fiscalYearBegin", {"profit_account": "5", "year": "1", "type_of_account": "-1"}, False
        )
        self.assert_observer("core.acknowledge", "diacamma.accounting", "fiscalYearBegin")

        self.assertEqual(FiscalYear.objects.get(id=1).status, 1)

        self.factory.xfer = ChartsAccountList()
        self.call("/diacamma.accounting/chartsAccountList", {"year": "1", "type_of_account": "2"}, False)
        self.assert_observer("core.custom", "diacamma.accounting", "chartsAccountList")
        self.assert_count_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD', 3)
        self.assert_xml_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD[1]/VALUE[@name="code"]', "106")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="chartsaccount"]/RECORD[1]/VALUE[@name="last_year_total"]',
            '{[font color="green"]}Crédit: 1373.83€{[/font]}',
        )
        self.assert_xml_equal('COMPONENTS/GRID[@name="chartsaccount"]/RECORD[2]/VALUE[@name="code"]', "110")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="chartsaccount"]/RECORD[2]/VALUE[@name="last_year_total"]',
            '{[font color="green"]}Crédit: 0.00€{[/font]}',
        )
예제 #2
0
def init_compta():
    year = FiscalYear.get_current()
    if Params.getvalue("condominium-old-accounting"):
        add_entry(year.id, 1, '2015-01-01', 'Report à nouveau',
                  '-1|2|0|23.450000|0|0|None|\n-2|17|4|-23.450000|0|0|None|',
                  True)
    elif get_accounting_system() == 'FR':
        add_entry(
            year.id, 1, '2015-01-01', 'Report à nouveau',
            """-1|2|0|16.680000|0|0|None|
-2|17|4|-23.450000|0|0|None|
-3|18|4|-5.730000|0|0|None|
-4|17|5|10.500000|0|0|None|
-5|18|5|0.7500000|0|0|None|
-6|19|5|0.6000000|0|0|None|
-7|20|5|0.250000|0|0|None|
-8|21|5|0.400000|0|0|None|""", True)
    elif get_accounting_system() == 'BE':
        add_entry(
            year.id, 1, '2015-01-01', 'Report à nouveau',
            """-1|2|0|16.680000|0|0|None|
-2|17|4|-23.450000|0|0|None|
-3|18|4|-5.730000|0|0|None|
-4|17|5|12.500000|0|0|None|""", True)
    add_entry(year.id, 5, '2015-02-20', 'Frais bancaire',
              '-1|2|0|-12.340000|0|0|None|\n-2|15|0|12.340000|0|0|None|', True)
예제 #3
0
def init_compta():
    year = FiscalYear.get_current()
    if Params.getvalue("condominium-old-accounting"):
        add_entry(year.id, 1, '2015-01-01', 'Report à nouveau',
                  '-1|2|0|23.450000|None|\n-2|17|4|-23.450000|None|', True)
    else:
        add_entry(year.id, 1, '2015-01-01', 'Report à nouveau',
                  '-1|2|0|29.180000|None|\n-2|17|4|-23.450000|None|\n-3|18|4|-5.730000|None|', True)
    add_entry(year.id, 5, '2015-02-20', 'Frais bancaire',
              '-1|2|0|-12.340000|None|\n-2|15|0|12.340000|None|', True)
예제 #4
0
def init_compta():
    year = FiscalYear.get_current()
    if Params.getvalue("condominium-old-accounting"):
        add_entry(year.id, 1, '2015-01-01', 'Report à nouveau',
                  '-1|2|0|23.450000|0|None|\n-2|17|4|-23.450000|0|None|', True)
    else:
        add_entry(
            year.id, 1, '2015-01-01', 'Report à nouveau',
            '-1|2|0|16.680000|0|None|\n-2|17|4|-23.450000|0|None|\n-3|18|4|-5.730000|0|None|\n-4|17|5|12.500000|0|None|',
            True)
    add_entry(year.id, 5, '2015-02-20', 'Frais bancaire',
              '-1|2|0|-12.340000|0|None|\n-2|15|0|12.340000|0|None|', True)
예제 #5
0
    def test_begin_lastyearnovalid(self):
        self.assertEqual(FiscalYear.objects.get(id=1).status, 0)
        new_entry = add_entry(
            1, 1, "2015-04-11", "Report à nouveau aussi", "-1|1|0|37.61|None|\n-2|2|0|-37.61|None|", False
        )

        self.factory.xfer = FiscalYearBegin()
        self.call("/diacamma.accounting/fiscalYearBegin", {"year": "1", "type_of_account": "-1"}, False)
        self.assert_observer("core.exception", "diacamma.accounting", "fiscalYearBegin")
        self.assert_xml_equal("EXCEPTION/MESSAGE", "Des écritures de report à nouveau ne sont pas validées!")

        new_entry.closed()

        self.factory.xfer = FiscalYearBegin()
        self.call(
            "/diacamma.accounting/fiscalYearBegin", {"CONFIRME": "YES", "year": "1", "type_of_account": "-1"}, False
        )
        self.assert_observer("core.acknowledge", "diacamma.accounting", "fiscalYearBegin")
        self.assertEqual(FiscalYear.objects.get(id=1).status, 1)