[IMP] sale: discount should not be recomputed on confirmation
Add test to cover a problem fixed in `sale_subscription` opw-3740645 closes odoo/odoo#157699 Related: odoo/enterprise#58673 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
from odoo import fields
|
||||
from odoo.fields import Command
|
||||
from odoo.exceptions import AccessError, UserError, ValidationError
|
||||
from odoo.tests import tagged, Form
|
||||
from odoo.tools import float_compare
|
||||
from odoo.fields import Command
|
||||
from odoo.tests import Form, tagged
|
||||
|
||||
from odoo.addons.sale.tests.common import SaleCommon
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.addons.sale.tests.common import SaleCommon
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
@@ -466,6 +467,16 @@ class TestSaleOrder(SaleCommon):
|
||||
sale_order.action_confirm()
|
||||
self.assertTrue(sale_order.analytic_account_id, "An analytic account should be generated")
|
||||
|
||||
def test_so_discount_is_not_reset(self):
|
||||
""" Discounts should not be recomputed on order confirmation """
|
||||
with patch(
|
||||
'odoo.addons.sale.models.sale_order_line.SaleOrderLine'
|
||||
'._compute_discount'
|
||||
) as patched:
|
||||
self.sale_order.action_confirm()
|
||||
self.sale_order.order_line.flush_recordset(['discount'])
|
||||
patched.assert_not_called()
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSaleOrderInvoicing(AccountTestInvoicingCommon, SaleCommon):
|
||||
|
||||
Reference in New Issue
Block a user