mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[UPD] Update base_global_discount.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-backend-13.0/server-backend-13.0-base_global_discount Translate-URL: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_global_discount/
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
# Copyright 2019 Tecnativa - David Vidal
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
from odoo.tests import common
|
|
|
|
|
|
class TestGlobalDiscount(common.SavepointCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super().setUpClass()
|
|
cls.global_discount_obj = cls.env["global.discount"]
|
|
cls.global_discount_1 = cls.global_discount_obj.create(
|
|
{"name": "Test Discount 1", "discount_scope": "sale", "discount": 20}
|
|
)
|
|
cls.global_discount_2 = cls.global_discount_obj.create(
|
|
{"name": "Test Discount 2", "discount_scope": "sale", "discount": 30}
|
|
)
|
|
|
|
def test_01_global_discounts(self):
|
|
"""Chain two discounts of different types"""
|
|
discount_vals = self.global_discount_1._get_global_discount_vals(100.0)
|
|
self.assertAlmostEqual(discount_vals["base_discounted"], 80.0)
|
|
discount_vals = self.global_discount_2._get_global_discount_vals(
|
|
discount_vals["base_discounted"]
|
|
)
|
|
self.assertAlmostEqual(discount_vals["base_discounted"], 56.0)
|
|
|
|
def test_02_display_name(self):
|
|
"""Test that the name is computed fine"""
|
|
self.assertTrue("%)" in self.global_discount_1.display_name)
|