mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-21 10:02:02 +02:00
Initial commit: Accounting packages
This commit is contained in:
commit
4ef34c2317
2661 changed files with 1709616 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_account_group
|
||||
from . import test_debit_credit
|
||||
from . import test_company_fiscal_year
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class SpreadsheetAccountGroupTest(AccountTestInvoicingCommon):
|
||||
|
||||
def test_fetch_account_no_group(self):
|
||||
self.assertEqual(self.env["account.account"].get_account_group([]), [])
|
||||
|
||||
def test_fetch_account_one_group(self):
|
||||
self.assertEqual(self.env["account.account"].get_account_group(['income_other']), [['450000']])
|
||||
|
||||
def test_group_with_no_account(self):
|
||||
self.env['account.account']\
|
||||
.search([('account_type', '=', 'income_other'), ('company_id', '=', self.env.company.id)])\
|
||||
.unlink()
|
||||
self.assertEqual(self.env["account.account"].get_account_group(['income_other']), [[]])
|
||||
|
||||
def test_with_wrong_account_type_id(self):
|
||||
self.assertEqual(self.env["account.account"].get_account_group([999999]), [[]])
|
||||
|
||||
def test_group_with_multiple_accounts(self):
|
||||
self.env['account.account'].create({
|
||||
'name': "test_group_with_multiple_accounts 1",
|
||||
'account_type': 'income_other',
|
||||
'code': '123',
|
||||
})
|
||||
self.env['account.account'].create({
|
||||
'name': "test_group_with_multiple_accounts 2",
|
||||
'account_type': 'income_other',
|
||||
'code': '789',
|
||||
})
|
||||
|
||||
self.assertEqual(
|
||||
[sorted(x) for x in self.env['account.account'].get_account_group(['income_other'])],
|
||||
[['123', '450000', '789']],
|
||||
)
|
||||
|
||||
def test_response_is_ordered(self):
|
||||
o1_codes_1, o1_codes_2 = self.env["account.account"].get_account_group(
|
||||
["income", "income_other"]
|
||||
)
|
||||
o2_codes_2, o2_codes_1 = self.env["account.account"].get_account_group(
|
||||
["income_other", "income"]
|
||||
)
|
||||
self.assertEqual(o1_codes_1, o2_codes_1)
|
||||
self.assertEqual(o1_codes_2, o2_codes_2)
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
from datetime import date
|
||||
|
||||
|
||||
class SpreadsheetFiscalYearTest(TransactionCase):
|
||||
def test_fiscal_year_reference(self):
|
||||
self.env.company.fiscalyear_last_day = 3
|
||||
self.env.company.fiscalyear_last_month = "2"
|
||||
|
||||
self.assertEqual(
|
||||
self.env["res.company"].get_fiscal_dates(
|
||||
[{"company_id": None, "date": "2020-03-05"}]
|
||||
),
|
||||
[
|
||||
{"start": date(2020, 2, 4), "end": date(2021, 2, 3)},
|
||||
],
|
||||
)
|
||||
|
||||
def test_fiscal_year_reference_last_day(self):
|
||||
self.env.company.fiscalyear_last_day = 3
|
||||
self.env.company.fiscalyear_last_month = "2"
|
||||
|
||||
self.assertEqual(
|
||||
self.env["res.company"].get_fiscal_dates(
|
||||
[{"company_id": None, "date": "2020-02-03"}]
|
||||
),
|
||||
[
|
||||
{"start": date(2019, 2, 4), "end": date(2020, 2, 3)},
|
||||
],
|
||||
)
|
||||
|
||||
def test_fiscal_year_reference_first_day(self):
|
||||
self.env.company.fiscalyear_last_day = 3
|
||||
self.env.company.fiscalyear_last_month = "2"
|
||||
|
||||
self.assertEqual(
|
||||
self.env["res.company"].get_fiscal_dates(
|
||||
[{"company_id": None, "date": "2020-02-04"}]
|
||||
),
|
||||
[{"start": date(2020, 2, 4), "end": date(2021, 2, 3)}],
|
||||
)
|
||||
|
||||
def test_fiscal_year_with_company_id(self):
|
||||
self.env.company.fiscalyear_last_day = 7
|
||||
self.env.company.fiscalyear_last_month = "6"
|
||||
company = self.env["res.company"].create(
|
||||
{
|
||||
"name": "test company",
|
||||
"fiscalyear_last_day": 3,
|
||||
"fiscalyear_last_month": "2",
|
||||
}
|
||||
)
|
||||
self.assertEqual(
|
||||
self.env["res.company"].get_fiscal_dates(
|
||||
[
|
||||
{"company_id": company.id, "date": "2020-02-04"},
|
||||
{"company_id": None, "date": "2020-02-04"},
|
||||
]
|
||||
),
|
||||
[
|
||||
{"start": date(2020, 2, 4), "end": date(2021, 2, 3)},
|
||||
{"start": date(2019, 6, 8), "end": date(2020, 6, 7)},
|
||||
],
|
||||
)
|
||||
|
||||
def test_result_order(self):
|
||||
company = self.env["res.company"].create(
|
||||
{
|
||||
"name": "test company",
|
||||
"fiscalyear_last_day": 3,
|
||||
"fiscalyear_last_month": "2",
|
||||
}
|
||||
)
|
||||
request1 = {"company_id": company.id, "date": "2020-02-04"}
|
||||
request2 = {"company_id": None, "date": "2020-02-04"}
|
||||
[o1_request1, o1_request2] = self.env["res.company"].get_fiscal_dates(
|
||||
[request1, request2]
|
||||
)
|
||||
[o2_request2, o2_request1] = self.env["res.company"].get_fiscal_dates(
|
||||
[request2, request1]
|
||||
)
|
||||
self.assertEqual(o1_request1, o2_request1)
|
||||
self.assertEqual(o1_request2, o2_request2)
|
||||
|
||||
def test_fiscal_year_with_wrong_company_id(self):
|
||||
self.env.company.fiscalyear_last_day = 7
|
||||
self.env.company.fiscalyear_last_month = "6"
|
||||
self.assertEqual(
|
||||
self.env["res.company"].get_fiscal_dates(
|
||||
[
|
||||
{"company_id": 999, "date": "2020-02-04"},
|
||||
{"company_id": None, "date": "2020-02-04"},
|
||||
]
|
||||
),
|
||||
[
|
||||
False,
|
||||
{"start": date(2019, 6, 8), "end": date(2020, 6, 7)},
|
||||
],
|
||||
)
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue