[IMP] karma retag checks
[odoo/odoo.git] / addons / account / test / account_use_model.yml
1 -
2   In order to test account use models wizard in OpenERP I create an account model record
3 -
4   !record {model: account.model, id: account_model_mymodelonyears0}:
5     journal_id: account.expenses_journal
6     lines_id:
7       - account_id: account.a_recv
8         credit: 0.0
9         debit: 100.0
10         name: model_line_db
11         sequence: 0.0
12         quantity: 0.0
13         partner_id: base.res_partner_3
14       - account_id: account.a_pay
15         credit: 100.0
16         debit: 0.0
17         name: model_line_cr
18         sequence: 0.0
19         quantity: 0.0
20         partner_id: base.res_partner_3
21     name: My Test Model
22 -
23   I create an account use model record
24 -
25   !record {model: account.use.model, id: account_use_model_0}:
26     {}
27 -
28   I create entries.
29 -
30   !python {model: account.use.model}: |
31     self.create_entries(cr, uid, [ref("account_use_model_0")], {"lang": 'en_US', "active_model":
32       "account.model", "active_ids": [ref("account_model_mymodelonyears0")], "tz":
33       False, "active_id": ref("account_model_mymodelonyears0"), })
34     move_obj = self.pool.get('account.move')
35     ids = move_obj.search(cr, uid, [('ref', '=', 'My Test Model')])
36     assert len(ids), "Error:moves not created for model 'My Test Model'"
37 -
38   Then I click on the 'Post' button of Journal Entries
39 -
40   !python {model: account.move}: |
41     ids = self.search(cr, uid, [('ref', '=', 'My Test Model')])
42     self.button_validate(cr, uid, ids, {})
43     moves = self.browse(cr, uid, ids)[0]
44     assert(moves.state == 'posted'), 'Journal Entries are not in posted state'
45 -
46   Then I create Recurring Lines
47 -
48   !record {model: account.subscription, id: test_recurring_lines }:
49     name: Test Recurring Lines
50     model_id: account_model_mymodelonyears0
51     period_type: 'day'
52 -
53   Then I click on the 'Compute' button of Recurring lines
54 -
55   !python {model: account.subscription}: |
56     subscription_line_obj = self.pool.get('account.subscription.line')
57     self.compute(cr, uid, [ref('test_recurring_lines')], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
58       'active_ids': [ref('menu_action_subscription_form')], 'tz': False, 'active_id': ref('menu_action_subscription_form')})
59     subscription_lines = subscription_line_obj.search(cr, uid, [('subscription_id', '=', ref('test_recurring_lines'))])
60     assert subscription_lines, 'Subscription lines has not been created'
61 -
62   I provide date in 'Generate Entries' wizard
63 -
64   !record {model: account.subscription.generate, id: account_subscription_generate}:
65     date: !eval time.strftime('%Y-%m-%d')
66 -
67   Then I generate entries through wizard
68 -
69   !python {model: account.subscription.generate}: |
70     res = self.action_generate(cr, uid, [ref('account_subscription_generate')], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
71       'active_ids': [ref('menu_generate_subscription')], 'tz': False, 'active_id': ref('menu_generate_subscription')})
72     assert res, 'Move for subscription lines has not been created'
73