Skip to content

Commit

Permalink
FIX acc_fisc_classif: test_no_tax_nor_classification_and_create_one
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Jun 13, 2024
1 parent cff2175 commit a2d72f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ def _find_or_create_classification(self, vals):
for elm in ("supplier_taxes_id", "taxes_id"):
if elm in vals:
del vals[elm]
domain = [("sale_tax_ids", "=", False)]
if sale_tax_ids:
domain.append(("sale_tax_ids", "in", sale_tax_ids))
if purchase_tax_ids:
domain.append(("purchase_tax_ids", "in", purchase_tax_ids))
else:
domain.append(("purchase_tax_ids", "=", False))
classification = self.env["account.product.fiscal.classification"].search(
domain, limit=1
)
Expand Down
4 changes: 3 additions & 1 deletion account_product_fiscal_classification/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ def test_no_tax_nor_classification_and_create_one(self):
"supplier_taxes_id": [],
}
product = self.ProductTemplate.with_user(self.env.user).create(vals)
self.assertNotEqual(product.fiscal_classification_id, False)
classif = product.fiscal_classification_id
self.assertEqual(classif.purchase_tax_ids, self.env["account.tax"])
self.assertEqual(classif.sale_tax_ids, self.env["account.tax"])

def _create_product(self, user, category, classification):
vals = {
Expand Down

0 comments on commit a2d72f6

Please sign in to comment.