[IMP] karma retag checks
[odoo/odoo.git] / addons / account / test / account_fiscalyear_close.yml
1 -
2   In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear to which the entries will move
3 -
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)"
10 -
11   I generate periods for the new fiscalyear
12 -
13   !python {model: account.fiscalyear}: |
14     self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")])
15 -
16   I create a new account invoice in the created fiscalyear
17 -
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)"
21     invoice_line:
22       - partner_id: base.res_partner_2
23         quantity: 1.0
24         price_unit: 15.00
25         name: Bying stuff
26 -
27   I validate the invoice
28 -
29   !workflow {model: account.invoice, action: invoice_open, ref: account.account_invoice_current1}
30 -
31   I made modification in journal so it can move entries
32 -
33   !record {model: account.journal, id: account.close_journal}:
34     name: End of Year
35     code: NEW
36     type: situation
37     analytic_journal_id: analytic.sit
38     default_debit_account_id: cash
39     default_credit_account_id: cash
40     company_id: base.main_company
41     centralisation: 1
42 -
43   I call the Generate Fiscalyear Opening Entries wizard
44 -
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
51 -
52   I clicked on create Button
53 -
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"), })
58 -
59   I close the previous fiscalyear
60 -
61   !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
62     fy_id: account_fiscalyear_fiscalyear0
63 -
64   I clicked on Close States Button to close fiscalyear
65 -
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"), })
70 -
71   I check that the fiscalyear state is now "Done"
72 -
73   !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
74     - state == 'done'
75 -
76   I check that the past accounts are taken into account in partner credit
77 -
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"