Skip to content

Commit

Permalink
[IMP] repair_purchase_return: Some test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
PauBForgeFlow committed Sep 21, 2023
1 parent 18447ff commit b94d35e
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions repair_purchase_return/tests/test_repair_purchase_return_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ def setUpClass(cls):
"list_price": 20,
}
)

cls.service = cls.env["product.product"].create(
{
"name": "Test Fee",
"standard_price": 30,
"list_price": 50,
}
)

cls.partner = cls.env.ref("base.res_partner_address_1")
cls.location = cls.env["stock.location"].create(
{
Expand All @@ -28,7 +37,7 @@ def setUpClass(cls):
"partner_invoice_id": cls.partner.id,
"product_uom": cls.product.uom_id.id,
"location_id": cls.location.id,
"invoice_method": "after_repair",
"invoice_method": "none",
}
)
domain_location = [("usage", "=", "production")]
Expand All @@ -43,11 +52,23 @@ def setUpClass(cls):
"location_id": cls.repair.location_id.id,
"location_dest_id": stock_location_id.id,
"product_uom_qty": 1,
"price_unit": 20,
"price_unit": cls.product.list_price,
}
)

cls.fees_lines = cls.env["repair.fee"].create(
{
"repair_id": cls.repair.id,
"product_id": cls.service.id,
"product_uom": cls.service.uom_id.id,
"name": "Test Fee",
"product_uom_qty": 1,
"price_unit": cls.service.list_price,
}
)

cls.repair["operations"] = cls.repair_line
cls.repair["fees_lines"] = cls.fees_lines

cls.journal = cls.env["account.journal"].create(
{
Expand All @@ -65,6 +86,11 @@ def setUpClass(cls):
}
)

def test_purchase_return_base(self):
self.pro = self.repair._create_purchase_return(self.vendor)
self.pro.action_view_repair_orders()
def test_repair_purchase_return(self):
pro = self.repair._create_purchase_return(self.vendor)
pro.action_view_repair_orders()

# Check that purchase return order is caching the two lines and using the product cost
self.assertEqual(pro.order_line[0].price_unit, 10)

self.assertEqual(pro.order_line[1].price_unit, 30)

0 comments on commit b94d35e

Please sign in to comment.