~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
-
  8. Testing refunds notes
-
  8.0 To test refund notes i create an invoice (modify)
-
  !record {model: account.invoice, id: test_fr05}:
    type: out_invoice
    company_id: base.main_company
    currency_id: base.EUR
    date_invoice: !eval time.strftime('%Y-%m-%d')
    account_id: account.a_recv
    invoice_line:
      - product_id: product.product_product_3
        quantity: 5
        uos_id: product.product_uom_unit
        price_unit: 20
        name: Fiscal Requirements Sale Invoice
        account_id: account.a_sale
        invoice_line_tax_id:
        - iva_sale1
    journal_id: account.sales_journal
    partner_id: f_req_partner_2
    reference_type: none
    name: Test refund 1
-
  8.1 I check that Initially customer invoice is in the "Draft" state
-
  !assert {model: account.invoice, id: test_fr05}:
    - state == 'draft'
-
  8.2 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
-
  !workflow {model: account.invoice, action: invoice_proforma2, ref: test_fr05}
-
  8.3 I check that the invoice state is now "Proforma2"
-
  !assert {model: account.invoice, id: test_fr05}:
    - state == 'proforma2'
-
  8.4 I create invoice by clicking on Create button
-
  !workflow {model: account.invoice, action: invoice_open, ref: test_fr05}
-
  8.5 I check that the invoice state is "Open"
-
  !assert {model: account.invoice, id: test_fr05, string: Invoice is not in open state}:
    - state == 'open'
-
  8.6 I click on the Refund button (modify)
-
  !record {model: account.invoice.refund, id: fr_air01}:
    description: Test refund 1
    date: !eval time.strftime('%Y-%m-%d')
    journal_id: account.refund_sales_journal
    filter_refund: modify
-
  8.7 Update Refund period
-
  !python {model: account.invoice.refund}: |
    import time
    ap_obj = self.pool.get('account.period')
    period = ap_obj.search(cr, uid, [('code', '=', time.strftime('%m/%Y')) ])
    assert period, 'There aren\'t periods for this date'
    self.write(cr, uid, [ref("fr_air01")], {'period':period[0]})
    aid_brw = self.browse(cr, uid, ref("fr_air01"))
    assert aid_brw.period, 'Period was not updated for the refund'
-
  8.8 I click on the Refund button from the wizard
-
  !python {model: account.invoice.refund}: |
    self.invoice_refund(cr, uid, [ref("fr_air01")], {"lang": "en_US", "active_model":
      "account.invoice", "active_ids": [ref("test_fr05")], "tz": False, "active_id": ref("test_fr05"),
      })
-
  8.9 I check that the invoice state is now "paid"
-
  !assert {model: account.invoice, id: test_fr05}:
    - state == 'paid'
-
  8.10 Test if customer refund was properly created
-
  !python {model: account.invoice}: |
    ai_id = self.search(cr, uid, [('parent_id', '=', ref("test_fr05"))])
    assert ai_id, 'Debit Note was not created'
    ai_brw = self.browse(cr, uid, ai_id[0])
    assert ai_brw.state == 'paid', 'Debit note was not created properly'
-
  8.11 Test if invoice was properly created in draft state
-
  !python {model: account.invoice}: |
    parent_brw = self.browse(cr, uid, ref("test_fr05"))
    ai_id = self.search(cr, uid, [('name', '=', parent_brw.name), ('state', '=', 'draft'), ('type', '=', 'out_invoice')])
    assert ai_id, 'Debit Note was not created'
-
  8.12 Test if wh concept and taxes were created in the new invoice
-
  !python {model: account.invoice}: |
    parent_brw = self.browse(cr, uid, ref("test_fr05"))
    ai_id = self.search(cr, uid, [('name', '=', parent_brw.name), ('state', '=', 'draft'), ('type', '=', 'out_invoice')])
    rf_brw = self.browse(cr, uid, ref("test_fr05"))
    tax1 = []
    whc1 = []
    for line in rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax1.append(tax.id)
    rf_brw = ai_id and self.browse(cr, uid, ai_id[0])
    tax2 = []
    whc2 = []
    for line in rf_brw and rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax2.append(tax.id)
    tax1 = set(tax1)
    tax2 = set(tax2)
    assert tax1 == tax2, 'Both invoices has not the same taxes'

    whc1 = set(whc1)
    whc2 = set(whc2)
    assert whc1 == whc2, 'Both invoices has not the same wh concepts'
