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 !workflow {model: account.invoice, action: invoice_open, ref: account.account_invoice_current1}
31 I made modification in journal so it can move entries
33 !record {model: account.journal, id: account.close_journal}:
37 analytic_journal_id: analytic.sit
38 default_debit_account_id: cash
39 default_credit_account_id: cash
40 company_id: base.main_company
43 I call the Generate Fiscalyear Opening Entries wizard
45 !record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
46 fy2_id: account.data_fiscalyear
47 fy_id: account_fiscalyear_fiscalyear0
48 journal_id: account.close_journal
49 period_id: account.period_1
50 report_name: End of Fiscal Year Entry
52 I clicked on create Button
54 !python {model: account.fiscalyear.close}: |
55 self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
56 "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
57 "tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
59 I close the previous fiscalyear
61 !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
62 fy_id: account_fiscalyear_fiscalyear0
64 I clicked on Close States Button to close fiscalyear
66 !python {model: account.fiscalyear.close.state}: |
67 self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
68 "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
69 "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
71 I check that the fiscalyear state is now "Done"
73 !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
76 I check that the past accounts are taken into account in partner credit
78 !python {model: res.partner}: |
79 from openerp.tools import float_compare
80 credit = self.browse(cr, uid, ref('base.res_partner_2')).credit
81 assert float_compare(credit, 1040.0, precision_digits=2) == 0, "Total Receivable does not takes unreconciled moves of previous years"