test: correct some try/except test
[odoo/odoo.git] / addons / account / test / account_period_close.yml
1
2 -
3   In order to test close period wizard I first create a dummy fiscal year in the past to avoid conflicts related to closed periods
4 -
5   !record {model: account.fiscalyear, id: data_fiscalyear_minus1}:
6     company_id: base.main_company
7     date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
8     date_stop: !eval "'%s-12-31' %(datetime.now().year-1)"
9     name: !eval "'Fiscal Year X %s' %(datetime.now().year-1)"
10     code: !eval "'FY%s' %(datetime.now().year-1)"
11
12 -
13   I create a period then close it and checked it's state
14 -
15   !record {model: account.period, id: account_period_jan0}:
16     company_id: base.main_company
17     date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
18     date_stop: !eval "'%s-01-31' %(datetime.now().year-1)"
19     fiscalyear_id: data_fiscalyear_minus1
20     name: !eval "'Jan-%s' %(datetime.now().year-1)"
21     special: 1
22
23 -
24   I check that the period state is "Draft"
25 -
26   !assert {model: account.period, id: account_period_jan0, string: Period is in Draft state}:
27     - state == 'draft'
28 -
29   I use "Close a Period" wizard to close period
30 -
31   !record {model: account.period.close, id: account_period_close_0}:
32     sure: 1
33 -
34   I clicked on Close Period Button to close Period
35
36 -
37   !python {model: account.period.close}: |
38     self.data_save(cr, uid, [ref("account_period_close_0")], {"lang": 'en_US', "active_model":
39       "account.period", "active_ids": [ref("account_period_jan0")], "tz": False, "active_id":
40       ref("account_period_jan0"), })
41 -
42   I check that the period state is "Done"
43 -
44   !assert {model: account.period, id: account_period_jan0, string: Period is in Done state}:
45     - state == 'done'