-
  9.0 To test refund notes i create an invoice (refund)
-
  !record {model: account.invoice, id: test_fr06}:
    type: out_invoice
    company_id: base.main_company
    currency_id: base.EUR
    date_invoice: !eval time.strftime('%Y-%m-%d')
    account_id: account.a_recv
    invoice_line:
      - product_id: product.product_product_3
        quantity: 5
        uos_id: product.product_uom_unit
        price_unit: 20
        name: Fiscal Requirements Sale Invoice
        account_id: account.a_sale
        invoice_line_tax_id:
        - iva_sale1
    journal_id: account.sales_journal
    partner_id: f_req_partner_2
    reference_type: none
-
  9.1 I check that Initially customer invoice is in the "Draft" state
-
  !assert {model: account.invoice, id: test_fr06}:
    - state == 'draft'
-
  9.2 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
-
  !workflow {model: account.invoice, action: invoice_proforma2, ref: test_fr06}
-
  9.3 I check that the invoice state is now "Proforma2"
-
  !assert {model: account.invoice, id: test_fr06}:
    - state == 'proforma2'
-
  9.4 I create invoice by clicking on Create button
-
  !workflow {model: account.invoice, action: invoice_open, ref: test_fr06}
-
  9.5 I check that the invoice state is "Open"
-
  !assert {model: account.invoice, id: test_fr06, string: Invoice is not in open state}:
    - state == 'open'
-
  9.6 I click on the Refund button (refund)
-
  !record {model: account.invoice.refund, id: fr_air02}:
    description: Test refund 2
    date: !eval time.strftime('%Y-%m-%d')
    journal_id: account.refund_sales_journal
    filter_refund: refund
-
  9.7 Update Refund period
-
  !python {model: account.invoice.refund}: |
    import time
    ap_obj = self.pool.get('account.period')
    period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})
    assert period, 'There aren\'t periods for this date'
    self.write(cr, uid, [ref("fr_air02")], {'period':period[0]})
    aid_brw = self.browse(cr, uid, ref("fr_air02"))
    assert aid_brw.period, 'Period was not updated for the refund'
-
  9.8 I click on the Refund button from the wizard
-
  !python {model: account.invoice.refund}: |
    self.invoice_refund(cr, uid, [ref("fr_air02")], {"lang": "en_US", "active_model":
      "account.invoice", "active_ids": [ref("test_fr06")], "tz": False, "active_id": ref("test_fr06"),
      "type": "out_invoice", "journal_type": "sale",
      })
-
  9.9 Test if invoice was properly created
-
  !python {model: account.invoice}: |
    ai_id = self.search(cr, uid, [('parent_id', '=', ref("test_fr06")), ('type', '=', 'out_refund')])
    assert ai_id, 'Refund Note was not created'
    ai_brw = self.browse(cr, uid, ai_id[0])
    assert ai_brw.state == 'draft', 'Refund note was not created properly'
-
  9.10 Test if wh concept and taxes were created in the new invoice
-
  !python {model: account.invoice}: |
    parent_brw = self.browse(cr, uid, ref("test_fr06"))
    ai_id = self.search(cr, uid, [('parent_id', '=', ref("test_fr06"))])
    rf_brw = self.browse(cr, uid, ref("test_fr06"))
    tax1 = []
    whc1 = []
    for line in rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax1.append(tax.id)
    rf_brw = self.browse(cr, uid, ai_id[0])
    tax2 = []
    whc2 = []
    for line in rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax2.append(tax.id)
    tax1 = set(tax1)
    tax2 = set(tax2)
    assert tax1 == tax2, 'Both invoices has not the same taxes'

    whc1 = set(whc1)
    whc2 = set(whc2)
    assert whc1 == whc2, 'Both invoices has not the same wh concepts'
