|
2 | 2 | # License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
|
3 | 3 |
|
4 | 4 | from odoo.exceptions import UserError
|
5 |
| -from odoo.tests import Form |
| 5 | +from odoo.tests import Form, tagged |
6 | 6 | from odoo.tests.common import SavepointCase
|
7 | 7 |
|
8 | 8 |
|
| 9 | +@tagged("post_install", "-at_install") |
9 | 10 | class TestMove(SavepointCase):
|
10 | 11 | @classmethod
|
11 | 12 | def setUpClass(cls):
|
12 | 13 | super().setUpClass()
|
13 | 14 | cls.partner = cls.env["res.partner"].create(
|
14 | 15 | {"name": "Test customer", "customer_rank": 1}
|
15 | 16 | )
|
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 |
| - ) |
24 | 17 | cls.product = cls.env["product.product"].create(
|
25 | 18 | {"name": "Test product", "type": "service"}
|
26 | 19 | )
|
27 | 20 | 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 |
| - |
37 | 21 | invoice = Form(
|
38 | 22 | 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 |
40 | 24 | )
|
41 | 25 | )
|
42 | 26 | invoice.partner_id = cls.partner
|
43 |
| - invoice.journal_id = cls.journal |
44 | 27 | with invoice.invoice_line_ids.new() as line_form:
|
45 |
| - line_form.name = cls.product.name |
46 | 28 | line_form.product_id = cls.product
|
47 | 29 | line_form.quantity = 1.0
|
48 | 30 | line_form.price_unit = 10
|
49 |
| - line_form.account_id = cls.income_account |
50 | 31 | invoice = invoice.save()
|
51 | 32 | invoice.action_post()
|
52 | 33 | cls.invoice = invoice
|
|
0 commit comments