[IMP] Improved the YML Test Case
[odoo/odoo.git] / addons / account_asset / test / account_asset.yml
1 -
2   In order to test Account Asset feature first I create Asset Category
3
4   I Create an Asset Category Record
5
6   !record {model: account.asset.category, id: account_asset_category_landbuildings0}:
7     account_asset_id: account.xfa
8     account_depreciation_id: account.xfa
9     account_expense_depreciation_id: account.a_expense
10     journal_id: account.expenses_journal
11     name: Land & Buildings
12
13   I Create an Account Asset Record
14
15   !record {model: account.asset.asset, id: account_asset_asset_Land0}:
16     category_id: account_asset_category_landbuildings0
17     code: a
18     name: Land
19     partner_id: base.res_partner_14
20     period_id: account.period_6
21     purchase_value: 5000.0
22     salvage_value: 2000.0
23     state: draft
24 -
25   I check Initially that Account Asset is in the "Draft" state
26 -
27   !assert {model: account.asset.asset, id: account_asset_asset_Land0}:
28     - state == 'draft'
29 -
30   I Confirm Account Asset using Confirm Asset button
31 -
32   !python {model: account.asset.asset}: |
33     self.validate(cr, uid, [ref("account_asset_asset_Land0")])
34 -
35   I Compute Account Asset using Compute button and check the number of depreciation lines created are proper
36 -
37   !python {model: account.asset.asset}: |
38     self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_Land0")])
39     value = self.browse(cr, uid, [ref("account_asset_asset_Land0")])[0]
40     assert value.method_delay == len(value.depreciation_line_ids)
41 -
42   I Create Account Asset Move using using create move method
43 -
44   !python {model: account.asset.depreciation.line}: |
45     ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_Land0'))])
46     self.create_move(cr, uid, ids)
47 -
48   I Check that After creating all the moves of the asset the state is in "Close" state
49 -
50   !assert {model: account.asset.asset, id: account_asset_asset_Land0}:
51     - state == 'close'