diff --git a/analytic_activity_based_cost/tests/test_analytic_line_cost.py b/analytic_activity_based_cost/tests/test_analytic_line_cost.py index 3c6d28e717..fc0f140253 100644 --- a/analytic_activity_based_cost/tests/test_analytic_line_cost.py +++ b/analytic_activity_based_cost/tests/test_analytic_line_cost.py @@ -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( @@ -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, @@ -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)