Skip to content

Commit

Permalink
[IMP] purchase_product_pack: UT get_seller_cost
Browse files Browse the repository at this point in the history
  • Loading branch information
antonyht27 committed May 30, 2024
1 parent b5a190c commit eab0f09
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions purchase_product_pack/tests/test_purchase_product_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,32 @@ def test_order_line_totalized_with_seller(self):
self.assertAlmostEqual(
(self.purchase_order.order_line - line).mapped("price_subtotal"), [0, 0, 0]
)

def get_seller_cost(self):
product_tp = self.env.ref("product_pack.product_pack_cpu_detailed_totalized")
product_product_16 = self.env.ref("product.product_product_16")
product_product_16.write(

Check warning on line 297 in purchase_product_pack/tests/test_purchase_product_pack.py

View check run for this annotation

Codecov / codecov/patch

purchase_product_pack/tests/test_purchase_product_pack.py#L295-L297

Added lines #L295 - L297 were not covered by tests
{
"seller_ids": [
(
0,
0,
{
"partner_id": self.env.ref("base.res_partner_12").id,
"min_qty": 1.0,
"price": 20.0,
},
)
]
}
)
line = self.env["purchase.order.line"].create(

Check warning on line 312 in purchase_product_pack/tests/test_purchase_product_pack.py

View check run for this annotation

Codecov / codecov/patch

purchase_product_pack/tests/test_purchase_product_pack.py#L312

Added line #L312 was not covered by tests
{
"order_id": self.purchase_order.id,
"name": product_tp.name,
"product_id": product_tp.id,
"product_qty": 10,
}
)
cost = line.get_seller_cost(False)
self.assertEqual(cost, 205.0) # standard_price (20.5) * quantity (10)

Check warning on line 321 in purchase_product_pack/tests/test_purchase_product_pack.py

View check run for this annotation

Codecov / codecov/patch

purchase_product_pack/tests/test_purchase_product_pack.py#L320-L321

Added lines #L320 - L321 were not covered by tests

0 comments on commit eab0f09

Please sign in to comment.