Skip to content

Commit

Permalink
[17.0][IMP]purchase_product_pack: UT test_get_seller_cost_no_line
Browse files Browse the repository at this point in the history
  • Loading branch information
antonyht27 committed May 30, 2024
1 parent eab0f09 commit 5b6c260
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions purchase_product_pack/tests/test_purchase_product_pack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
Expand Down Expand Up @@ -291,31 +290,10 @@ def test_order_line_totalized_with_seller(self):
(self.purchase_order.order_line - line).mapped("price_subtotal"), [0, 0, 0]
)

def get_seller_cost(self):
def test_get_seller_cost_no_line(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(
{
"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(
{
"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)
# Consult the price of the product without a purchase order line
prices = product_tp.pack_cost_compute(False)
cost = prices[product_tp.id]
self.assertEqual(cost, 2596.0)
# standard_price (20.5) * quantity (126.63414634146341463414634146341)

0 comments on commit 5b6c260

Please sign in to comment.