Skip to content

Commit 463d217

Browse files
committed
[REV] sale: avoid prices recomputation
This reverts commit 789186a. The fix is not necessary in 17+ since the new onchange only sends the necessary information and not the whole x2m record data. closes odoo#155550 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
1 parent 974903c commit 463d217

File tree

2 files changed

+1
-45
lines changed

2 files changed

+1
-45
lines changed

addons/sale/models/sale_order_line.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,12 +1001,6 @@ def write(self, values):
10011001
precision_digits=precision
10021002
) != 0
10031003
)._update_line_quantity(values)
1004-
if len(self) == 1 and float_compare(
1005-
self.product_uom_qty,
1006-
values['product_uom_qty'],
1007-
precision_digits=precision
1008-
) == 0:
1009-
values.pop('product_uom_qty')
10101004

10111005
# Prevent writing on a locked SO.
10121006
protected_fields = self._get_protected_fields()

addons/sale_stock/tests/test_sale_stock.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2-
32
from datetime import datetime, timedelta
43

5-
from freezegun import freeze_time
6-
74
from odoo import Command
85
from odoo.exceptions import UserError
96
from odoo.tests import Form, tagged
107

11-
from odoo.addons.sale.tests.common import SaleCommon, TestSaleCommon
8+
from odoo.addons.sale.tests.common import TestSaleCommon
129
from odoo.addons.stock_account.tests.test_anglo_saxon_valuation_reconciliation_common import (
1310
ValuationReconciliationTestCommon,
1411
)
@@ -1755,38 +1752,3 @@ def test_delivery_on_negative_delivered_qty(self):
17551752
picking.button_validate()
17561753
self.assertEqual(sale_order.order_line.qty_delivered, -1.0)
17571754
self.assertEqual(sale_order.order_line.qty_to_invoice, -1.0)
1758-
1759-
1760-
class TestSaleOrder(SaleCommon):
1761-
1762-
@freeze_time('2017-01-07')
1763-
def test_order_onchange(self):
1764-
order = self.empty_order
1765-
storable_product = self.env['product.product'].create({
1766-
'name': 'Test Storable',
1767-
'type': 'product',
1768-
'list_price': 25.0,
1769-
})
1770-
order.order_line = [
1771-
Command.create({
1772-
'product_id': storable_product.id,
1773-
'product_uom_qty': 15.12,
1774-
'price_unit': 50.0,
1775-
}),
1776-
]
1777-
# retrieve the onchange spec for calling 'onchange'
1778-
order_form = Form(order)
1779-
# spec = order_form._view['onchange']
1780-
# onchange_vals = order_form._onchange_values()
1781-
# res = order.onchange(
1782-
# dict(
1783-
# onchange_vals,
1784-
# commitment_date='2017-01-12',
1785-
# ),
1786-
# 'commitment_date',
1787-
# spec
1788-
# )
1789-
# self.assertEqual(res['value']['order_line'][1][2]['product_uom_qty'], 15.12)
1790-
order_form.commitment_date = '2017-01-12'
1791-
order_form.save()
1792-
self.assertEqual(order.order_line.price_unit, 50.0)

0 commit comments

Comments
 (0)