Skip to content

Commit

Permalink
[FIX] account_invoice_import: fix unit test with tax included
Browse files Browse the repository at this point in the history
  • Loading branch information
i-vyshnevska authored and bosd committed Oct 31, 2023
1 parent 65d7f3f commit 2d9942a
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions account_invoice_import/tests/test_invoice_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ def setUpClass(cls):
"company_id": cls.company.id,
}
)
cls.adjustment_account = cls.env["account.account"].create(
{
"code": "Adjustment",
"name": "adjustment from invoice import",
"user_type_id": cls.env.ref(
"account.data_account_type_current_assets"
).id,
}
)
purchase_tax_vals = {
"name": "Test 1% VAT",
"name": "Test 1% VAT Purchase",
"description": "ZZ-VAT-buy-1.0",
"type_tax_use": "purchase",
"amount": 1,
Expand All @@ -51,7 +60,13 @@ def setUpClass(cls):
}
cls.purchase_tax = cls.env["account.tax"].create(purchase_tax_vals)
sale_tax_vals = purchase_tax_vals.copy()
sale_tax_vals.update({"description": "ZZ-VAT-sale-1.0", "type_tax_use": "sale"})
sale_tax_vals.update(
{
"name": "Test 1% VAT Sale",
"description": "ZZ-VAT-sale-1.0",
"type_tax_use": "sale",
}
)
cls.sale_tax = cls.env["account.tax"].create(sale_tax_vals)
cls.product = cls.env["product.product"].create(
{
Expand Down Expand Up @@ -130,6 +145,13 @@ def setUpClass(cls):
],
}
)
company = cls.env.ref("base.main_company")
company.update(
{
"adjustment_debit_account_id": cls.adjustment_account.id,
"adjustment_credit_account_id": cls.adjustment_account.id,
}
)

def test_import_in_invoice(self):
parsed_inv = {
Expand All @@ -138,7 +160,6 @@ def test_import_in_invoice(self):
"amount_untaxed": 100.0,
"amount_total": 101.0,
"date": "2017-08-16",
"invoice_number": "INV-2017-9876",
"date_due": "2017-08-31",
"date_start": "2017-08-01",
"date_end": "2017-08-31",
Expand Down Expand Up @@ -225,9 +246,9 @@ def test_import_in_invoice_tax_include(self):
"type": "in_invoice",
"journal": {"code": "XXXP2"},
"amount_untaxed": 99.01,
"amount_total": 101.0,
"date": "2017-09-16",
"date_due": "2017-10-21",
"amount_total": 100.00,
"date": "2017-08-16",
"date_due": "2017-08-31",
"date_start": "2017-08-01",
"date_end": "2017-08-31",
"partner": {"name": "Wood Corner"},
Expand Down

0 comments on commit 2d9942a

Please sign in to comment.