[MIG] account_financial_report: Migration to 12.0

[IMP] Reformated one query to avoid one sql injection warning message - but no sql injection was possible here
This commit is contained in:
Wolfgang Pichler
2019-01-16 19:38:26 +01:00
committed by chaule97
parent 3de3a119e5
commit 9f9211b6ea
20 changed files with 86 additions and 61 deletions

View File

@@ -36,7 +36,7 @@ class AbstractTest(common.TransactionCase):
'bank_account_code_prefix': 1014,
'cash_account_code_prefix': 1014,
'currency_id': self.ref('base.USD'),
'transfer_account_id': transfer_account_id.id,
'transfer_account_code_prefix': '000',
})
transfer_account_id.update({
'chart_template_id': self.chart.id,
@@ -98,7 +98,6 @@ class AbstractTest(common.TransactionCase):
def _add_chart_of_accounts(self):
self.company = self.env['res.company'].create({
'name': 'Spanish test company',
'external_report_layout': 'standard',
})
self.env.ref('base.group_multi_company').write({
'users': [(4, self.env.uid)],
@@ -109,15 +108,7 @@ class AbstractTest(common.TransactionCase):
})
self.with_context(
company_id=self.company.id, force_company=self.company.id)
wizard = self.env['wizard.multi.charts.accounts'].create({
'company_id': self.company.id,
'chart_template_id': self.chart.id,
'code_digits': 4,
'currency_id': self.ref('base.USD'),
'transfer_account_id': self.chart.transfer_account_id.id,
})
wizard.onchange_chart_template_id()
wizard.execute()
self.chart.try_loading_for_current_company()
self.revenue = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_revenue"))], limit=1)

View File

@@ -2,7 +2,7 @@
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from datetime import date
from . import abstract_test
@@ -29,7 +29,7 @@ class TestAgedPartnerBalance(abstract_test.AbstractTest):
def _getBaseFilters(self):
return {
'date_at': time.strftime('%Y-12-31'),
'date_at': date(date.today().year, 12, 31),
'company_id': self.company.id,
}

View File

@@ -5,6 +5,7 @@
import time
from odoo.tests import common
from datetime import date, datetime
from . import abstract_test_foreign_currency as a_t_f_c
@@ -31,10 +32,10 @@ class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency):
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'date_from': date(date.today().year, 1, 1),
'date_to': date(date.today().year, 12, 31),
'company_id': self.company.id,
'fy_start_date': time.strftime('%Y-01-01'),
'fy_start_date': date(date.today().year, 1, 1),
'foreign_currency': True,
}
@@ -87,11 +88,11 @@ class TestGeneralLedgerReport(common.TransactionCase):
def setUp(self):
super(TestGeneralLedgerReport, self).setUp()
self.before_previous_fy_year = '2014-05-05'
self.previous_fy_date_start = '2015-01-01'
self.previous_fy_date_end = '2015-12-31'
self.fy_date_start = '2016-01-01'
self.fy_date_end = '2016-12-31'
self.before_previous_fy_year = datetime.strptime('2014-05-05', '%Y-%m-%d')
self.previous_fy_date_start = datetime.strptime('2015-01-01', '%Y-%m-%d')
self.previous_fy_date_end = datetime.strptime('2015-12-31', '%Y-%m-%d')
self.fy_date_start = datetime.strptime('2016-01-01', '%Y-%m-%d')
self.fy_date_end = datetime.strptime('2016-12-31', '%Y-%m-%d')
self.receivable_account = self.env['account.account'].search([
('user_type_id.name', '=', 'Receivable')
], limit=1)

View File

@@ -3,7 +3,7 @@
import time
from datetime import datetime
from datetime import datetime, date
from dateutil.relativedelta import relativedelta
from odoo.fields import Date
@@ -34,8 +34,8 @@ class TestJournalLedger(a_t_f_c.AbstractTestForeignCurrency):
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'date_from': date(date.today().year, 1, 1),
'date_to': date(date.today().year, 12, 31),
'company_id': self.company.id,
'journal_ids': [(6, 0, self.journal_sale.ids)]
}

View File

@@ -2,7 +2,7 @@
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from datetime import date
from . import abstract_test_foreign_currency as a_t_f_c
@@ -28,7 +28,7 @@ class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency):
def _getBaseFilters(self):
return {
'date_at': time.strftime('%Y-12-31'),
'date_at': date(date.today().year, 12, 31),
'company_id': self.company.id,
'foreign_currency': True,
}

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from datetime import date
from odoo.tests import common
from . import abstract_test_foreign_currency as a_t_f_c
@@ -30,10 +30,10 @@ class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency):
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'date_from': date(date.today().year, 1, 1),
'date_to': date(date.today().year, 12, 31),
'company_id': self.company.id,
'fy_start_date': time.strftime('%Y-01-01'),
'fy_start_date': date(date.today().year, 1, 1),
'foreign_currency': True,
'show_partner_details': True,
}

View File

@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from datetime import date
from odoo.tests import common
from . import abstract_test_tax_report
@@ -29,8 +29,8 @@ class TestVAT(abstract_test_tax_report.AbstractTest):
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'date_from': date(date.today().year, 1, 1),
'date_to': date(date.today().year, 12, 31),
'company_id': self.env.user.company_id.id,
}
@@ -157,7 +157,7 @@ class TestVATReport(common.TransactionCase):
def _get_report_lines(self):
self.cbinvoice.pay_and_reconcile(
self.bank_journal.id, 300, time.strftime('%Y-%m-10'))
self.bank_journal.id, 300, date(date.today().year, date.today().month, 10))
vat_report = self.env['report_vat_report'].create({
'date_from': self.date_from,
'date_to': self.date_to,
@@ -274,8 +274,8 @@ class TestVATReport(common.TransactionCase):
'date_to': time.strftime('%Y-%m-01'),
'tax_detail': True})
wizard.onchange_date_range_id()
self.assertEqual(wizard.date_from, time.strftime('%Y-%m-01'))
self.assertEqual(wizard.date_to, time.strftime('%Y-%m-28'))
self.assertEqual(wizard.date_from, date(date.today().year, 1, 1))
self.assertEqual(wizard.date_to, date(date.today().year, date.today().month, 28))
wizard._export('qweb-pdf')
wizard.button_export_html()
wizard.button_export_pdf()
@@ -287,8 +287,8 @@ class TestVATReport(common.TransactionCase):
'based_on': 'taxgroups',
'tax_detail': True})
wizard.onchange_date_range_id()
self.assertEqual(wizard.date_from, time.strftime('%Y-%m-01'))
self.assertEqual(wizard.date_to, time.strftime('%Y-%m-28'))
self.assertEqual(wizard.date_from, date(date.today().year, 1, 1))
self.assertEqual(wizard.date_to, date(date.today().year, date.today().month, 28))
wizard._export('qweb-pdf')
wizard.button_export_html()
wizard.button_export_pdf()