feat(fusion_accounting_assets): MV for per-asset book value snapshot
Made-with: Cursor
This commit is contained in:
@@ -17,3 +17,4 @@ from . import test_asset_tools
|
||||
from . import test_assets_cron
|
||||
from . import test_engine_property
|
||||
from . import test_method_integration
|
||||
from . import test_asset_book_values_mv
|
||||
|
||||
29
fusion_accounting_assets/tests/test_asset_book_values_mv.py
Normal file
29
fusion_accounting_assets/tests/test_asset_book_values_mv.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Tests for the per-asset book value MV."""
|
||||
|
||||
from datetime import date
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestAssetBookValuesMV(TransactionCase):
|
||||
|
||||
def test_mv_exists_and_is_queryable(self):
|
||||
self.env['fusion.asset.book.values.mv']._refresh(concurrently=False)
|
||||
rows = self.env['fusion.asset.book.values.mv'].search([], limit=10)
|
||||
self.assertIsNotNone(rows)
|
||||
|
||||
def test_mv_includes_new_asset_after_refresh(self):
|
||||
asset = self.env['fusion.asset'].create({
|
||||
'name': 'MV Test', 'cost': 5000, 'salvage_value': 500,
|
||||
'acquisition_date': date(2026, 1, 1),
|
||||
'method': 'straight_line', 'useful_life_years': 5,
|
||||
})
|
||||
self.env.flush_all()
|
||||
self.env['fusion.asset.book.values.mv']._refresh(concurrently=False)
|
||||
mv_row = self.env['fusion.asset.book.values.mv'].search([
|
||||
('asset_id', '=', asset.id),
|
||||
], limit=1)
|
||||
self.assertTrue(mv_row)
|
||||
self.assertAlmostEqual(mv_row.book_value, 5000, places=2)
|
||||
Reference in New Issue
Block a user