~unifield-team/unifield-wm/uftp-319

« back to all changes in this revision

Viewing changes to register_accounting/test/account_cash_statement.yml

  • Committer: jf
  • Date: 2011-03-23 13:23:55 UTC
  • Revision ID: jf@tempo4-20110323132355-agyf1soy7m5ewatr
Initial Import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  In order to test Cash Register I create a Cash Register with a journal in EURO, then I confirm it and check it's move created
 
3
-
 
4
  I create a Cash Register with Opening and Closing balance 1500.
 
5
-
 
6
 !record {model: account.bank.statement, id: account_bank_statement_1}:
 
7
    date: !eval time.strftime('%Y-%m-%d')
 
8
    journal_id: account.cash_journal
 
9
    name: 
 
10
    period_id: account.period_10
 
11
    user_id: base.user_root
 
12
    starting_details_ids:
 
13
      -  pieces: 100.0
 
14
         number: 10
 
15
         subtotal: 1000.0
 
16
      -  pieces: 100.0
 
17
         number: 5
 
18
         subtotal: 500.0
 
19
    balance_start: 1500.0
 
20
    balance_end: 1500.0
 
21
-
 
22
  I check that Initially Cash Register is in the "Draft" state
 
23
-
 
24
  !assert {model: account.bank.statement, id: account_bank_statement_1}:
 
25
    - state == 'draft'
 
26
-
 
27
  I clicked on Open CashBox button to open the cashbox
 
28
-
 
29
 !python {model: account.bank.statement}: |
 
30
    self.button_open_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
 
31
        "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
 
32
-
 
33
  I check that now Cash register is in the "Open" state
 
34
-
 
35
  !assert {model: account.bank.statement, id: account_bank_statement_1}:
 
36
    - state == 'open'
 
37
-
 
38
  I enter values in Closing balance before close the cashbox
 
39
-
 
40
  !record {model: account.bank.statement, id: account_bank_statement_1}:
 
41
    line_ids:
 
42
      - account_id: account.a_recv
 
43
        amount: 500.0
 
44
        date: !eval time.strftime('%Y-%m-%d')
 
45
        name: test1
 
46
        partner_id: base.res_partner_4
 
47
        sequence: 0.0
 
48
        type: general
 
49
      - account_id: account.a_recv
 
50
        amount: 380.0
 
51
        date: !eval time.strftime('%Y-%m-%d')
 
52
        name: test2
 
53
        partner_id: base.res_partner_3
 
54
        sequence: 1.0
 
55
        type: general
 
56
      - account_id: account.a_recv
 
57
        amount: 320.0
 
58
        date: !eval time.strftime('%Y-%m-%d')
 
59
        name: test3
 
60
        partner_id: base.res_partner_4
 
61
        sequence: 2.0
 
62
        type: general
 
63
    balance_end: 300.0
 
64
    ending_details_ids:
 
65
      -  pieces: 50.0
 
66
         number: 1
 
67
         subtotal: 50.0
 
68
      -  pieces: 100.0
 
69
         number: 2
 
70
         subtotal: 200.0
 
71
    balance_end_cash: 250.0
 
72
-
 
73
  I clicked on each line to hard post them
 
74
-
 
75
    !python {model: account.bank.statement.line}: |
 
76
        absl_obj = self.pool.get('account.bank.statement.line')
 
77
        absl_ids = absl_obj.search(cr, uid, [('statement_id', '=', ref("account_bank_statement_1"))])
 
78
        for id in absl_ids:
 
79
            absl_obj.button_hard_posting(cr, uid, [id])
 
80
-
 
81
  I clicked on Close CashBox button to close the cashbox
 
82
-
 
83
 !python {model: account.bank.statement}: |
 
84
      self.button_confirm_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
 
85
        "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
 
86
-
 
87
  I click on "Are you sure ?" in the wizard to confirm cashbox closing
 
88
-
 
89
  !record {model: wizard.closing.cashbox, id: wizard_closing_cashbox_1}:
 
90
    be_sure: 1
 
91
-
 
92
  I click on the 'Confirm' button to close the cashbox
 
93
-
 
94
  !python {model: wizard.closing.cashbox}: |
 
95
      self.button_close_cashbox(cr, uid, [ref("wizard_closing_cashbox_1")], { "active_ids": [ref("account_bank_statement_1")], \
 
96
        "active_id": ref("account_bank_statement_1"), })
 
97
-
 
98
  I check that bank statement state is now "Partial Close"
 
99
-
 
100
  !assert {model: account.bank.statement, id: account_bank_statement_1}:
 
101
    - state == 'partial_close'
 
102
-
 
103
  I check that move lines created for bank statement and move state is Posted
 
104
-
 
105
  !python {model: account.bank.statement}: |
 
106
    move_line_obj = self.pool.get('account.move.line')
 
107
    bank_data = self.browse(cr, uid, ref("account_bank_statement_1"))
 
108
    assert bank_data.move_line_ids, "Move lines not created for bank statement"
 
109
    for line in bank_data.move_line_ids:
 
110
      assert line.move_id.state == 'posted', "Move state is not posted"
 
111
-
 
112
  I launch the "Cash Discrepancy Case" wizard and do a write-off
 
113
-
 
114
  !record {model: cashbox.write.off, id: cashbox_write_off_1}: 
 
115
    choice: writeoff
 
116
    account_id: account.a_recv
 
117
-
 
118
  I check that the amount is 50.0
 
119
-
 
120
  !python {model: cashbox.write.off}: |
 
121
    result = self.default_get(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref('account_bank_statement_1')})
 
122
    result['amount'] == 50.0
 
123
-
 
124
  I click on the 'Ok' button to do the write-off
 
125
-
 
126
  !python {model: cashbox.write.off, id: cashbox_write_off_1}: |
 
127
    self.action_confirm_choice(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref("account_bank_statement_1")})