Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import test_discount_display_amount

View File

@@ -0,0 +1,42 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
class TestDiscountDisplay(TransactionCase):
def test_sale_discount_value(self):
product1 = self.env["product.product"].create(
{"name": "Product TEST", "type": "consu"}
)
customer = self.env["res.partner"].create(
{"name": "Customer TEST", "is_company": False, "email": "test@tes.ttest"}
)
so = self.env["sale.order"].create({"partner_id": customer.id})
self.env["sale.order.line"].create(
{"order_id": so.id, "product_id": product1.id, "price_unit": 30.75}
)
first_line = so.order_line[0]
first_line.discount = 10
self.assertAlmostEqual(first_line.price_subtotal_no_discount, 30.75)
self.assertAlmostEqual(first_line.price_total_no_discount, 35.36)
self.assertAlmostEqual(first_line.discount_total, 3.53)
self.assertAlmostEqual(so.price_subtotal_no_discount, 30.75)
self.assertAlmostEqual(so.price_total_no_discount, 35.36)
self.assertAlmostEqual(so.discount_total, 3.53)
self.assertAlmostEqual(so.discount_subtotal, 3.07)
def test_sale_without_discount_value(self):
product2 = self.env["product.product"].create(
{"name": "Product TEST", "type": "consu"}
)
customer2 = self.env["res.partner"].create(
{"name": "Customer TEST", "is_company": False, "email": "test@tes.ttest"}
)
so2 = self.env["sale.order"].create({"partner_id": customer2.id})
self.env["sale.order.line"].create(
{"order_id": so2.id, "product_id": product2.id, "price_unit": 30.75}
)
first_line = so2.order_line[0]
self.assertEqual(first_line.price_total_no_discount, first_line.price_total)