Skip to content

Commit b479b34

Browse files
committed
[FIX] account_move_force_removal: Tests in post-install + remove extra data + proper default
If not, there's no guarantee that the chart of accounts is populated, and the tests may fail. Besides, we are removing the explicit account search + assign for avoiding problems on integration tests. And finally, the default value should be `move_type` instead of `type`, as it has changed in this version.
1 parent 2fdb4ed commit b479b34

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

account_move_force_removal/tests/test_move.py

+3-22
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,32 @@
22
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
33

44
from odoo.exceptions import UserError
5-
from odoo.tests import Form
5+
from odoo.tests import Form, tagged
66
from odoo.tests.common import SavepointCase
77

88

9+
@tagged("post_install", "-at_install")
910
class TestMove(SavepointCase):
1011
@classmethod
1112
def setUpClass(cls):
1213
super().setUpClass()
1314
cls.partner = cls.env["res.partner"].create(
1415
{"name": "Test customer", "customer_rank": 1}
1516
)
16-
cls.journal = cls.env["account.journal"].create(
17-
{
18-
"name": "Test journal",
19-
"type": "sale",
20-
"code": "test-sale-jorunal",
21-
"company_id": cls.env.company.id,
22-
}
23-
)
2417
cls.product = cls.env["product.product"].create(
2518
{"name": "Test product", "type": "service"}
2619
)
2720
cls.company = cls.env.company
28-
account_type = cls.env.ref("account.data_account_type_other_income")
29-
cls.income_account = cls.env["account.account"].search(
30-
[
31-
("user_type_id", "=", account_type.id),
32-
("company_id", "=", cls.company.id),
33-
],
34-
limit=1,
35-
)
36-
3721
invoice = Form(
3822
cls.env["account.move"].with_context(
39-
default_type="out_invoice", default_company_id=cls.env.company.id
23+
default_move_type="out_invoice", default_company_id=cls.env.company.id
4024
)
4125
)
4226
invoice.partner_id = cls.partner
43-
invoice.journal_id = cls.journal
4427
with invoice.invoice_line_ids.new() as line_form:
45-
line_form.name = cls.product.name
4628
line_form.product_id = cls.product
4729
line_form.quantity = 1.0
4830
line_form.price_unit = 10
49-
line_form.account_id = cls.income_account
5031
invoice = invoice.save()
5132
invoice.action_post()
5233
cls.invoice = invoice

0 commit comments

Comments
 (0)