
-
  In order to test close period wizard I first create a dummy fiscal year in the past to avoid conflicts related to closed periods
-
  !record {model: account.fiscalyear, id: data_fiscalyear_minus1}:
    company_id: base.main_company
    date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
    date_stop: !eval "'%s-12-31' %(datetime.now().year-1)"
    name: !eval "'Fiscal Year X %s' %(datetime.now().year-1)"
    code: !eval "'FY%s' %(datetime.now().year-1)"

-
  I create a period then close it and checked it's state
-
  !record {model: account.period, id: account_period_jan0}:
    company_id: base.main_company
    date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
    date_stop: !eval "'%s-01-31' %(datetime.now().year-1)"
    fiscalyear_id: data_fiscalyear_minus1
    name: !eval "'Jan-%s' %(datetime.now().year-1)"
    special: 1

-
  I check that the period state is "Draft"
-
  !assert {model: account.period, id: account_period_jan0, string: Period is in Draft state}:
    - state == 'draft'
-
  I use "Close a Period" wizard to close period
-
  !record {model: account.period.close, id: account_period_close_0}:
    sure: 1
-
  I clicked on Close Period Button to close Period

-
  !python {model: account.period.close}: |
    self.data_save(cr, uid, [ref("account_period_close_0")], {"lang": 'en_US', "active_model":
      "account.period", "active_ids": [ref("account_period_jan0")], "tz": False, "active_id":
      ref("account_period_jan0"), })
-
  I check that the period state is "Done"
-
  !assert {model: account.period, id: account_period_jan0, string: Period is in Done state}:
    - state == 'done'
