[MERGE] remove res.partner.address by chs
[odoo/odoo.git] / addons / l10n_ch / test / l10n_ch_v11_part.yml
1 -
2   In order to test the V11 import,
3   I will create an invoice with a specified reference that I will partialy reconcile with a 1st V11
4   And then I will complete the reconcile with a second V11
5 -  
6   I create an invoice ref 2000999 of EUR 250.00
7 -
8   !record {model: account.invoice, id: v11_part_test_invoice, view: False}:
9     name: V11 YAML invoice
10     number: 2000999
11     company_id: base.main_company
12     journal_id: account.bank_journal
13     currency_id: base.EUR
14     account_id: account.a_recv
15     type : out_invoice
16     partner_id: base.res_partner_2
17     reference_type: bvr
18     reference: 20009997
19     date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
20     period_id: account.period_1
21     #invoice_line: 
22     partner_bank_id: main_partner_bank
23     check_total : 250.00
24     
25 -
26   I create an invoice line
27 -
28   !record {model: account.invoice.line, id: v11_part_test_invoice_line, view: False}:
29     account_id: account.a_expense
30     name: '[PCSC234] PC Assemble SC234'
31     price_unit: 250.00
32     quantity: 1.0
33     product_id: product.product_product_3
34     uos_id: product.product_uom_unit
35     invoice_id: v11_part_test_invoice
36
37 -
38   I Validate invoice by clicking on Validate button
39 -
40   !workflow {model: account.invoice, action: invoice_open, ref: v11_part_test_invoice}  
41
42 -
43   I specify the invoice number to fit with my v11
44 -
45   !python {model: account.invoice}: |
46     invoice = self.browse(cr, uid, ref('v11_part_test_invoice'))
47     invoice.write({'number': 2000999})
48     
49
50 -
51   I create a 1st bank statement
52   #########################################
53  #      Creating 1st bank statement      #
54 #########################################
55 -
56   !record {model: account.bank.statement, id: v11_part_test_bank_statement_1, view: False}:
57     #account_id:
58     #balance_end:
59     #balance_end_cash:
60     #balance_end_real:
61     #balance_start:
62     #closing_date:
63     #company_id:
64     #currency:
65     date: !eval "'%s-01-01' %(datetime.now().year)"
66     #ending_details_ids:
67     journal_id: account.bank_journal
68     #line_ids:
69     #move_line_ids
70     name: "/"
71     period_id: account.period_1
72     #starting_details_ids
73     state: draft
74     #total_entry_encoding
75     #user_id
76
77 -
78   I import the 1st V11
79 -
80   !python {model: bvr.import.wizard}: | 
81     import base64
82     import addons
83     import os
84     
85     # create our wizard
86     wiz_id = self.create(cr,uid,[])
87     wiz = self.browse(cr, uid, wiz_id)
88     
89     test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_1.v11'))
90     
91     # get our test file to test it
92     f_v11 = open(test_file_path)
93     
94     str64_v11 = base64.encodestring(f_v11.read())
95      
96     wiz.write({'file': str64_v11})
97     
98     # set the file in the wizard field
99     bank_statement_id = ref('v11_part_test_bank_statement_1')
100     
101     context['active_id'] = bank_statement_id 
102     context['active_ids'] = [bank_statement_id]
103     # launch the import
104     self.import_bvr(cr, uid, [wiz_id], context=context)
105     
106     
107 -
108   I check my bank statement got a statement line
109 -
110   !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: statement has 1 and only 1 statement line id}:
111    - len(line_ids) == 1
112    
113 -
114   I check the voucher linked to the statement line contains a line with an amount of EUR 150.00
115 -
116   !python {model: account.bank.statement}: |
117     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
118     
119     voucher_line_ids = statement.line_ids[0].voucher_id.line_ids
120     
121     assert voucher_line_ids, "No voucher line found"
122     
123     voucher_line_amount = voucher_line_ids[0].amount
124     assert voucher_line_amount == 150.00, "Amount isn't correct : %d" %(voucher_line_amount)
125
126 -
127   I check amount of account voucher is equal to the bank statement line amount
128 -
129   !python {model: account.bank.statement}: |
130     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
131     
132     statement_line_amount = statement.line_ids[0].amount
133     voucher_amount = statement.line_ids[0].voucher_id.amount
134     
135     assert statement_line_amount == voucher_amount, "Mismatch of amounts"
136     
137 -
138   I enter the closing balance and press on compute button 
139 -
140   !python {model: account.bank.statement}: |
141     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
142     statement.write({'balance_end_real': 150.00})
143     self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context)
144
145 -
146   I check that the statement Balance is EUR 150.00
147 -
148   !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: balance is 150.0}:
149    - balance_end == 150.0
150
151 -
152   I confirm my 1st bank statement
153 -
154   !python {model: account.bank.statement}: |
155     self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context)
156   
157
158 -
159   I check that my invoice is partially paid in open state, not reconciled, with a residual amount of EUR 100.0
160   #########################################
161  #        Checking partial result        #
162 #########################################
163 -
164   !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is open, reconciled and has no residual'}:
165    - state == "open"
166    - not reconciled
167    - residual == 100.0
168
169
170
171 -
172   I create a 2nd bank statement
173   #########################################
174  #      Creating 2nd bank statement      #
175 #########################################
176 -
177   !record {model: account.bank.statement, id: v11_part_test_bank_statement_2, view: False}:
178     #account_id:
179     #balance_end:
180     #balance_end_cash:
181     #balance_end_real:
182     #balance_start:
183     #closing_date:
184     #company_id:
185     #currency:
186     date: !eval "'%s-01-01' %(datetime.now().year)"
187     #ending_details_ids:
188     journal_id: account.bank_journal
189     #line_ids:
190     #move_line_ids
191     name: "/"
192     period_id: account.period_1
193     #starting_details_ids
194     state: draft
195     #total_entry_encoding
196     #user_id
197
198 -
199   I import the 2nd V11
200 -
201   !python {model: bvr.import.wizard}: | 
202     import base64
203     import addons
204     import os
205     
206     # create our wizard
207     wiz_id = self.create(cr,uid,[])
208     wiz = self.browse(cr, uid, wiz_id)
209     
210     test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_2.v11'))
211     
212     # get our test file to test it
213     f_v11 = open(test_file_path)
214     
215     str64_v11 = base64.encodestring(f_v11.read())
216      
217     wiz.write({'file': str64_v11})
218     
219     # set the file in the wizard field
220     bank_statement_id = ref('v11_part_test_bank_statement_2')
221     
222     context['active_id'] = bank_statement_id 
223     context['active_ids'] = [bank_statement_id]
224     # launch the import
225     self.import_bvr(cr, uid, [wiz_id], context=context)
226     
227     
228 -
229   I check my bank statement got a statement line
230 -
231   !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: statement has 1 and only 1 statement line id}:
232    - len(line_ids) == 1
233    
234 -
235   I check the voucher linked to the statement line contains a line with an amount of EUR 100.00
236 -
237   !python {model: account.bank.statement}: |
238     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
239     
240     voucher_line_ids = statement.line_ids[0].voucher_id.line_ids
241     
242     assert voucher_line_ids, "No voucher line found"
243     
244     voucher_line_amount = voucher_line_ids[0].amount
245     assert voucher_line_amount == 100.00, "Amount isn't correct : %d" %(voucher_line_amount)
246
247 -
248   I check amount of account voucher is equal to the bank statement line amount
249 -
250   !python {model: account.bank.statement}: |
251     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
252     
253     statement_line_amount = statement.line_ids[0].amount
254     voucher_amount = statement.line_ids[0].voucher_id.amount
255     
256     assert statement_line_amount == voucher_amount, "Mismatch of amounts"
257     
258
259 -
260   I enter the closing balance and press on compute button 
261 -
262   !python {model: account.bank.statement}: |
263     statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
264     statement.write({'balance_end_real': 100.00})
265     self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context)
266
267 -
268   I check that the statement Balance is EUR 100.00
269 -
270   !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: balance is 100.0}:
271    - balance_end == 100.0
272
273 -
274   I confirm my 2nd bank statement
275 -
276   !python {model: account.bank.statement}: |
277     self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context)
278
279
280
281 -
282   I check my invoice is paid, reconciled and has no residual
283   #########################################
284  #        Checking finale state          #
285 #########################################
286 -
287   !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is paid, reconciled and has no residual'}:
288    - state == "paid"
289    - reconciled
290    - residual == 0.0