~camptocamp/account-financial-tools/account-constraint-adding_by_JGE

« back to all changes in this revision

Viewing changes to account_move_template/test/generate_move.yml

  • Committer: Guewen Baconnier
  • Author(s): Lorenzo Battistini
  • Date: 2013-01-04 13:55:50 UTC
  • mfrom: (93.1.3 adding_account_move_template)
  • Revision ID: guewen.baconnier@camptocamp.com-20130104135550-vcvr3fyktd8216nx
[ADD] account_move_template moved from https://code.launchpad.net/~domsense/domsense-agilebg-addons/6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  I first create a move template for received bank payment. Two lines, bank and credit
 
3
-
 
4
  !record {model: account.move.template, id: move_template_1}:
 
5
    company_id: base.main_company
 
6
    name: "First template"
 
7
    template_line_ids:
 
8
      - name: "Bank"
 
9
        sequence: 1
 
10
        journal_id: account.bank_journal
 
11
        account_id: account.bnk
 
12
        type: 'input'
 
13
        move_line_type: 'dr'
 
14
      - name: "Credit"
 
15
        sequence: 2
 
16
        journal_id: account.bank_journal
 
17
        account_id: account.a_recv
 
18
        type: 'computed'
 
19
        move_line_type: 'cr'
 
20
        python_code: 'L(1)'
 
21
 
 
22
-
 
23
  I use "Select Move Template" wizard to generate move
 
24
-
 
25
  !record {model: wizard.select.move.template, id: wizard_select_move_template_1}:
 
26
    template_id: move_template_1
 
27
 
 
28
-
 
29
  I click on Next Button
 
30
-
 
31
  !python {model: wizard.select.move.template}: |
 
32
    self.load_lines(cr, uid, [ref("wizard_select_move_template_1")])
 
33
 
 
34
-
 
35
  I verify that wizard lines are created and write the amount line
 
36
-
 
37
  !python {model: wizard.select.move.template}: |
 
38
    wizard = self.browse(cr, uid, ref('wizard_select_move_template_1'))
 
39
    assert(len(wizard.line_ids) == 1), ('Wrong number of wizard lines')
 
40
    wizard.line_ids[0].write({'amount': 100.0})
 
41
 
 
42
-
 
43
  I click on Load Button and check the created move
 
44
-
 
45
  !python {model: wizard.select.move.template}: |
 
46
    action = self.load_template(cr, uid, [ref("wizard_select_move_template_1")])
 
47
    move_obj = self.pool.get('account.move')
 
48
    domain_list = eval(action['domain'])
 
49
    for move_id in domain_list[0][2]:
 
50
        move = move_obj.browse(cr, uid, move_id)
 
51
        for line in move.line_id:
 
52
            assert(line.state == 'valid'), ('Move lines must be valid')