Skip to content

Commit

Permalink
[FIX] add missing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Urvisha@OSI authored and dreispt committed Aug 27, 2023
1 parent e7367e8 commit d4bba66
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions analytic_activity_based_cost/tests/test_analytic_line_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ def test_analytic_item_create(self):
self.product_id.standard_price = 10.0
analytic_line._compute_amount_abcost()
self.product_id.activity_cost_ids = [(6, 0, [self.ActivityOverheadCostRule.id])]
vals = analytic_line._prepare_activity_cost_data(self.ActivityOverheadCostRule)
if hasattr(analytic_line, "project_id"):
vals["project_id"] = False
if hasattr(analytic_line, "task_id"):
vals["task_id"] = False
analytic_line._prepare_activity_cost_data(self.ActivityOverheadCostRule)
self.assertFalse(hasattr(analytic_line, "project_id"))
self.assertFalse(hasattr(analytic_line, "task_id"))

AnalyticItem = self.env["account.analytic.line"].create(
{
"name": "{} / {}".format(
Expand All @@ -71,7 +70,7 @@ def test_analytic_item_create(self):
"parent_id": analytic_line.id,
"account_id": self.analytic_x.id,
"activity_cost_id": self.ActivityOverheadCostRule.id,
"product_id": self.ActivityOverheadCostRule.product_id.id,
"product_id": self.product_id.id,
"product_uom_id": self.ActivityOverheadCostRule.product_id.uom_id.id,
"unit_amount": 0.0,
"amount": 0.0,
Expand All @@ -84,12 +83,6 @@ def test_analytic_item_create(self):
)
self.ActivityOverheadCostRule.write({"factor": 0.70})
AnalyticItem._compute_unit_abcost()
AnalyticItem._populate_abcost_lines()
AnalyticItem._compute_amount_abcost()
self.assertEqual(AnalyticItem.activity_cost_id, self.ActivityOverheadCostRule)
self.assertEqual(
AnalyticItem.product_id, self.ActivityOverheadCostRule.product_id
)
cost_vals = AnalyticItem.with_context(
product_id=False, task_id=False
)._prepare_activity_cost_data(self.ActivityOverheadCostRule)
AnalyticItem.copy(cost_vals)
self.assertEqual(AnalyticItem.product_id, self.product_id)

0 comments on commit d4bba66

Please sign in to comment.