Skip to content

Commit

Permalink
[ADD] account_operating_unit: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Jul 18, 2024
1 parent f0c0e9c commit d328870
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions account_operating_unit/tests/test_invoice_operating_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo.exceptions import UserError
from odoo.tests import tagged
from odoo.tests import Form, tagged

from . import test_account_operating_unit as test_ou

Expand Down Expand Up @@ -42,4 +42,32 @@ def test_create_invoice_validate(self):
with self.assertRaises(UserError):
self.invoice.line_ids[0].company_id = new_company.id
# Check report invoice
self.env["account.invoice.report"].sudo().search_read([])
self.env["account.invoice.report"].sudo().read_group(
[], ["operating_unit_id"], ["operating_unit_id"]
)

def test_form(self):
"""Test that the UI behaves as expected"""
journal_b2b = self.env["account.journal"].create(
{
"name": "B2B journal",
"code": "B2B",
"type": "sale",
"operating_unit_id": self.b2b.id,
"company_id": self.company.id,
}
)
with Form(
self.env["account.move"].with_context(default_move_type="out_invoice")
) as invoice_form:
self.assertEqual(invoice_form.operating_unit_id, self.ou1)
ou1_journal = invoice_form.journal_id.copy(
dict(
operating_unit_id=self.ou1.id,
company_id=self.company.id,
)
)
invoice_form.operating_unit_id = self.b2b
self.assertEqual(invoice_form.journal_id, journal_b2b)
invoice_form.journal_id = ou1_journal
self.assertEqual(invoice_form.operating_unit_id, self.ou1)

0 comments on commit d328870

Please sign in to comment.