[fix] some problems in o2m
[odoo/odoo.git] / addons / account_asset / test / account_asset.yml
index 00734be..e9f7573 100644 (file)
@@ -1,57 +1,35 @@
 -
-  In order to test Account Asset feature first I will create Asset Category
-- 
-  I will Create an Asset Category Record
-- 
-  !record {model: account.asset.category, id: account_asset_category_landbuildings0}:
-    account_asset_id: account.xfa
-    account_depreciation_id: account.xfa
-    account_expense_depreciation_id: account.a_expense
-    journal_id: account.expenses_journal
-    name: Land & Buildings
-- 
-  I will Create an Account Asset Record
-- 
-  !record {model: account.asset.asset, id: account_asset_asset_Land0}:
-    category_id: account_asset_category_landbuildings0
-    code: a
-    name: Land
-    partner_id: base.res_partner_14
-    period_id: account.period_6
-    purchase_value: 5000.0
-    salvage_value: 2000.0
-    state: draft
--
-  I will check initially that Account Asset is in the "Draft" state
--
-  !assert {model: account.asset.asset, id: account_asset_asset_Land0}:
-    - state == 'draft'
--
-  I will Confirm Account Asset using Confirm Asset button
+  In order to test the process of Account Asset, I perform a action to confirm Account Asset.
 -
   !python {model: account.asset.asset}: |
-    self.validate(cr, uid, [ref("account_asset_asset_Land0")])
+    self.validate(cr, uid, [ref("account_asset_asset_vehicles0")])
 -
-  I will compute Account Asset using Compute button and check the number of depreciation lines created are proper
+  I check Asset is now in Open state.
+-
+  !assert {model: account.asset.asset, id: account_asset_asset_vehicles0, severity: error, string: Asset should be in Open state}:
+    - state == 'open'
+-
+  I compute depreciation lines for asset of CEO's Car .
 -
   !python {model: account.asset.asset}: |
-    self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_Land0")])
-    value = self.browse(cr, uid, [ref("account_asset_asset_Land0")])[0]
-    assert value.method_delay == len(value.depreciation_line_ids)
+    self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_vehicles0")])
+    # pressing computation button can be remove if creation of depreciation lines while asset is created
+    value = self.browse(cr, uid, [ref("account_asset_asset_vehicles0")])[0]
+    assert value.method_number == len(value.depreciation_line_ids), 'Depreciation lines not created correctly'
 -
-  I will Create Account Asset Move using using create move method
+  I create account move for all depreciation lines.
 -
   !python {model: account.asset.depreciation.line}: |
-    ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_Land0'))])
+    ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_vehicles0'))])
     self.create_move(cr, uid, ids)
 -
-  I will check that After creating all the moves of the asset the state is in "Close" state
+  I check the move line is created.
 -
-  !assert {model: account.asset.asset, id: account_asset_asset_Land0}:
-    - state == 'close'
+  !python {model: account.asset.asset}: |
+    asset = self.browse(cr, uid, [ref("account_asset_asset_vehicles0")])[0]
+    assert len(asset.depreciation_line_ids) == len(asset.account_move_line_ids), 'Move lines not created correctly'
 -
-  I will check when the state of Account asset is close the residual value becomes 0
+  I Check that After creating all the moves of depreciation lines the state "Close".
 -
-  !assert {model: account.asset.asset, id: account_asset_asset_Land0}:
-    - value_residual == 0.0
-
+  !assert {model: account.asset.asset, id: account_asset_asset_vehicles0}:
+    - state == 'close'