mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 11:25:09 +00:00
fix(test): Use the system-configured float precision
(cherry picked from commit 1296829b9c)
This commit is contained in:
@@ -598,9 +598,7 @@ class Asset(AccountsController):
|
|||||||
def set_depreciation_rate(self):
|
def set_depreciation_rate(self):
|
||||||
for d in self.get("finance_books"):
|
for d in self.get("finance_books"):
|
||||||
self.validate_asset_finance_books(d)
|
self.validate_asset_finance_books(d)
|
||||||
d.rate_of_depreciation = flt(
|
d.rate_of_depreciation = self.get_depreciation_rate(d, on_validate=True)
|
||||||
self.get_depreciation_rate(d, on_validate=True), d.precision("rate_of_depreciation")
|
|
||||||
)
|
|
||||||
|
|
||||||
def validate_asset_finance_books(self, row):
|
def validate_asset_finance_books(self, row):
|
||||||
row.expected_value_after_useful_life = flt(
|
row.expected_value_after_useful_life = flt(
|
||||||
@@ -990,7 +988,7 @@ class Asset(AccountsController):
|
|||||||
if isinstance(args, str):
|
if isinstance(args, str):
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
rate_field_precision = frappe.get_precision(args.doctype, "rate_of_depreciation") or 2
|
rate_field_precision = frappe.get_single_value("System Settings", "float_precision") or 2
|
||||||
|
|
||||||
if args.get("depreciation_method") == "Double Declining Balance":
|
if args.get("depreciation_method") == "Double Declining Balance":
|
||||||
return self.get_double_declining_balance_rate(args, rate_field_precision)
|
return self.get_double_declining_balance_rate(args, rate_field_precision)
|
||||||
|
|||||||
@@ -37,12 +37,14 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
|
|||||||
make_purchase_invoice as make_invoice,
|
make_purchase_invoice as make_invoice,
|
||||||
)
|
)
|
||||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||||
|
from erpnext.tests.utils import ERPNextTestSuite
|
||||||
|
|
||||||
|
|
||||||
class AssetSetup(IntegrationTestCase):
|
class AssetSetup(ERPNextTestSuite):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
frappe.db.set_single_value("System Settings", "float_precision", 3)
|
||||||
set_depreciation_settings_in_company()
|
set_depreciation_settings_in_company()
|
||||||
create_asset_data()
|
create_asset_data()
|
||||||
enable_cwip_accounting("Computers")
|
enable_cwip_accounting("Computers")
|
||||||
|
|||||||
Reference in New Issue
Block a user