2 In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear to which the entries will move
4 !record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
5 code: !eval "'FY%s'% (datetime.now().year+1)"
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 %s' %(datetime.now().year-1)"
11 I generate periods for the new fiscalyear
13 !python {model: account.fiscalyear}: |
14 self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")])
16 I create a new account invoice in the created fiscalyear
18 !record {model: account.invoice, id: account_invoice_current1}:
19 partner_id: base.res_partner_2
20 date_invoice: !eval "'%s-01-02' %(datetime.now().year-1)"
22 - partner_id: base.res_partner_2
27 I validate the invoice
29 !python {model: account.invoice}: |
31 wf_service = netsvc.LocalService("workflow")
32 wf_service.trg_validate(uid, 'account.invoice', ref('account.account_invoice_current1'), 'invoice_open', cr)
34 I made modification in journal so it can move entries
36 !record {model: account.journal, id: account.close_journal}:
40 analytic_journal_id: sit
41 default_debit_account_id: cash
42 default_credit_account_id: cash
43 company_id: base.main_company
46 I call the Generate Fiscalyear Opening Entries wizard
48 !record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
49 fy2_id: account.data_fiscalyear
50 fy_id: account_fiscalyear_fiscalyear0
51 journal_id: account.close_journal
52 period_id: account.period_1
53 report_name: End of Fiscal Year Entry
55 I clicked on create Button
57 !python {model: account.fiscalyear.close}: |
58 self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
59 "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
60 "tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
62 I close the previous fiscalyear
64 !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
65 fy_id: account_fiscalyear_fiscalyear0
67 I clicked on Close States Button to close fiscalyear
69 !python {model: account.fiscalyear.close.state}: |
70 self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
71 "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
72 "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
74 I check that the fiscalyear state is now "Done"
76 !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
79 I check that the past accounts are taken into account in partner credit
81 !assert {model: res.partner, id: base.res_partner_2, string: Total Receivable does not takes unreconciled moves of previous years}: