|
|
@ -4,6 +4,7 @@ |
|
|
|
|
|
|
|
import time |
|
|
|
|
|
|
|
from odoo.api import Environment |
|
|
|
from odoo.tests import common |
|
|
|
from . import abstract_test_foreign_currency as a_t_f_c |
|
|
|
|
|
|
@ -493,7 +494,7 @@ class TestGeneralLedgerReport(common.TransactionCase): |
|
|
|
self.assertEqual(lines['unaffected'].final_debit, 500) |
|
|
|
self.assertEqual(lines['unaffected'].final_credit, 0) |
|
|
|
self.assertEqual(lines['unaffected'].final_balance, 500) |
|
|
|
|
|
|
|
|
|
|
|
def test_partner_filter(self): |
|
|
|
partner_1 = self.env.ref('base.res_partner_1') |
|
|
|
partner_2 = self.env.ref('base.res_partner_2') |
|
|
@ -504,9 +505,43 @@ class TestGeneralLedgerReport(common.TransactionCase): |
|
|
|
partner_3.write({'is_company': False}) |
|
|
|
|
|
|
|
expected_list = [partner_2.id, partner_3.id, partner_4.id] |
|
|
|
context = {'active_ids': |
|
|
|
[partner_1.id, partner_2.id, partner_3.id, partner_4.id], |
|
|
|
context = {'active_ids': [ |
|
|
|
partner_1.id, partner_2.id, partner_3.id, partner_4.id], |
|
|
|
'active_model': 'res.partner'} |
|
|
|
|
|
|
|
wizard = self.env["general.ledger.report.wizard"].with_context(context) |
|
|
|
self.assertEqual(wizard._default_partners(), expected_list) |
|
|
|
self.assertEqual(wizard._default_partners(), expected_list) |
|
|
|
|
|
|
|
def test_validate_date(self): |
|
|
|
company_id = self.env.ref('base.main_company') |
|
|
|
company_id.write({ |
|
|
|
'fiscalyear_last_day': 31, |
|
|
|
'fiscalyear_last_month': 12, |
|
|
|
}) |
|
|
|
user = self.env.ref('base.user_root').with_context( |
|
|
|
company_id=company_id.id) |
|
|
|
wizard = self.env["general.ledger.report.wizard"].with_context( |
|
|
|
user=user.id |
|
|
|
) |
|
|
|
self.assertEqual(wizard._init_date_from(), |
|
|
|
time.strftime('%Y') + '-01-01') |
|
|
|
|
|
|
|
def test_validate_date_range(self): |
|
|
|
data_type = self.env['date.range.type'].create({ |
|
|
|
'name': 'Fiscal year', |
|
|
|
'company_id': False, |
|
|
|
'allow_overlap': False |
|
|
|
}) |
|
|
|
|
|
|
|
dr = self.env['date.range'].create({ |
|
|
|
'name': 'FS2015', |
|
|
|
'date_start': '2018-01-01', |
|
|
|
'date_end': '2018-12-31', |
|
|
|
'type_id': data_type.id, |
|
|
|
}) |
|
|
|
|
|
|
|
wizard = self.env["general.ledger.report.wizard"].create({ |
|
|
|
'date_range_id': dr.id}) |
|
|
|
wizard.onchange_date_range_id() |
|
|
|
self.assertEqual(wizard.date_from, '2018-01-01') |
|
|
|
self.assertEqual(wizard.date_to, '2018-12-31') |