[FIX] account,*: Ensure tests using TestInvoicingCommon runs
Add a check in 'AccountTestInvoicingCommon' to ensure that all tests using it are run in post_install. These tests cannot be run at install, thus they would be ignored and wouldn't run on the Runbot. X-original-commit: 659ee179e1beed962026e3abac1bda322c2ac964 [FIX] account,*: Ensure tests using TestInvoicingCommon runs Add a check in 'AccountTestInvoicingCommon' to ensure that all tests using it are run in post_install. These tests cannot be run at install, thus they would be ignored and wouldn't run on the Runbot. closes odoo/odoo#90242 X-original-commit: ec36b403edda3fbe3b5bd5f30f31ef6bad680967 Related: odoo/enterprise#26791 Signed-off-by: Florian Gilbert <flg@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -30,6 +30,8 @@ class AccountTestInvoicingCommon(TransactionCase):
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
super(AccountTestInvoicingCommon, cls).setUpClass()
|
||||
|
||||
assert 'post_install' in cls.test_tags, 'This test requires a CoA to be installed, it should be tagged "post_install"'
|
||||
|
||||
if chart_template_ref:
|
||||
chart_template = cls.env.ref(chart_template_ref)
|
||||
else:
|
||||
|
||||
@@ -5,8 +5,10 @@ from odoo import Command
|
||||
from odoo.addons.account_edi.tests.common import AccountEdiTestCommon, _mocked_post_two_steps, _generate_mocked_needs_web_services, _mocked_cancel_failed, _generate_mocked_support_batching
|
||||
from unittest.mock import patch
|
||||
from odoo.addons.base.tests.test_ir_cron import CronMixinCase
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestAccountEdi(AccountEdiTestCommon, CronMixinCase):
|
||||
|
||||
@classmethod
|
||||
@@ -228,57 +230,6 @@ class TestAccountEdi(AccountEdiTestCommon, CronMixinCase):
|
||||
self.assertEqual(len(capt.records), 2, "Not all records have been processed in this run, the cron should "
|
||||
"re-trigger itself to process some more later")
|
||||
|
||||
def test_prepare_edi_vals_to_export(self):
|
||||
"""
|
||||
Test _prepare_edi_vals_to_export return values
|
||||
in the proper format
|
||||
|
||||
tag_ids should be a set of id and tags a proper recordset
|
||||
"""
|
||||
account_tag = self.env['account.account.tag'].create({
|
||||
"applicability": "taxes",
|
||||
"country_id": self.env.ref('base.us').id,
|
||||
"name": "Test Tag",
|
||||
})
|
||||
tax = self.env['account.tax'].create({
|
||||
"amount": 15,
|
||||
"amount_type": "percent",
|
||||
"description": "15%",
|
||||
"country_id": self.env.ref('base.us').id,
|
||||
"invoice_repartition_line_ids": [
|
||||
Command.create({
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "base",
|
||||
"sequence": 1,
|
||||
}),
|
||||
Command.create({
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "tax",
|
||||
"sequence": 1,
|
||||
"tag_ids": [Command.link(account_tag.id)]
|
||||
})
|
||||
],
|
||||
"name": "Test",
|
||||
"tax_exigibility": "on_invoice",
|
||||
"type_tax_use": "sale"
|
||||
})
|
||||
|
||||
invoices = self.env['account.move'].create({
|
||||
'move_type': 'out_invoice',
|
||||
'invoice_date': '2019-01-01',
|
||||
'date': '2019-01-01',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_line_ids': [Command.create({
|
||||
'product_id': self.product_a.id,
|
||||
'tax_ids': [Command.link(tax.id)]
|
||||
})],
|
||||
})
|
||||
vals = invoices._prepare_edi_vals_to_export()
|
||||
self.assertEqual(
|
||||
vals['invoice_line_vals_list'][0]['tax_detail_vals_list'][0]['tag_ids'], set(account_tag.ids))
|
||||
self.assertEqual(
|
||||
vals['invoice_line_vals_list'][0]['tax_detail_vals_list'][0]['tags'].name, "Test Tag")
|
||||
|
||||
def test_invoice_ready_to_be_sent(self):
|
||||
def _is_needed_for_invoice(edi_format, invoice):
|
||||
return True
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSEPAQRCode(AccountTestInvoicingCommon):
|
||||
""" Tests the generation of Swiss QR-codes on invoices
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
from odoo.addons.hr_expense.tests.common import TestExpenseCommon
|
||||
from odoo.addons.project.tests.test_project_profitability import TestProjectProfitabilityCommon
|
||||
from odoo.tests.common import tagged
|
||||
|
||||
|
||||
class TestProjectHrExpenseProfitabilityCommon(TestExpenseCommon):
|
||||
@@ -30,6 +31,8 @@ class TestProjectHrExpenseProfitabilityCommon(TestExpenseCommon):
|
||||
self.assertEqual(expense_sheet.state, 'approve')
|
||||
return expense_sheet
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestProjectHrExpenseProfitability(TestProjectProfitabilityCommon, TestProjectHrExpenseProfitabilityCommon):
|
||||
|
||||
def test_project_profitability(self):
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.addons.sale.tests.common import TestSaleCommon
|
||||
from odoo.tests.common import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSoLineMilestones(TestSaleCommon):
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import Command
|
||||
|
||||
from .common import TestCommonSaleTimesheet
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestProject(TestCommonSaleTimesheet):
|
||||
def test_fetch_sale_order_items(self):
|
||||
""" Test _fetch_sale_order_items and _get_sale_order_items methods
|
||||
|
||||
Reference in New Issue
Block a user