-
  10 In order to test fiscal requirements I create a new customer sale invoice with tax
-
  !record {model: account.invoice, id: test_fr07}:
    type: out_invoice
    company_id: base.main_company
    currency_id: base.EUR
    date_invoice: !eval time.strftime('%Y-%m-%d')
    account_id: account.a_recv
    invoice_line:
      - product_id: product.product_product_4
        quantity: 5
        uos_id: product.product_uom_unit
        price_unit: 20
        name: Fiscal Requirements Sale Invoice
        account_id: account.a_sale
        invoice_line_tax_id:
        - iva_sale1
    journal_id: account.sales_journal
    partner_id: f_req_partner_2
    reference_type: none
    comment: Test FR, this invoice should be cancelled
    name: Test refund 3
-
  10.1 I check that Initially customer invoice is in the "Draft" state
-
  !assert {model: account.invoice, id: test_fr07}:
    - state == 'draft'
-
  10.2 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
-
  !workflow {model: account.invoice, action: invoice_proforma2, ref: test_fr07}
-
  10.3 I check that the invoice state is now "Proforma2"
-
  !assert {model: account.invoice, id: test_fr07}:
    - state == 'proforma2'
-
  10.4 I create invoice by clicking on Create button
-
  !workflow {model: account.invoice, action: invoice_open, ref: test_fr07}
-
  10.5 I check that the invoice state is "Open"
-
  !assert {model: account.invoice, id: test_fr07, string: Invoice is not in open state}:
    - state == 'open'
-
  10.6 I click on the Refund button (cancel)
-
  !record {model: account.invoice.refund, id: fr_air03}:
    description: Test refund 3 cancel
    date: !eval time.strftime('%Y-%m-%d')
    journal_id: account.refund_sales_journal
    filter_refund: cancel
-
  10.7 Update Refund period
-
  !python {model: account.invoice.refund}: |
    import time
    ap_obj = self.pool.get('account.period')
    period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})
    assert period, 'There aren\'t periods for this date'
    self.write(cr, uid, [ref("fr_air03")], {'period':period[0]})
    aid_brw = self.browse(cr, uid, ref("fr_air03"))
    assert aid_brw.period, 'Period was not updated for the refund'
-
  10.8 I click on the Refund button from the wizard
-
  !python {model: account.invoice.refund}: |
    self.invoice_refund(cr, uid, [ref("fr_air03")], {"lang": "en_US", "active_model":
      "account.invoice", "active_ids": [ref("test_fr07")], "tz": False, "active_id": ref("test_fr07"),
      "type": "out_invoice", "journal_type": "sale",
      })
-
  10.9 Test if invoice was properly created
-
  !python {model: account.invoice}: |
    ai_id = self.search(cr, uid, [('parent_id', '=', ref("test_fr07")), ('type', '=', 'out_refund')])
    assert ai_id, 'Refund Note was not created'
    ai_brw = self.browse(cr, uid, ai_id[0])
    assert ai_brw.state == 'paid', 'Refund note was not created properly'
-
  10.10 Test if wh concept and taxes were created in the new invoice
-
  !python {model: account.invoice}: |
    parent_brw = self.browse(cr, uid, ref("test_fr07"))
    ai_id = self.search(cr, uid, [('parent_id', '=', ref("test_fr07"))])
    rf_brw = self.browse(cr, uid, ref("test_fr07"))
    tax1 = []
    whc1 = []
    for line in rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax1.append(tax.id)
    rf_brw = self.browse(cr, uid, ai_id[0])
    tax2 = []
    whc2 = []
    for line in rf_brw.invoice_line:
      for tax in line.invoice_line_tax_id:
        tax2.append(tax.id)
    tax1 = set(tax1)
    tax2 = set(tax2)
    assert tax1 == tax2, 'Both invoices has not the same taxes'

    whc1 = set(whc1)
    whc2 = set(whc2)
    assert whc1 == whc2, 'Both invoices has not the same wh concepts'