[MERGE] account_asset: clean yml tests
bzr revid: rco@openerp.com-20111220100842-3ny7trt6s5lgg1eb
This commit is contained in:
commit
2b6890f9b2
|
@ -34,8 +34,11 @@
|
|||
],
|
||||
"demo_xml" : [ 'account_asset_demo.xml'
|
||||
],
|
||||
'test': ['test/account_asset.yml',
|
||||
],
|
||||
'test': [
|
||||
'test/account_asset_demo.yml',
|
||||
'test/account_asset.yml',
|
||||
'test/account_asset_wizard.yml',
|
||||
],
|
||||
"update_xml" : [
|
||||
"security/account_asset_security.xml",
|
||||
"security/ir.model.access.csv",
|
||||
|
@ -45,7 +48,6 @@
|
|||
"account_asset_view.xml",
|
||||
"account_asset_invoice_view.xml",
|
||||
"report/account_asset_report_view.xml",
|
||||
|
||||
],
|
||||
"active": False,
|
||||
"installable": True,
|
||||
|
|
|
@ -1,55 +1,35 @@
|
|||
-
|
||||
In order to test Account Asset I create Asset and confirm it and check it's Depriciation lines
|
||||
-
|
||||
I Create an Asset Category
|
||||
-
|
||||
!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 Create an Account Asset
|
||||
-
|
||||
!record {model: account.asset.asset, id: account_asset_asset_Land0}:
|
||||
category_id: account_asset_category_landbuildings0
|
||||
code: land
|
||||
name: Land
|
||||
partner_id: base.res_partner_14
|
||||
purchase_value: 5000.0
|
||||
state: draft
|
||||
-
|
||||
I check Initially that Account Asset is in the "Draft" state
|
||||
-
|
||||
!assert {model: account.asset.asset, id: account_asset_asset_Land0}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I 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 check Asset is in running state after pressing Confirm button on asset
|
||||
I check Asset is now in Open state.
|
||||
-
|
||||
!assert {model: account.asset.asset, id: account_asset_asset_Land0}:
|
||||
!assert {model: account.asset.asset, id: account_asset_asset_vehicles0, severity: error, string: Asset should be in Open state}:
|
||||
- state == 'open'
|
||||
-
|
||||
I Compute Account Asset using Compute button and check the number of depreciation lines created
|
||||
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")])
|
||||
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_Land0")])[0]
|
||||
assert value.method_number == len(value.depreciation_line_ids)
|
||||
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 Create Account Move using create move button on depreciation lines
|
||||
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 Check that After creating all the moves of depreciation lines the state is in "Close" state
|
||||
I check the move line is created.
|
||||
-
|
||||
!assert {model: account.asset.asset, id: account_asset_asset_Land0}:
|
||||
!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 Check that After creating all the moves of depreciation lines the state "Close".
|
||||
-
|
||||
!assert {model: account.asset.asset, id: account_asset_asset_vehicles0}:
|
||||
- state == 'close'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
-
|
||||
!record {model: account.asset.category, id: account_asset_category_fixedassets0}:
|
||||
account_asset_id: account.xfa
|
||||
-
|
||||
!record {model: account.asset.asset, id: account_asset_asset_vehicles0}:
|
||||
category_id: account_asset_category_sale
|
||||
-
|
||||
!record {model: account.asset.asset, id: account_asset_asset_vehicles0}:
|
||||
method_number: 10
|
|
@ -0,0 +1,27 @@
|
|||
-
|
||||
I create a record to change the duration of asset for calculating depreciation.
|
||||
-
|
||||
!record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset_asset_office0')}"}:
|
||||
method_number: 10.0
|
||||
-
|
||||
I change the duration.
|
||||
-
|
||||
!python {model: asset.modify}: |
|
||||
context = {"active_id":ref('account_asset_asset_office0')}
|
||||
self.modify(cr, uid, [ref("asset_modify_number_0")], context=context)
|
||||
-
|
||||
I check the proper depreciation lines created.
|
||||
-
|
||||
!assert {model: account.asset.asset, id: account_asset.account_asset_asset_office0}:
|
||||
- method_number == len(depreciation_line_ids) -1
|
||||
-
|
||||
I create a period to compute a asset on period.
|
||||
-
|
||||
!record {model: asset.depreciation.confirmation.wizard, id: asset_compute_period_0}:
|
||||
{}
|
||||
-
|
||||
I compute a asset on period.
|
||||
-
|
||||
!python {model: asset.depreciation.confirmation.wizard}: |
|
||||
context = {"active_ids": [ref("menu_asset_depreciation_confirmation_wizard")], "active_id":ref('menu_asset_depreciation_confirmation_wizard')}
|
||||
self.asset_compute(cr, uid, [ref("asset_compute_period_0")], context=context)
|
Loading…
Reference in New Issue