Merge lp:~openerp-commiter/openobject-addons/UnitTestCases into lp:openobject-addons
- UnitTestCases
- Merge into trunk
Proposed by
Naresh(OpenERP)
Status: | Rejected |
---|---|
Rejected by: | Harry (OpenERP) |
Proposed branch: | lp:~openerp-commiter/openobject-addons/UnitTestCases |
Merge into: | lp:openobject-addons |
Diff against target: |
11300 lines (has conflicts)
Conflict adding files to account_balance. Created directory. Conflict because account_balance is not versioned, but has versioned children. Versioned directory. Text conflict in base_module_quality/unit_test/__init__.py Text conflict in base_module_quality/unit_test/unit_test.py Conflict adding files to crm_configuration. Created directory. Conflict because crm_configuration is not versioned, but has versioned children. Versioned directory. Text conflict in sale/unit_test/__init__.py Text conflict in sale/unit_test/test.py |
To merge this branch: | bzr merge lp:~openerp-commiter/openobject-addons/UnitTestCases |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+15732@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote : | # |
Revision history for this message
Mantavya Gajjar (Open ERP) (mga) wrote : | # |
hello !!
can you please convert TAB->SPACE(4), as in openerp we use space(4) instead of tab
regards,
mga
- 2588. By Naresh(OpenERP)
-
[IMP]:1 tab--> 4 spaces
Unmerged revisions
- 2588. By Naresh(OpenERP)
-
[IMP]:1 tab--> 4 spaces
- 2587. By Naresh(OpenERP)
-
[IMP]:accounting report
- 2586. By Naresh(OpenERP)
-
[IMP]:warning
- 2585. By Naresh(OpenERP)
-
[FIX]:account_
followup wizard - 2584. By vir (Open ERP)
-
[MOD,IMP] improved code and added reusability
- 2583. By Naresh(OpenERP)
-
[IMP]:crm_
configuration - 2582. By rvo(OpennERP)
-
[ADD]:testcase for hr_holidays
- 2581. By rga(OpenERP)
-
[ADD]:unittest cases for account_report
- 2580. By vir (Open ERP)
-
[MOD] Removed unused lines of code
- 2579. By vir (Open ERP)
-
[ADD] Unit test case for warning module
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'account/unit_test' |
2 | === added file 'account/unit_test/__init__.py' |
3 | --- account/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ account/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
5 | @@ -0,0 +1,22 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
11 | +# |
12 | +# This program is free software: you can redistribute it and/or modify |
13 | +# it under the terms of the GNU Affero General Public License as |
14 | +# published by the Free Software Foundation, either version 3 of the |
15 | +# License, or (at your option) any later version. |
16 | +# |
17 | +# This program is distributed in the hope that it will be useful, |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | +# GNU Affero General Public License for more details. |
21 | +# |
22 | +# You should have received a copy of the GNU Affero General Public License |
23 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | +# |
25 | +############################################################################## |
26 | + |
27 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
28 | \ No newline at end of file |
29 | |
30 | === added file 'account/unit_test/test.py' |
31 | --- account/unit_test/test.py 1970-01-01 00:00:00 +0000 |
32 | +++ account/unit_test/test.py 2010-03-08 07:28:31 +0000 |
33 | @@ -0,0 +1,374 @@ |
34 | +# -*- coding: utf-8 -*- |
35 | +############################################################################## |
36 | +# |
37 | +# OpenERP, Open Source Management Solution |
38 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
39 | +# |
40 | +# This program is free software: you can redistribute it and/or modify |
41 | +# it under the terms of the GNU Affero General Public License as |
42 | +# published by the Free Software Foundation, either version 3 of the |
43 | +# License, or (at your option) any later version. |
44 | +# |
45 | +# This program is distributed in the hope that it will be useful, |
46 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
47 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
48 | +# GNU Affero General Public License for more details. |
49 | +# |
50 | +# You should have received a copy of the GNU Affero General Public License |
51 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
52 | +# |
53 | +############################################################################## |
54 | +import unittest |
55 | +import pooler |
56 | +from osv import osv |
57 | +import netsvc |
58 | +import time |
59 | +import product.unit_test.test as prod |
60 | + |
61 | +invoice_invoice_ids=None |
62 | +invoice_line_ids=None |
63 | +period_id=None |
64 | +case_journal_id=None |
65 | +sale_journal_id=None |
66 | +purchase_journal_id=None |
67 | +account_account_id=None |
68 | +account_account_types=None |
69 | +partner_id=None |
70 | +account_tax_id=None |
71 | +account_payment_term_line_id=None |
72 | +account_payment_term_id=None |
73 | + |
74 | +class account(unittest.TestCase): |
75 | + third_party_cases={prod.product_test_case: ['test_1_Create']} |
76 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
77 | + self.cr = cursor |
78 | + self.uid = user |
79 | + unittest.TestCase.__init__(self, methodName) |
80 | + |
81 | + def setUp(self): |
82 | + try: |
83 | + self.pool = pooler.get_pool(self.cr.dbname) |
84 | + self.account_account = self.pool.get('account.account') |
85 | + self.account_invoice = self.pool.get('account.invoice') |
86 | + self.account_move = self.pool.get('account.move') |
87 | + self.account_move_line = self.pool.get('account.move.line') |
88 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
89 | + self.wf_service = netsvc.LocalService("workflow") |
90 | + self.wizard_service = netsvc.ExportService.getService("wizard") |
91 | + except osv.except_osv,e: |
92 | + self.fail(e.name + e.value) |
93 | + except Exception,e: |
94 | + self.fail(e) |
95 | + |
96 | + def tearDown(self): |
97 | + try: |
98 | + self.pool = None |
99 | + self.account_move = None |
100 | + self.account_move_line = None |
101 | + self.account_invoice = None |
102 | + self.account_invoice_line = None |
103 | + self.wf_service = None |
104 | + self.wizard_service = None |
105 | + self.passwd = None |
106 | + except osv.except_osv,e: |
107 | + self.fail(e.name + e.value) |
108 | + except Exception,e: |
109 | + self.fail(e) |
110 | + |
111 | + |
112 | + def test_1_creat_payment_term(self): |
113 | + try: |
114 | + global invoice_invoice_ids,invoice_line_ids,period_id,case_journal_id,sale_journal_id,purchase_journal_id,account_account_id,account_account_types,partner_id,account_tax_id,account_payment_term_line_id,account_payment_term_id |
115 | + #Create Payment Term |
116 | + account_payment_term_id = self.pool.get('account.payment.term').create(self.cr,self.uid,{'name':'Payment Term Unit test'}) |
117 | + account_payment_term_line_id = self.pool.get('account.payment.term.line').create(self.cr,self.uid,{ |
118 | + 'name':'Payment term unit test by', |
119 | + 'sequence':1, |
120 | + 'value':'procent', |
121 | + 'value_amount':0.20, |
122 | + 'days': 20, |
123 | + 'days2':-1, |
124 | + 'payment_id':account_payment_term_id, |
125 | + }) |
126 | + |
127 | + #Create Tax |
128 | + account_tax_id = self.pool.get('account.tax').create(self.cr,self.uid,{'name':'VAT(Unit test)','amount':0.1200}) |
129 | + |
130 | + #Create Account Type |
131 | + account_account_types=[] |
132 | + types= ['expense','income','cash'] |
133 | + for type in types: |
134 | + method = 'unreconciled' |
135 | + if type == 'case': |
136 | + method = 'balance' |
137 | + account_type = self.pool.get('account.account.type').create(self.cr,self.uid,{ |
138 | + 'name':'Test %s' % type.capitalize(), |
139 | + 'code':type, |
140 | + 'close_method':'unreconciled'}) |
141 | + account_account_types.append(account_type) |
142 | + |
143 | + account_account_types.extend(account_account_types) |
144 | + accounts = ['payable','receivable','other','other','other','other'] |
145 | + name = ['Test Main Payable','Test Main Receivable','Others','Test Product Purchase','Test Product Sale','Test Petty Cash'] |
146 | + code = ['x-10','x-20','x-30','x-40','x-50','x-60'] |
147 | + account_account_id = [] |
148 | + for seq in range(0,len(accounts)): |
149 | + account_account = self.pool.get('account.account').create(self.cr,self.uid,{ |
150 | + 'name':name[seq], |
151 | + 'code':code[seq], |
152 | + 'reconcile':True, |
153 | + 'type':accounts[seq], |
154 | + 'user_type':account_account_types[seq], |
155 | + }) |
156 | + account_account_id.append(account_account) |
157 | + model_obj = self.pool.get('ir.model.data') |
158 | + sale_sequence = model_obj._get_id(self.cr,self.uid, 'account', 'sequence_sale_journal') |
159 | + sale_sequence_id = model_obj.browse(self.cr, self.uid, sale_sequence).res_id |
160 | + |
161 | + period = model_obj._get_id(self.cr,self.uid, 'account', 'period_11') |
162 | + period_id = model_obj.browse(self.cr, self.uid, period).res_id |
163 | + |
164 | + purchase_sequence = model_obj._get_id(self.cr,self.uid, 'account', 'sequence_purchase_journal') |
165 | + purchase_sequence_id = model_obj.browse(self.cr, self.uid, purchase_sequence).res_id |
166 | + |
167 | + |
168 | + case_sequence = model_obj._get_id(self.cr,self.uid,'account','sequence_journal') |
169 | + case_sequence_id = model_obj.browse(self.cr,self.uid,case_sequence).res_id |
170 | + |
171 | + |
172 | + view_id = self.pool.get('account.journal.view').search(self.cr,self.uid,[('name','=','Journal View')])[0] |
173 | + |
174 | + #sale Journal |
175 | + sale_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{ |
176 | + 'name':'Sale Unit Test Journal', |
177 | + 'code':'STJ', |
178 | + 'view_id':view_id, |
179 | + 'sequence_id':sale_sequence_id, |
180 | + 'type':'sale', |
181 | + 'update_posted':True, |
182 | + 'default_credit_account_id':account_account_id[4], |
183 | + 'default_debit_account_id':account_account_id[4]}) |
184 | + #purchase journal |
185 | + purchase_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{ |
186 | + 'name':'Purchase Expense Unit Test Journal', |
187 | + 'code':'PTJ', |
188 | + 'view_id':view_id, |
189 | + 'sequence_id':purchase_sequence_id, |
190 | + 'type':'purchase', |
191 | + 'update_posted':True, |
192 | + 'default_credit_account_id':account_account_id[3], |
193 | + 'default_debit_account_id':account_account_id[3]}) |
194 | + view_case_id = self.pool.get('account.journal.view').search(self.cr,self.uid,[('name','=','Cash Journal View')])[0] |
195 | + #case journal |
196 | + case_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{ |
197 | + 'name':'Case Unit Test Journal', |
198 | + 'code':'CTJ', |
199 | + 'view_id':view_case_id, |
200 | + 'sequence_id':case_sequence_id, |
201 | + 'type':'cash', |
202 | + 'update_posted':True, |
203 | + 'default_credit_account_id':account_account_id[5], |
204 | + 'default_debit_account_id':account_account_id[5]}) |
205 | + #Config Product |
206 | + fields_sale_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','product.template'),('name','=','property_account_income')]) |
207 | + res_id = 'product.template,'+ str(prod.product_id) |
208 | + sale_account_id = 'account.account,'+ str(account_account_id[4]) |
209 | + company_id = self.pool.get('res.company').search(self.cr,self.uid,[('name','=','Tiny sprl')]) |
210 | + |
211 | + property_sale_id = self.pool.get('ir.property').create(self.cr,self.uid,{ |
212 | + 'fields_id':fields_sale_id[0], |
213 | + 'res_id':res_id, |
214 | + 'name':'property_account_income', |
215 | + 'value':sale_account_id, |
216 | + 'company_id':company_id[0] |
217 | + }) |
218 | + fields_purchase_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','product.template'),('name','=','property_account_expense')]) |
219 | + purchase_account_id = 'account.account,'+ str(account_account_id[3]) |
220 | + property_purchase_id = self.pool.get('ir.property').create(self.cr,self.uid,{ |
221 | + 'fields_id':fields_purchase_id[0], |
222 | + 'res_id':res_id, |
223 | + 'name':'property_account_expense', |
224 | + 'value':purchase_account_id, |
225 | + 'company_id':company_id[0] |
226 | + }) |
227 | + #Config partner |
228 | + partner_id = self.pool.get('res.partner').create(self.cr,self.uid,{ |
229 | + 'name':'Unit test partner', |
230 | + 'supplier':True, |
231 | + }) |
232 | + partner_address = self.pool.get('res.partner.address').create(self.cr,self.uid,{ |
233 | + 'name':'Unit test Address', |
234 | + 'phone':'111-22222-33', |
235 | + 'type':'default', |
236 | + 'partner_id':partner_id |
237 | + }) |
238 | + res_id = 'res.partner,'+ str(partner_id) |
239 | + fields_partner_rece_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','res.partner'),('name','=','property_account_receivable')]) |
240 | + partner_rece_account_id = 'account.account,'+ str(account_account_id[1]) |
241 | + partner_rece_property_id = self.pool.get('ir.property').create(self.cr,self.uid,{ |
242 | + 'fields_id':fields_partner_rece_id[0], |
243 | + 'res_id':res_id, |
244 | + 'name':'property_account_receivable', |
245 | + 'value':partner_rece_account_id, |
246 | + 'company_id':company_id[0] |
247 | + }) |
248 | + |
249 | + fields_partner_pay_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','res.partner'),('name','=','property_account_payable')]) |
250 | + partner_pay_account_id = 'account.account,'+ str(account_account_id[0]) |
251 | + partner_pay_property_id = self.pool.get('ir.property').create(self.cr,self.uid,{ |
252 | + 'fields_id':fields_partner_pay_id[0], |
253 | + 'res_id':res_id, |
254 | + 'name':'property_account_payable', |
255 | + 'value':partner_pay_account_id, |
256 | + 'company_id':company_id[0] |
257 | + }) |
258 | + #Create Customer Invoice |
259 | + invoice_invoice_ids=[] |
260 | + invoice_line_ids = [] |
261 | + types = {'out_invoice':sale_journal_id,'in_invoice':purchase_journal_id} |
262 | + for key,val in types.items(): |
263 | + #Call Onchange Partner Id |
264 | + res = self.pool.get('account.invoice').onchange_partner_id(self.cr, self.uid, [], key, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False) |
265 | + invoice_id = self.pool.get('account.invoice').create(self.cr,self.uid,{ |
266 | + 'journal_id':val, |
267 | + 'address_invoice_id':res['value']['address_invoice_id'], |
268 | + 'partner_id':partner_id, |
269 | + 'type':key, |
270 | + 'address_contact_id':res['value']['address_contact_id'], |
271 | + 'account_id':res['value']['account_id'], |
272 | + 'payment_term':res['value']['payment_term'] |
273 | + }) |
274 | + invoice_invoice_ids.append(invoice_id) |
275 | + uom = False |
276 | + #Call Onchange Product Id |
277 | + res1 = self.pool.get('account.invoice.line').product_id_change(self.cr, self.uid, [], prod.product_id, uom, qty=0, name='', type=key, partner_id=partner_id, fposition_id=False, price_unit=False, address_invoice_id=False, context=None) |
278 | + if res1['value']['price_unit'] == False: |
279 | + res1['value']['price_unit']=5000 |
280 | + invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid,{ |
281 | + 'name':res1['value']['name'], |
282 | + 'uos_id':res1['value']['uos_id'], |
283 | + 'invoice_id':invoice_id, |
284 | + 'price_unit':res1['value']['price_unit'], |
285 | + 'account_id':res1['value']['account_id'], |
286 | + 'product_id':prod.product_id |
287 | + }) |
288 | + invoice_line_ids.append(invoice_line_id) |
289 | + |
290 | + except osv.except_osv,e: |
291 | + self.fail(e.name + e.value) |
292 | + except Exception,e: |
293 | + |
294 | + self.fail(e) |
295 | + |
296 | + def test_2_validate_customer_invoice(self): |
297 | + try: |
298 | + self.failUnless(len(invoice_invoice_ids),"No Customer Invoices Created !") |
299 | + self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_invoice_ids[1],'invoice_open', self.cr) |
300 | + |
301 | + except osv.except_osv,e: |
302 | self.fail(e.name + e.value) |
303 | + except Exception,e: |
304 | + self.fail(e) |
305 | + |
306 | + def test_3_validate_supplier_invoice(self): |
307 | + try: |
308 | + self.failUnless(len(invoice_invoice_ids),"No Supplier Invoices Created !") |
309 | + self.account_invoice.button_compute(self.cr, self.uid,[invoice_invoice_ids[0]], context=None, set_total=True) |
310 | + self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_invoice_ids[0],'invoice_open', self.cr) |
311 | + except osv.except_osv,e: |
312 | self.fail(e.name + e.value) |
313 | + except Exception,e: |
314 | + self.fail(e) |
315 | + |
316 | + def test_4_pay_customer_invoice(self): |
317 | + try: |
318 | + self.cr.commit() |
319 | + self.failUnless(len(invoice_invoice_ids),"No Supplier Invoices Created !") |
320 | + invoice_rec = self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids[1]) |
321 | + wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.invoice.pay') |
322 | + datas = {'form':{'name':'Unit Test Supplier Invoice Paid', |
323 | + 'amount': invoice_rec.residual, |
324 | + 'date': time.strftime('%Y-%m-%d'), |
325 | + 'period_id':period_id,'journal_id':case_journal_id}, |
326 | + 'ids':[invoice_invoice_ids[1]],'id':invoice_invoice_ids[1]} |
327 | state = 'reconcile' |
328 | + self.wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
329 | + except osv.except_osv,e: |
330 | + self.fail(e.name + e.value) |
331 | + except Exception,e: |
332 | + self.fail(e) |
333 | + |
334 | + |
335 | + def test_5_pay_supplier_invoice(self): |
336 | + try: |
337 | + self.cr.commit() |
338 | + self.failUnless(len(invoice_invoice_ids),"No Customer Invoices Created !") |
339 | + invoice_rec = self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids[0]) |
340 | + wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.invoice.pay') |
341 | datas = {'form': |
342 | + {'name':'Unit Test Customer Invoice Paid', |
343 | + 'amount': invoice_rec.residual, |
344 | + 'date': time.strftime('%Y-%m-%d'), |
345 | + 'period_id':period_id, |
346 | + 'journal_id':case_journal_id }, |
347 | + 'ids':[invoice_invoice_ids[0]], |
348 | + 'id':invoice_invoice_ids[0]} |
349 | state = 'reconcile' |
350 | + self.wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
351 | + except osv.except_osv,e: |
352 | + self.fail(e.name + e.value) |
353 | + except Exception,e: |
354 | + self.fail(e) |
355 | + |
356 | + def test_6_unreconcile_and_unlink_invoice(self): |
357 | try: |
358 | + self.failUnless(len(invoice_invoice_ids),"No invoice Created !") |
359 | + for invoice_rec in self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids): |
360 | + move = self.pool.get('account.move.line').browse(self.cr,self.uid,invoice_rec.payment_ids[0].id) |
361 | + entries = self.pool.get('account.move.line').search(self.cr,self.uid,[('move_id','=',invoice_rec.move_id.id)]) |
362 | + entries.append(invoice_rec.payment_ids[0].id) |
363 | + for entry in entries: |
364 | + wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.move.line.unreconcile') |
365 | + datas = {'form':{},'ids':[entry],'id':entry,'model':'account.move.line'} |
366 | + state = 'unrec' |
367 | + self.wizard_service.exp_execute(self.cr.dbname, self.uid,wizard_res , datas, state, {}) |
368 | + self.pool.get('account.move').unlink(self.cr,self.uid,[move.move_id.id]) |
369 | + self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_rec.id,'open_test', self.cr) |
370 | + self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_rec.id,'invoice_cancel',self.cr) |
371 | + self.account_invoice.unlink(self.cr,self.uid,invoice_invoice_ids) |
372 | + #unlink payment term |
373 | + self.failUnless(account_payment_term_line_id,"No payment term line Created !") |
374 | + self.pool.get('account.payment.term.line').unlink(self.cr,self.uid,[account_payment_term_line_id]) |
375 | + |
376 | + self.failUnless(account_payment_term_id,"No payment term Created !") |
377 | + self.pool.get('account.payment.term').unlink(self.cr,self.uid,[account_payment_term_id]) |
378 | + |
379 | + #unlink accounts |
380 | + self.failUnless(len(account_account_id),"No Account Created !") |
381 | + self.account_account.unlink(self.cr,self.uid,account_account_id) |
382 | + |
383 | + #unlink account types |
384 | + self.failUnless(len(account_account_types),"No Account types Created !") |
385 | + self.pool.get('account.account.type').unlink(self.cr,self.uid,account_account_types) |
386 | + |
387 | + #unlink tax |
388 | + self.failUnless(account_tax_id,"No Tax Created !") |
389 | + self.pool.get('account.tax').unlink(self.cr,self.uid,[account_tax_id]) |
390 | + |
391 | + #unlink journal |
392 | + self.pool.get('account.journal').unlink(self.cr,self.uid,[sale_journal_id,purchase_journal_id,case_journal_id]) |
393 | + #unlink product |
394 | + self.failUnless(prod.product_id,"No Product Created !") |
395 | + self.pool.get('product.product').unlink(self.cr,self.uid,[prod.product_id]) |
396 | + self.pool.get('product.pricelist.item').unlink(self.cr, self.uid,[prod.product_pricelist_items_id]) |
397 | + self.pool.get('product.pricelist.version').unlink(self.cr,self.uid,[prod.product_pricelist_version_id]) |
398 | + self.pool.get('product.pricelist').unlink(self.cr,self.uid,[prod.product_pricelist_id]) |
399 | + self.pool.get('product.pricelist.type').unlink(self.cr,self.uid,[prod.pricelist_type_id]) |
400 | + #unlink partner |
401 | + self.pool.get('res.partner').unlink(self.cr,self.uid,[partner_id]) |
402 | + except osv.except_osv,e: |
403 | self.fail(e.name + e.value) |
404 | + except Exception,e: |
405 | + self.fail(e) |
406 | + |
407 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
408 | + |
409 | + |
410 | + |
411 | + |
412 | + |
413 | + |
414 | + |
415 | |
416 | === added directory 'account_analytic_analysis/unit_test' |
417 | === added file 'account_analytic_analysis/unit_test/__init__.py' |
418 | --- account_analytic_analysis/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
419 | +++ account_analytic_analysis/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
420 | @@ -0,0 +1,23 @@ |
421 | +# -*- coding: utf-8 -*- |
422 | +############################################################################## |
423 | +# |
424 | +# OpenERP, Open Source Management Solution |
425 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
426 | +# |
427 | +# This program is free software: you can redistribute it and/or modify |
428 | +# it under the terms of the GNU Affero General Public License as |
429 | +# published by the Free Software Foundation, either version 3 of the |
430 | +# License, or (at your option) any later version. |
431 | +# |
432 | +# This program is distributed in the hope that it will be useful, |
433 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
434 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
435 | +# GNU Affero General Public License for more details. |
436 | +# |
437 | +# You should have received a copy of the GNU Affero General Public License |
438 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
439 | +# |
440 | +############################################################################## |
441 | + |
442 | + |
443 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
444 | |
445 | === added file 'account_analytic_analysis/unit_test/test.py' |
446 | --- account_analytic_analysis/unit_test/test.py 1970-01-01 00:00:00 +0000 |
447 | +++ account_analytic_analysis/unit_test/test.py 2010-03-08 07:28:31 +0000 |
448 | @@ -0,0 +1,123 @@ |
449 | +# -*- coding: utf-8 -*- |
450 | +############################################################################## |
451 | +# |
452 | +# OpenERP, Open Source Management Solution |
453 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
454 | +# |
455 | +# This program is free software: you can redistribute it and/or modify |
456 | +# it under the terms of the GNU Affero General Public License as |
457 | +# published by the Free Software Foundation, either version 3 of the |
458 | +# License, or (at your option) any later version. |
459 | +# |
460 | +# This program is distributed in the hope that it will be useful, |
461 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
462 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
463 | +# GNU Affero General Public License for more details. |
464 | +# |
465 | +# You should have received a copy of the GNU Affero General Public License |
466 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
467 | +# |
468 | +############################################################################## |
469 | + |
470 | +import unittest |
471 | +import pooler |
472 | +from osv import osv |
473 | +import netsvc |
474 | + |
475 | +analytic_account_id =None |
476 | + |
477 | +class account_analytic_analysis(unittest.TestCase): |
478 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
479 | + self.cr = cursor |
480 | + self.uid = user |
481 | + unittest.TestCase.__init__(self, methodName) |
482 | + |
483 | + def setUp(self): |
484 | + try: |
485 | + self.pool = pooler.get_pool(self.cr.dbname) |
486 | + self.hr_anlalytic_timesheet = self.pool.get('hr.analytic.timesheet') |
487 | + self.analytic_account = self.pool.get('account.analytic.account') |
488 | + except osv.except_osv,e: |
489 | + self.fail(e.name + e.value) |
490 | + except Exception,e: |
491 | + self.fail(e) |
492 | + |
493 | + def tearDown(self): |
494 | + try: |
495 | + self.pool=None |
496 | + self.hr_anlalytic_timesheet =None |
497 | + self.analytic_account = None |
498 | + except osv.except_osv,e: |
499 | + self.fail(e.name + e.value) |
500 | + except Exception,e: |
501 | + self.fail(e) |
502 | + |
503 | + |
504 | + def test_1_create_hr_analytic_timesheet(self): |
505 | + try: |
506 | + global analytic_account_id |
507 | + model_obj = self.pool.get('ir.model.data') |
508 | + analytic_account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_magasin_bml_1') |
509 | + analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id |
510 | + hr_timesheet_invoicing = model_obj._get_id(self.cr,self.uid,'hr_timesheet_invoice', 'timesheet_invoice_factor1') |
511 | + product_pricelist = model_obj._get_id(self.cr,self.uid,'product','pricelist_type_sale') |
512 | + product_pricelist_id = model_obj.browse(self.cr,self.uid,product_pricelist).res_id |
513 | + |
514 | + hr_timesheet_invoicing_id =model_obj.browse(self.cr, self.uid, hr_timesheet_invoicing).res_id |
515 | + |
516 | + hr_analytic_timesheet = self.hr_anlalytic_timesheet.create(self.cr,self.uid,{ |
517 | + 'name':'Testing module', |
518 | + 'amount':50.00, |
519 | + 'account_id':analytic_account_id, |
520 | + 'unit_amount':5.00, |
521 | + 'to_invoice':hr_timesheet_invoicing_id |
522 | + } ) |
523 | + self.analytic_account.write(self.cr,self.uid,[analytic_account_id],{ |
524 | + 'pricelist_id':product_pricelist_id, |
525 | + 'quantity_max':500 |
526 | + }) |
527 | + self.cr.commit() |
528 | + except osv.except_osv,e: |
529 | + self.fail(e.name + e.value) |
530 | + except Exception,e: |
531 | + self.fail(e) |
532 | + |
533 | + def test_2_timesheet_invoice(self): |
534 | + try: |
535 | + self.failUnless(analytic_account_id,"analytic account not found ") |
536 | + wizard_service = netsvc.ExportService.getService("wizard") |
537 | + wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid,'hr.timesheet.final.invoice.create') |
538 | + datas = {'form': {'date': 1, 'price': 1, 'balance_product': 1, 'name': 1, 'time': 1}, 'ids': [analytic_account_id], 'id': analytic_account_id} |
539 | + state = 'create' |
540 | + res = wizard_service.exp_execute(self.cr.dbname,self.uid,wizard_res,datas,state,{}) |
541 | + except osv.except_osv,e: |
542 | + self.fail(e.name + e.value) |
543 | + except Exception,e: |
544 | + self.fail(e) |
545 | + |
546 | + def test_3_unlink_invoice(self): |
547 | + try: |
548 | + self.failUnless(analytic_account_id,"analytic account not found ") |
549 | + analytic_line_id = self.pool.get("account.analytic.line").search(self.cr,self.uid,[('account_id','=',analytic_account_id)]) |
550 | + self.failUnless(analytic_line_id,"analytic account line not found !") |
551 | + invoice_id = self.pool.get('account.analytic.line').browse(self.cr,self.uid,analytic_line_id)[0].invoice_id.id |
552 | + |
553 | + self.failUnless(invoice_id,"invoice not created!") |
554 | + self.pool.get('account.invoice').unlink(self.cr,self.uid,[invoice_id]) |
555 | + |
556 | + self.pool.get("account.analytic.line").unlink(self.cr,self.uid,analytic_line_id) |
557 | + self.analytic_account.write(self.cr,self.uid,[analytic_account_id],{ |
558 | + 'pricelist_id':False, |
559 | + 'quantity_max':False |
560 | + }) |
561 | + except osv.except_osv,e: |
562 | + self.fail(e.name + e.value) |
563 | + except Exception,e: |
564 | + self.fail(e) |
565 | + |
566 | + |
567 | + |
568 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
569 | + |
570 | + |
571 | + |
572 | |
573 | === added directory 'account_analytic_default/unit_test' |
574 | === added file 'account_analytic_default/unit_test/__init__.py' |
575 | --- account_analytic_default/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
576 | +++ account_analytic_default/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
577 | @@ -0,0 +1,22 @@ |
578 | +# -*- coding: utf-8 -*- |
579 | +############################################################################## |
580 | +# |
581 | +# OpenERP, Open Source Management Solution |
582 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
583 | +# |
584 | +# This program is free software: you can redistribute it and/or modify |
585 | +# it under the terms of the GNU Affero General Public License as |
586 | +# published by the Free Software Foundation, either version 3 of the |
587 | +# License, or (at your option) any later version. |
588 | +# |
589 | +# This program is distributed in the hope that it will be useful, |
590 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
591 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
592 | +# GNU Affero General Public License for more details. |
593 | +# |
594 | +# You should have received a copy of the GNU Affero General Public License |
595 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
596 | +# |
597 | +############################################################################## |
598 | + |
599 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
600 | \ No newline at end of file |
601 | |
602 | === added file 'account_analytic_default/unit_test/test.py' |
603 | --- account_analytic_default/unit_test/test.py 1970-01-01 00:00:00 +0000 |
604 | +++ account_analytic_default/unit_test/test.py 2010-03-08 07:28:31 +0000 |
605 | @@ -0,0 +1,162 @@ |
606 | +# -*- coding: utf-8 -*- |
607 | +############################################################################## |
608 | +# |
609 | +# OpenERP, Open Source Management Solution |
610 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
611 | +# |
612 | +# This program is free software: you can redistribute it and/or modify |
613 | +# it under the terms of the GNU Affero General Public License as |
614 | +# published by the Free Software Foundation, either version 3 of the |
615 | +# License, or (at your option) any later version. |
616 | +# |
617 | +# This program is distributed in the hope that it will be useful, |
618 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
619 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
620 | +# GNU Affero General Public License for more details. |
621 | +# |
622 | +# You should have received a copy of the GNU Affero General Public License |
623 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
624 | +# |
625 | +############################################################################## |
626 | + |
627 | +import unittest |
628 | +import pooler |
629 | +import netsvc |
630 | +from osv import osv |
631 | +import time |
632 | + |
633 | +account_analytic_default_id = None |
634 | +invoice_id = None |
635 | +sales_journal_id = None |
636 | + |
637 | +class account_analytic_default_test_case(unittest.TestCase): |
638 | + |
639 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
640 | + self.cr = cursor |
641 | + self.uid = user |
642 | + unittest.TestCase.__init__(self, methodName) |
643 | + |
644 | + def setUp(self): |
645 | + try: |
646 | + self.pool = pooler.get_pool(self.cr.dbname) |
647 | + self.account_analytic_default = self.pool.get('account.analytic.default') |
648 | + self.account_invoice = self.pool.get('account.invoice') |
649 | + except osv.except_osv,e: |
650 | + self.fail(e.name + e.value) |
651 | + except Exception,e: |
652 | + self.fail(e) |
653 | + |
654 | + def tearDown(self): |
655 | + try: |
656 | + self.account_analytic_default = None |
657 | + self.account_invoice = None |
658 | + except osv.except_osv,e: |
659 | + self.fail(e.name + e.value) |
660 | + except Exception,e: |
661 | + self.fail(e) |
662 | + |
663 | + def test_1_Create(self): |
664 | + try: |
665 | + global account_analytic_default_id,invoice_id,sales_journal_id |
666 | + model_obj = self.pool.get('ir.model.data') |
667 | + # Product |
668 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1') |
669 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
670 | + product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit') |
671 | + product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id |
672 | + |
673 | + # Analytic Account |
674 | + account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1') |
675 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
676 | + |
677 | + # Partner |
678 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes') |
679 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
680 | + |
681 | + # Company |
682 | + company = model_obj._get_id(self.cr,self.uid, 'base', 'main_company') |
683 | + company_id = model_obj.browse(self.cr, self.uid, company,).res_id |
684 | + |
685 | + # Partners address |
686 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1') |
687 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
688 | + |
689 | + # Account |
690 | + receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv') |
691 | + receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id |
692 | + pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay') |
693 | + pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id |
694 | + |
695 | + # Analytic Journal |
696 | + sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
697 | + sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id |
698 | + analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale') |
699 | + analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id |
700 | + |
701 | + account_analytic_default_id = self.account_analytic_default.create(self.cr,self.uid, |
702 | + {'sequence':1, |
703 | + 'analytic_id':account_id, |
704 | + 'product_id':product_id, |
705 | + 'partner_id':partner_id, |
706 | + 'user_id':self.uid, |
707 | + 'company_id':company_id, |
708 | + 'date_start':time.strftime('%Y-%m-%d'), |
709 | + 'date_stop':time.strftime('%Y-%m-%d')}) |
710 | + # Invoice |
711 | + invoice_id = self.account_invoice.create(self.cr,self.uid, |
712 | + {'name': 'Unit Test case Invoice', |
713 | + 'type': 'out_invoice', |
714 | + 'partner_id': partner_id, |
715 | + 'address_invoice_id': partner_address_id, |
716 | + 'address_contact_id': partner_address_id, |
717 | + 'account_id':receive_account_id, |
718 | + }) |
719 | + |
720 | + result=self.pool.get('account.invoice.line').product_id_change(self.cr,self.uid, [], product_id, |
721 | + product_uom_id, qty=2, name='Unit test case', type='out_invoice', |
722 | + partner_id=partner_id, fposition=False, price_unit=False, |
723 | + address_invoice_id=False, context={}) |
724 | + |
725 | + # Invoice line |
726 | + invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid, |
727 | + {'name' :'Unit Test Invoice Line', |
728 | + 'invoice_id':invoice_id, |
729 | + 'account_id':pay_account_id, |
730 | + 'product_id':product_id, |
731 | + 'price_unit':result['value']['price_unit'] , |
732 | + 'quantity':4, |
733 | + 'account_analytic_id':result['value']['account_analytic_id'], |
734 | + }) |
735 | + self.pool.get('account.journal').write(self.cr,self.uid,[sales_journal_id],{'analytic_journal_id':analytic_journal_id}) |
736 | + except osv.except_osv,e: |
737 | + self.fail(e.name + e.value) |
738 | + except Exception,e: |
739 | + self.fail(e) |
740 | + |
741 | + def test_2_CreateInvoice(self): |
742 | + try: |
743 | + self.failUnless(invoice_id,"No Invoice Created !") |
744 | + wf_service = netsvc.LocalService("workflow") |
745 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
746 | + except osv.except_osv,e: |
747 | + self.fail(e.name + e.value) |
748 | + except Exception,e: |
749 | + self.fail(e) |
750 | + |
751 | + def test_3_Unlink(self): |
752 | + try: |
753 | + self.failUnless(account_analytic_default_id,"No account_analytic Created !") |
754 | + self.account_analytic_default.unlink(self.cr,self.uid,[account_analytic_default_id]) |
755 | + sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id) |
756 | + wf_service = netsvc.LocalService("workflow") |
757 | + if not sale_journal.update_posted: |
758 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True}) |
759 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
760 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
761 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False}) |
762 | + except osv.except_osv,e: |
763 | + self.fail(e.name + e.value) |
764 | + except Exception,e: |
765 | + self.fail(e) |
766 | + |
767 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
768 | |
769 | === added directory 'account_analytic_plans/unit_test' |
770 | === added file 'account_analytic_plans/unit_test/__init__.py' |
771 | --- account_analytic_plans/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
772 | +++ account_analytic_plans/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
773 | @@ -0,0 +1,22 @@ |
774 | +# -*- coding: utf-8 -*- |
775 | +############################################################################## |
776 | +# |
777 | +# OpenERP, Open Source Management Solution |
778 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
779 | +# |
780 | +# This program is free software: you can redistribute it and/or modify |
781 | +# it under the terms of the GNU Affero General Public License as |
782 | +# published by the Free Software Foundation, either version 3 of the |
783 | +# License, or (at your option) any later version. |
784 | +# |
785 | +# This program is distributed in the hope that it will be useful, |
786 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
787 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
788 | +# GNU Affero General Public License for more details. |
789 | +# |
790 | +# You should have received a copy of the GNU Affero General Public License |
791 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
792 | +# |
793 | +############################################################################## |
794 | + |
795 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
796 | \ No newline at end of file |
797 | |
798 | === added file 'account_analytic_plans/unit_test/test.py' |
799 | --- account_analytic_plans/unit_test/test.py 1970-01-01 00:00:00 +0000 |
800 | +++ account_analytic_plans/unit_test/test.py 2010-03-08 07:28:31 +0000 |
801 | @@ -0,0 +1,178 @@ |
802 | +# -*- coding: utf-8 -*- |
803 | +############################################################################## |
804 | +# |
805 | +# OpenERP, Open Source Management Solution |
806 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
807 | +# |
808 | +# This program is free software: you can redistribute it and/or modify |
809 | +# it under the terms of the GNU Affero General Public License as |
810 | +# published by the Free Software Foundation, either version 3 of the |
811 | +# License, or (at your option) any later version. |
812 | +# |
813 | +# This program is distributed in the hope that it will be useful, |
814 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
815 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
816 | +# GNU Affero General Public License for more details. |
817 | +# |
818 | +# You should have received a copy of the GNU Affero General Public License |
819 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
820 | +# |
821 | +############################################################################## |
822 | + |
823 | +import unittest |
824 | +import pooler |
825 | +import netsvc |
826 | +from osv import osv |
827 | + |
828 | +analytic_plan_instance_id = None |
829 | +analytic_plan_id = None |
830 | +invoice_id = None |
831 | + |
832 | +class account_analytic_plans_test_case(unittest.TestCase): |
833 | + |
834 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
835 | + self.cr = cursor |
836 | + self.uid = user |
837 | + unittest.TestCase.__init__(self, methodName) |
838 | + |
839 | + def setUp(self): |
840 | + try: |
841 | + self.pool = pooler.get_pool(self.cr.dbname) |
842 | + self.account_analytic_plan_instance = self.pool.get('account.analytic.plan.instance') |
843 | + self.account_analytic_plan_instance_line = self.pool.get('account.analytic.plan.instance.line') |
844 | + self.account_analytic_plan = self.pool.get('account.analytic.plan') |
845 | + self.account_analytic_plan_line = self.pool.get('account.analytic.plan.line') |
846 | + self.account_invoice = self.pool.get('account.invoice') |
847 | + self.account_invoice_line=self.pool.get('account.invoice.line') |
848 | + except osv.except_osv,e: |
849 | + self.fail(e.name + e.value) |
850 | + except Exception,e: |
851 | + self.fail(e) |
852 | + |
853 | + def tearDown(self): |
854 | + try: |
855 | + self.account_analytic_plan_instance = None |
856 | + self.account_analytic_plan_instance_line = None |
857 | + self.account_analytic_plan = None |
858 | + self.account_analytic_plan_line = None |
859 | + self.account_invoice = None |
860 | + self.account_invoice_line = None |
861 | + except osv.except_osv,e: |
862 | + self.fail(e.name + e.value) |
863 | + except Exception,e: |
864 | + self.fail(e) |
865 | + |
866 | + def test_1_Create(self): |
867 | + try: |
868 | + global invoice_id,sales_journal_id,analytic_plan_instance_id,analytic_plan_id |
869 | + model_obj = self.pool.get('ir.model.data') |
870 | + # Product |
871 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1') |
872 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
873 | + product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit') |
874 | + product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id |
875 | + |
876 | + # Analytic Account |
877 | + account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1') |
878 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
879 | + account_2 = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_2') |
880 | + account_id_2 = model_obj.browse(self.cr, self.uid, account_2).res_id |
881 | + # Partner |
882 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes') |
883 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
884 | + |
885 | + # Partners address |
886 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1') |
887 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
888 | + |
889 | + # Account |
890 | + receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv') |
891 | + receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id |
892 | + |
893 | + pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay') |
894 | + pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id |
895 | + |
896 | + # Analytic Journal |
897 | + analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale') |
898 | + analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id |
899 | + |
900 | + # Account Analytic Plan |
901 | + analytic_plan_id = self.account_analytic_plan.create(self.cr,self.uid, |
902 | + {'name':'Unit test analytic plan'}) |
903 | + # Analytic plan Instance |
904 | + analytic_plan_instance_id = self.account_analytic_plan_instance.create(self.cr,self.uid, |
905 | + {'name':'Unit test Analytic Distribution', |
906 | + 'code':'Unit test AD', |
907 | + 'journal_id':analytic_journal_id, |
908 | + 'plan_id':analytic_plan_id}) |
909 | + |
910 | + # Account Analytic Plan Lines |
911 | + for acc,rate in [(account_id,10.00),(account_id_2,50.00)]: |
912 | + self.account_analytic_plan_line.create(self.cr,self.uid, |
913 | + {'plan_id':analytic_plan_id, |
914 | + 'name':'First', |
915 | + 'sequence':0, |
916 | + 'root_analytic_id':acc, |
917 | + 'min_required':rate, |
918 | + 'max_required':100.00}) |
919 | + # Analytic plan Instance Line |
920 | + self.account_analytic_plan_instance_line.create(self.cr,self.uid, |
921 | + {'plan_id':analytic_plan_instance_id, |
922 | + 'analytic_account_id':acc, |
923 | + 'rate':rate}) |
924 | + # Invoice |
925 | + invoice_id = self.account_invoice.create(self.cr,self.uid, |
926 | + {'name': 'Unit Test case Invoice', |
927 | + 'type': 'out_invoice', |
928 | + 'partner_id': partner_id, |
929 | + 'address_invoice_id': partner_address_id, |
930 | + 'address_contact_id': partner_address_id, |
931 | + 'account_id':receive_account_id, |
932 | + }) |
933 | + |
934 | + # Invoice line |
935 | + self.account_invoice_line.create(self.cr,self.uid, |
936 | + {'name':'Unit Test Invoice Line', |
937 | + 'invoice_id':invoice_id, |
938 | + 'uos_id':product_uom_id, |
939 | + 'product_id':product_id, |
940 | + 'account_id':pay_account_id, |
941 | + 'price_unit':400, |
942 | + 'quantity':10, |
943 | + 'analytics_id':analytic_plan_instance_id}) |
944 | + |
945 | + except osv.except_osv,e: |
946 | + self.fail(e.name + e.value) |
947 | + except Exception,e: |
948 | + self.fail(e) |
949 | + |
950 | + def test_2_CreateInvoice(self): |
951 | + try: |
952 | + self.failUnless(invoice_id,"No Invoice Created !") |
953 | + wf_service = netsvc.LocalService("workflow") |
954 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
955 | + except osv.except_osv,e: |
956 | + self.fail(e.name + e.value) |
957 | + except Exception,e: |
958 | + self.fail(e) |
959 | + |
960 | + def test_3_Unlink(self): |
961 | + try: |
962 | + self.failUnless(invoice_id,"No Invoice Created !") |
963 | + sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')]) |
964 | + self.failUnless(sale_journal,"No sale_journal Found !") |
965 | + sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0] |
966 | + wf_service = netsvc.LocalService("workflow") |
967 | + if not sale_journal_id.update_posted: |
968 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True}) |
969 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
970 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
971 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False}) |
972 | + self.account_analytic_plan_instance.unlink(self.cr,self.uid,[analytic_plan_instance_id]) |
973 | + self.account_analytic_plan.unlink(self.cr,self.uid,[analytic_plan_id]) |
974 | + except osv.except_osv,e: |
975 | + self.fail(e.name + e.value) |
976 | + except Exception,e: |
977 | + self.fail(e) |
978 | + |
979 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
980 | |
981 | === added directory 'account_balance' |
982 | === added directory 'account_balance/unit_test' |
983 | === added file 'account_balance/unit_test/__init__.py' |
984 | --- account_balance/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
985 | +++ account_balance/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
986 | @@ -0,0 +1,22 @@ |
987 | +# -*- coding: utf-8 -*- |
988 | +############################################################################## |
989 | +# |
990 | +# OpenERP, Open Source Management Solution |
991 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
992 | +# |
993 | +# This program is free software: you can redistribute it and/or modify |
994 | +# it under the terms of the GNU Affero General Public License as |
995 | +# published by the Free Software Foundation, either version 3 of the |
996 | +# License, or (at your option) any later version. |
997 | +# |
998 | +# This program is distributed in the hope that it will be useful, |
999 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1000 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1001 | +# GNU Affero General Public License for more details. |
1002 | +# |
1003 | +# You should have received a copy of the GNU Affero General Public License |
1004 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1005 | +# |
1006 | +############################################################################## |
1007 | + |
1008 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1009 | \ No newline at end of file |
1010 | |
1011 | === added file 'account_balance/unit_test/test.py' |
1012 | --- account_balance/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1013 | +++ account_balance/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1014 | @@ -0,0 +1,70 @@ |
1015 | +# -*- coding: utf-8 -*- |
1016 | +############################################################################## |
1017 | +# |
1018 | +# OpenERP, Open Source Management Solution |
1019 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1020 | +# |
1021 | +# This program is free software: you can redistribute it and/or modify |
1022 | +# it under the terms of the GNU Affero General Public License as |
1023 | +# published by the Free Software Foundation, either version 3 of the |
1024 | +# License, or (at your option) any later version. |
1025 | +# |
1026 | +# This program is distributed in the hope that it will be useful, |
1027 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1028 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1029 | +# GNU Affero General Public License for more details. |
1030 | +# |
1031 | +# You should have received a copy of the GNU Affero General Public License |
1032 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1033 | +# |
1034 | +############################################################################## |
1035 | + |
1036 | +import unittest |
1037 | +import pooler |
1038 | +import netsvc |
1039 | +from osv import osv |
1040 | + |
1041 | +class account_balance_test_case(unittest.TestCase): |
1042 | + |
1043 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1044 | + self.cr = cursor |
1045 | + self.uid = user |
1046 | + unittest.TestCase.__init__(self, methodName) |
1047 | + |
1048 | + def setUp(self): |
1049 | + try: |
1050 | + self.pool = pooler.get_pool(self.cr.dbname) |
1051 | + except osv.except_osv,e: |
1052 | + self.fail(e.name + e.value) |
1053 | + except Exception,e: |
1054 | + self.fail(e) |
1055 | + |
1056 | + |
1057 | + def tearDown(self): |
1058 | + try: |
1059 | + self.pool = None |
1060 | + except osv.except_osv,e: |
1061 | + self.fail(e.name + e.value) |
1062 | + except Exception,e: |
1063 | + self.fail(e) |
1064 | + |
1065 | + def test_1_wizard_test(self): |
1066 | + try: |
1067 | + model_obj = self.pool.get('ir.model.data') |
1068 | + account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv') |
1069 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
1070 | + sel_account=model_obj._get_id(self.cr, self.uid, 'account', 'a_pay') |
1071 | + sel_account_id=model_obj.browse(self.cr, self.uid, sel_account).res_id |
1072 | + fiscal_year_ids=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[]) |
1073 | + period_ids=self.pool.get('account.period').search(self.cr,self.uid,[]) |
1074 | + wizard_service = netsvc.ExportService.getService("wizard") |
1075 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.balance.account.balance.report') |
1076 | + datas = {'form': {'fiscalyear':[(6,0,fiscal_year_ids)],'select_account':sel_account_id,'account_choice':'all','show_columns':1,'landscape':1,'format_perc':1,'compare_pattern':'bal_cash','period_manner':'actual','periods':[(6,0,[x for x in period_ids ])]}, 'ids': [account_id], 'id':account_id} |
1077 | + state = 'checkyear' |
1078 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1079 | + except osv.except_osv,e: |
1080 | + self.fail(e.name + e.value) |
1081 | + except Exception,e: |
1082 | + self.fail(e) |
1083 | + |
1084 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1085 | |
1086 | === added directory 'account_budget/unit_test' |
1087 | === added file 'account_budget/unit_test/__init__.py' |
1088 | --- account_budget/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
1089 | +++ account_budget/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
1090 | @@ -0,0 +1,22 @@ |
1091 | +# -*- coding: utf-8 -*- |
1092 | +############################################################################## |
1093 | +# |
1094 | +# OpenERP, Open Source Management Solution |
1095 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1096 | +# |
1097 | +# This program is free software: you can redistribute it and/or modify |
1098 | +# it under the terms of the GNU Affero General Public License as |
1099 | +# published by the Free Software Foundation, either version 3 of the |
1100 | +# License, or (at your option) any later version. |
1101 | +# |
1102 | +# This program is distributed in the hope that it will be useful, |
1103 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1104 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1105 | +# GNU Affero General Public License for more details. |
1106 | +# |
1107 | +# You should have received a copy of the GNU Affero General Public License |
1108 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1109 | +# |
1110 | +############################################################################## |
1111 | + |
1112 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1113 | |
1114 | === added file 'account_budget/unit_test/test.py' |
1115 | --- account_budget/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1116 | +++ account_budget/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1117 | @@ -0,0 +1,199 @@ |
1118 | +# -*- coding: utf-8 -*- |
1119 | +############################################################################## |
1120 | +# |
1121 | +# OpenERP, Open Source Management Solution |
1122 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1123 | +# |
1124 | +# This program is free software: you can redistribute it and/or modify |
1125 | +# it under the terms of the GNU Affero General Public License as |
1126 | +# published by the Free Software Foundation, either version 3 of the |
1127 | +# License, or (at your option) any later version. |
1128 | +# |
1129 | +# This program is distributed in the hope that it will be useful, |
1130 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1131 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1132 | +# GNU Affero General Public License for more details. |
1133 | +# |
1134 | +# You should have received a copy of the GNU Affero General Public License |
1135 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1136 | +# |
1137 | +############################################################################## |
1138 | + |
1139 | +import unittest |
1140 | +import pooler |
1141 | +import netsvc |
1142 | +import time |
1143 | +from osv import osv |
1144 | + |
1145 | +crossovered_budget_id = None |
1146 | +budget_post_id = None |
1147 | +analytic_account_id = None |
1148 | + |
1149 | +class account_budget_test_case(unittest.TestCase): |
1150 | + |
1151 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1152 | + self.cr = cursor |
1153 | + self.uid = user |
1154 | + unittest.TestCase.__init__(self, methodName) |
1155 | + |
1156 | + def setUp(self): |
1157 | + try: |
1158 | + self.pool = pooler.get_pool(self.cr.dbname) |
1159 | + self.account_budget_post=self.pool.get('account.budget.post') |
1160 | + self.crossovered_budget=self.pool.get('crossovered.budget') |
1161 | + self.crossovered_budget_lines=self.pool.get('crossovered.budget.lines') |
1162 | + except osv.except_osv,e: |
1163 | + self.fail(e.name + e.value) |
1164 | + except Exception,e: |
1165 | + self.fail(e) |
1166 | + |
1167 | + def tearDown(self): |
1168 | + try: |
1169 | + self.pool = None |
1170 | + self.account_budget_post=None |
1171 | + self.crossovered_budget=None |
1172 | + self.crossovered_budget_lines=None |
1173 | + except osv.except_osv,e: |
1174 | + self.fail(e.name + e.value) |
1175 | + except Exception,e: |
1176 | + self.fail(e) |
1177 | + |
1178 | + def test_1_Create(self): |
1179 | + |
1180 | + try: |
1181 | + global crossovered_budget_id,budget_post_id, analytic_account_id |
1182 | + model_obj = self.pool.get('ir.model.data') |
1183 | + analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1') |
1184 | + analytic_account_id = model_obj.browse(self.cr, self.uid,analytic_account).res_id |
1185 | + account_ids=self.pool.get('account.account').search(self.cr,self.uid,[]) |
1186 | + |
1187 | + budget_post_id = self.account_budget_post.create(self.cr,self.uid, |
1188 | + {'name':'Receive', |
1189 | + 'code':'REC', |
1190 | + 'account_ids':[(6,0,account_ids)], |
1191 | + }) |
1192 | + crossovered_budget_id=self.crossovered_budget.create(self.cr,self.uid, |
1193 | + {'name':'BUDGET:2009', |
1194 | + 'code':'+2009', |
1195 | + 'creating_user_id':self.uid, |
1196 | + 'validating_user_id':self.uid, |
1197 | + 'date_from':time.strftime('2009-04-01'), |
1198 | + 'date_to':time.strftime('2010-04-01'), |
1199 | + 'state':'draft'}) |
1200 | + crossovered_budget_lines_id=self.crossovered_budget_lines.create(self.cr,self.uid, |
1201 | + {'crossovered_budget_id':crossovered_budget_id, |
1202 | + 'analytic_account_id':analytic_account_id, |
1203 | + 'general_budget_id':budget_post_id, |
1204 | + 'date_from':time.strftime('2009-04-01'), |
1205 | + 'date_to':time.strftime('2010-04-01'), |
1206 | + 'planned_amount':9000.00, |
1207 | + }) |
1208 | + except osv.except_osv,e: |
1209 | + self.fail(e.name + e.value) |
1210 | + except Exception,e: |
1211 | + self.fail(e) |
1212 | + |
1213 | + def test_2_ConfirmBudget(self): |
1214 | + try: |
1215 | + self.failUnless(crossovered_budget_id,"No Budget Created !") |
1216 | + wf_service = netsvc.LocalService("workflow") |
1217 | + res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'confirm', self.cr) |
1218 | + except osv.except_osv,e: |
1219 | + self.fail(e.name + e.value) |
1220 | + except Exception,e: |
1221 | + self.fail(e) |
1222 | + |
1223 | + def test_3_ValidateBudget(self): |
1224 | + try: |
1225 | + self.failUnless(crossovered_budget_id,"No Budget Created !") |
1226 | + wf_service = netsvc.LocalService("workflow") |
1227 | + res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'validate', self.cr) |
1228 | + except osv.except_osv,e: |
1229 | + self.fail(e.name + e.value) |
1230 | + except Exception,e: |
1231 | + self.fail(e) |
1232 | + |
1233 | + def test_4_DoneBudget(self): |
1234 | + try: |
1235 | + self.failUnless(crossovered_budget_id,"No Budget Created !") |
1236 | + wf_service = netsvc.LocalService("workflow") |
1237 | + res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'done', self.cr) |
1238 | + except osv.except_osv,e: |
1239 | + self.fail(e.name + e.value) |
1240 | + except Exception,e: |
1241 | + self.fail(e) |
1242 | + |
1243 | + def test_5_wizard_spread_test(self): |
1244 | + try: |
1245 | + self.cr.commit() |
1246 | + model_obj = self.pool.get('ir.model.data') |
1247 | + fiscal_year=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[]) |
1248 | + fiscal_id = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,fiscal_year)[0] |
1249 | + wizard_service = netsvc.ExportService.getService("wizard") |
1250 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.budget.spread') |
1251 | + datas = {'form': {'fiscalyear':fiscal_id.id,'amount':3600}, 'ids': [budget_post_id],'id':budget_post_id} |
1252 | + state = 'spread' |
1253 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1254 | + except osv.except_osv,e: |
1255 | + self.fail(e.name + e.value) |
1256 | + except Exception,e: |
1257 | + self.fail(e) |
1258 | + |
1259 | + def test_6_wizard_budget_report(self): |
1260 | + try: |
1261 | + self.cr.commit() |
1262 | + model_obj = self.pool.get('ir.model.data') |
1263 | + fiscal_year=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[]) |
1264 | + fiscal_id = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,fiscal_year)[0] |
1265 | + wizard_service = netsvc.ExportService.getService("wizard") |
1266 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.budget.report') |
1267 | + datas = {'form': {'date1':time.strftime('2009-04-01'),'date2':time.strftime('2009-31-01')}, |
1268 | + 'ids': [budget_post_id],'id':budget_post_id} |
1269 | + state = 'report' |
1270 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1271 | + except osv.except_osv,e: |
1272 | + self.fail(e.name + e.value) |
1273 | + except Exception,e: |
1274 | + self.fail(e) |
1275 | + |
1276 | + def test_7_wizard_analytic_budget_report(self): |
1277 | + try: |
1278 | + self.cr.commit() |
1279 | + model_obj = self.pool.get('ir.model.data') |
1280 | + wizard_service = netsvc.ExportService.getService("wizard") |
1281 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.analytic.account.budget.report') |
1282 | + datas = {'form': {'date_from':time.strftime('2009-04-01'),'date_to':time.strftime('2009-31-01'),},'ids': [analytic_account_id],'id':analytic_account_id} |
1283 | + state = 'report' |
1284 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1285 | + except osv.except_osv,e: |
1286 | + self.fail(e.name + e.value) |
1287 | + except Exception,e: |
1288 | + self.fail(e) |
1289 | + |
1290 | + def test_8_wizard_crossovered_budget_summary(self): |
1291 | + try: |
1292 | + self.cr.commit() |
1293 | + model_obj = self.pool.get('ir.model.data') |
1294 | + wizard_service = netsvc.ExportService.getService("wizard") |
1295 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.crossovered.budget.summary') |
1296 | + datas = {'form': {'date_from':time.strftime('2009-04-01'),'date_to':time.strftime('2009-31-01'),}, 'ids': [crossovered_budget_id],'id':crossovered_budget_id} |
1297 | + state = 'report' |
1298 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1299 | + except osv.except_osv,e: |
1300 | + self.fail(e.name + e.value) |
1301 | + except Exception,e: |
1302 | + self.fail(e) |
1303 | + |
1304 | + def test_9_Unlink(self): |
1305 | + try: |
1306 | + self.failUnless(crossovered_budget_id,"No Budget Created !") |
1307 | + self.failUnless(budget_post_id,"No Account Budget post Created !") |
1308 | + self.crossovered_budget.unlink(self.cr, self.uid, [crossovered_budget_id]) |
1309 | + self.account_budget_post.unlink(self.cr, self.uid, [budget_post_id ]) |
1310 | + except osv.except_osv,e: |
1311 | + self.fail(e.name + e.value) |
1312 | + except Exception,e: |
1313 | + self.fail(e) |
1314 | + |
1315 | + |
1316 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1317 | |
1318 | === added directory 'account_date_check/unit_test' |
1319 | === added file 'account_date_check/unit_test/__init__.py' |
1320 | --- account_date_check/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
1321 | +++ account_date_check/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
1322 | @@ -0,0 +1,22 @@ |
1323 | +# -*- coding: utf-8 -*- |
1324 | +############################################################################## |
1325 | +# |
1326 | +# OpenERP, Open Source Management Solution |
1327 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1328 | +# |
1329 | +# This program is free software: you can redistribute it and/or modify |
1330 | +# it under the terms of the GNU Affero General Public License as |
1331 | +# published by the Free Software Foundation, either version 3 of the |
1332 | +# License, or (at your option) any later version. |
1333 | +# |
1334 | +# This program is distributed in the hope that it will be useful, |
1335 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1336 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1337 | +# GNU Affero General Public License for more details. |
1338 | +# |
1339 | +# You should have received a copy of the GNU Affero General Public License |
1340 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1341 | +# |
1342 | +############################################################################## |
1343 | + |
1344 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1345 | \ No newline at end of file |
1346 | |
1347 | === added file 'account_date_check/unit_test/test.py' |
1348 | --- account_date_check/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1349 | +++ account_date_check/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1350 | @@ -0,0 +1,123 @@ |
1351 | +# -*- coding: utf-8 -*- |
1352 | +############################################################################## |
1353 | +# |
1354 | +# OpenERP, Open Source Management Solution |
1355 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1356 | +# |
1357 | +# This program is free software: you can redistribute it and/or modify |
1358 | +# it under the terms of the GNU Affero General Public License as |
1359 | +# published by the Free Software Foundation, either version 3 of the |
1360 | +# License, or (at your option) any later version. |
1361 | +# |
1362 | +# This program is distributed in the hope that it will be useful, |
1363 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1364 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1365 | +# GNU Affero General Public License for more details. |
1366 | +# |
1367 | +# You should have received a copy of the GNU Affero General Public License |
1368 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1369 | +# |
1370 | +############################################################################## |
1371 | + |
1372 | +import unittest |
1373 | +import pooler |
1374 | +import netsvc |
1375 | +from osv import osv |
1376 | +import time |
1377 | + |
1378 | +invoice_id = None |
1379 | +sale_journal_id = None |
1380 | + |
1381 | +class account_date_check_test_case(unittest.TestCase): |
1382 | + |
1383 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1384 | + self.cr = cursor |
1385 | + self.uid = user |
1386 | + unittest.TestCase.__init__(self, methodName) |
1387 | + |
1388 | + def setUp(self): |
1389 | + try: |
1390 | + self.pool = pooler.get_pool(self.cr.dbname) |
1391 | + self.account_invoice=self.pool.get('account.invoice') |
1392 | + self.account_invoice_line=self.pool.get('account.invoice.line') |
1393 | + self.account_journal=self.pool.get('account.journal') |
1394 | + except osv.except_osv,e: |
1395 | + self.fail(e.name + e.value) |
1396 | + except Exception,e: |
1397 | + self.fail(e) |
1398 | + |
1399 | + def tearDown(self): |
1400 | + try: |
1401 | + self.pool = None |
1402 | + self.account_invoice=None |
1403 | + self.account_invoice_line=None |
1404 | + self.account_journal=None |
1405 | + except osv.except_osv,e: |
1406 | + self.fail(e.name + e.value) |
1407 | + except Exception,e: |
1408 | + self.fail(e) |
1409 | + |
1410 | + def test_1_Create(self): |
1411 | + try: |
1412 | + global invoice_id,sale_journal_id |
1413 | + |
1414 | + model_obj = self.pool.get('ir.model.data') |
1415 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2') |
1416 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
1417 | + product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit') |
1418 | + product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id |
1419 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
1420 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
1421 | + partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9') |
1422 | + partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id |
1423 | + sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')]) |
1424 | + sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0] |
1425 | + account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv') |
1426 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
1427 | + |
1428 | + invoice_id=self.account_invoice.create(self.cr,self.uid,{'name':'Unit Test case Invoice', |
1429 | + 'type':'out_invoice', |
1430 | + 'state':'draft', |
1431 | + 'date_invoice':time.strftime('2008-11-01') , |
1432 | + 'partner_id': partner_id, |
1433 | + 'journal_id': sale_journal_id.id, |
1434 | + 'address_invoice_id':partner_invoice_id, |
1435 | + 'account_id':account_id, |
1436 | + 'address_contact_id':partner_invoice_id }) |
1437 | + invoice_line_id=self.account_invoice_line.create(self.cr,self.uid,{'name':'Unit Test Invoice Line', |
1438 | + 'invoice_id':invoice_id, |
1439 | + 'uos_id':product_uom_id, |
1440 | + 'product_id':product_id, |
1441 | + 'account_id':account_id, |
1442 | + 'price_unit':400, |
1443 | + 'quantity':10,}) |
1444 | + except osv.except_osv,e: |
1445 | + self.fail(e.name + e.value) |
1446 | + except Exception,e: |
1447 | + self.fail(e) |
1448 | + |
1449 | + def test_2_CreateInvoice(self): |
1450 | + try: |
1451 | + self.failUnless(invoice_id,"No Invoice Created !") |
1452 | + wf_service = netsvc.LocalService("workflow") |
1453 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
1454 | + except osv.except_osv,e: |
1455 | + self.fail(e.name + e.value) |
1456 | + except Exception,e: |
1457 | + self.fail(e) |
1458 | + |
1459 | + def test_3_UnlinkInvoice(self): |
1460 | + try: |
1461 | + self.failUnless(invoice_id,"No Invoice Created !") |
1462 | + wf_service = netsvc.LocalService("workflow") |
1463 | + if not sale_journal_id.update_posted: |
1464 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True}) |
1465 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
1466 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
1467 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False}) |
1468 | + except osv.except_osv,e: |
1469 | + self.fail(e.name + e.value) |
1470 | + except Exception,e: |
1471 | + self.fail(e) |
1472 | + |
1473 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1474 | |
1475 | === added directory 'account_followup/unit_test' |
1476 | === added file 'account_followup/unit_test/__init__.py' |
1477 | --- account_followup/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
1478 | +++ account_followup/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
1479 | @@ -0,0 +1,22 @@ |
1480 | +# -*- coding: utf-8 -*- |
1481 | +############################################################################## |
1482 | +# |
1483 | +# OpenERP, Open Source Management Solution |
1484 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1485 | +# |
1486 | +# This program is free software: you can redistribute it and/or modify |
1487 | +# it under the terms of the GNU Affero General Public License as |
1488 | +# published by the Free Software Foundation, either version 3 of the |
1489 | +# License, or (at your option) any later version. |
1490 | +# |
1491 | +# This program is distributed in the hope that it will be useful, |
1492 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1493 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1494 | +# GNU Affero General Public License for more details. |
1495 | +# |
1496 | +# You should have received a copy of the GNU Affero General Public License |
1497 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1498 | +# |
1499 | +############################################################################## |
1500 | + |
1501 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1502 | \ No newline at end of file |
1503 | |
1504 | === added file 'account_followup/unit_test/test.py' |
1505 | --- account_followup/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1506 | +++ account_followup/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1507 | @@ -0,0 +1,171 @@ |
1508 | +# -*- coding: utf-8 -*- |
1509 | +############################################################################## |
1510 | +# |
1511 | +# OpenERP, Open Source Management Solution |
1512 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1513 | +# |
1514 | +# This program is free software: you can redistribute it and/or modify |
1515 | +# it under the terms of the GNU Affero General Public License as |
1516 | +# published by the Free Software Foundation, either version 3 of the |
1517 | +# License, or (at your option) any later version. |
1518 | +# |
1519 | +# This program is distributed in the hope that it will be useful, |
1520 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1521 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1522 | +# GNU Affero General Public License for more details. |
1523 | +# |
1524 | +# You should have received a copy of the GNU Affero General Public License |
1525 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1526 | +# |
1527 | +############################################################################## |
1528 | + |
1529 | +import unittest |
1530 | +import pooler |
1531 | +import netsvc |
1532 | +from osv import osv |
1533 | +import time |
1534 | + |
1535 | +followup_id = None |
1536 | +invoice_id = None |
1537 | +partner_id = None |
1538 | +sale_journal_id = None |
1539 | + |
1540 | +class account_followup_test_case(unittest.TestCase): |
1541 | + |
1542 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1543 | + self.cr = cursor |
1544 | + self.uid = user |
1545 | + unittest.TestCase.__init__(self, methodName) |
1546 | + |
1547 | + def setUp(self): |
1548 | + try: |
1549 | + self.pool = pooler.get_pool(self.cr.dbname) |
1550 | + self.account_invoice=self.pool.get('account.invoice') |
1551 | + self.account_invoice_line=self.pool.get('account.invoice.line') |
1552 | + self.account_followup_followup=self.pool.get('account_followup.followup') |
1553 | + self.account_followup_followup_line=self.pool.get('account_followup.followup.line') |
1554 | + except osv.except_osv,e: |
1555 | + self.fail(e.name + e.value) |
1556 | + except Exception,e: |
1557 | + self.fail(e) |
1558 | + |
1559 | + |
1560 | + def tearDown(self): |
1561 | + try: |
1562 | + self.pool = None |
1563 | + self.account_invoice=None |
1564 | + self.account_invoice_line=None |
1565 | + self.account_followup_followup=None |
1566 | + self.account_followup_followup_line=None |
1567 | + except osv.except_osv,e: |
1568 | + self.fail(e.name + e.value) |
1569 | + except Exception,e: |
1570 | + self.fail(e) |
1571 | + |
1572 | + |
1573 | + |
1574 | + def test_1_Create(self): |
1575 | + try: |
1576 | + global invoice_id,followup_id,partner_id,sale_journal_id |
1577 | + |
1578 | + model_obj = self.pool.get('ir.model.data') |
1579 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2') |
1580 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
1581 | + product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit') |
1582 | + product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id |
1583 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
1584 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
1585 | + partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9') |
1586 | + partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id |
1587 | + company = self.pool.get('res.company').search(self.cr,self.uid,[]) |
1588 | + company_id = self.pool.get('res.company').browse(self.cr,self.uid,company)[0] |
1589 | + sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')]) |
1590 | + sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0] |
1591 | + account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv') |
1592 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
1593 | + |
1594 | + invoice_id = self.account_invoice.create(self.cr,self.uid, |
1595 | + {'name':'Unit Test case Invoice', |
1596 | + 'type':'out_invoice', |
1597 | + 'state':'draft', |
1598 | + 'partner_id': partner_id, |
1599 | + 'journal_id': sale_journal_id.id, |
1600 | + 'address_invoice_id':partner_invoice_id, |
1601 | + 'account_id':account_id, |
1602 | + 'address_contact_id':partner_invoice_id }) |
1603 | + |
1604 | + self.account_invoice_line.create(self.cr,self.uid, |
1605 | + {'name':'Unit Test Invoice Line', |
1606 | + 'invoice_id':invoice_id, |
1607 | + 'uos_id':product_uom_id, |
1608 | + 'product_id':product_id, |
1609 | + 'account_id':account_id, |
1610 | + 'price_unit':400, |
1611 | + 'quantity':10,}) |
1612 | + |
1613 | + followup_id = self.account_followup_followup.create(self.cr,self.uid, |
1614 | + {'name':'Follow-up 1', |
1615 | + 'description':'This is Unit test followup', |
1616 | + 'company_id':company_id.id,}) |
1617 | + for i in range(0,2): |
1618 | + self.account_followup_followup_line.create(self.cr,self.uid, |
1619 | + {'name':'Level : follow-up-line %s'%(i+1), |
1620 | + 'delay':15 * i+1, |
1621 | + 'start':'days', |
1622 | + 'followup_id':followup_id, |
1623 | + 'description':'description %s'%(i+1), |
1624 | + 'sequence':i}) |
1625 | + except osv.except_osv,e: |
1626 | + self.fail(e.name + e.value) |
1627 | + except Exception,e: |
1628 | + self.fail(e) |
1629 | + |
1630 | + def test_2_CreateInvoice(self): |
1631 | + try: |
1632 | + self.failUnless(invoice_id,"No Invoice Created !") |
1633 | + wf_service = netsvc.LocalService("workflow") |
1634 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
1635 | + except osv.except_osv,e: |
1636 | + self.fail(e.name + e.value) |
1637 | + except Exception,e: |
1638 | + self.fail(e) |
1639 | + |
1640 | + def test_3_SendFollowups(self): |
1641 | + try: |
1642 | + self.cr.commit() |
1643 | + self.failUnless(invoice_id,"No Invoice Created !") |
1644 | + wizard_service = netsvc.ExportService.getService("wizard") |
1645 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account_followup.followup.print.all') |
1646 | + datas = {'form': {}, 'ids': [followup_id],'id': followup_id} |
1647 | + state = 'init' |
1648 | + while state != 'end': |
1649 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1650 | + if 'datas' in res: |
1651 | + datas['form'].update(res['datas']) |
1652 | + if res['type']=='form': |
1653 | + for field in res['fields'].keys(): |
1654 | + datas['form'][field] = datas['form'].get(field,False) |
1655 | + state = res['state'][-1][0] |
1656 | + elif res['type'] in ('state','print'): |
1657 | + state = res['state'] |
1658 | + except osv.except_osv,e: |
1659 | + self.fail(e.name + e.value) |
1660 | + except Exception,e: |
1661 | + self.fail(e) |
1662 | + |
1663 | + def test_4_Unlink(self): |
1664 | + try: |
1665 | + self.failUnless(followup_id,"No followup Created !") |
1666 | + self.account_followup_followup.unlink(self.cr,self.uid,[followup_id]) |
1667 | + wf_service = netsvc.LocalService("workflow") |
1668 | + if not sale_journal_id.update_posted: |
1669 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True}) |
1670 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
1671 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
1672 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False}) |
1673 | + except osv.except_osv,e: |
1674 | + self.fail(e.name + e.value) |
1675 | + except Exception,e: |
1676 | + self.fail(e) |
1677 | + |
1678 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1679 | |
1680 | === added directory 'account_invoice_layout/unit_test' |
1681 | === added file 'account_invoice_layout/unit_test/__init__.py' |
1682 | --- account_invoice_layout/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
1683 | +++ account_invoice_layout/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
1684 | @@ -0,0 +1,22 @@ |
1685 | +# -*- coding: utf-8 -*- |
1686 | +############################################################################## |
1687 | +# |
1688 | +# OpenERP, Open Source Management Solution |
1689 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1690 | +# |
1691 | +# This program is free software: you can redistribute it and/or modify |
1692 | +# it under the terms of the GNU Affero General Public License as |
1693 | +# published by the Free Software Foundation, either version 3 of the |
1694 | +# License, or (at your option) any later version. |
1695 | +# |
1696 | +# This program is distributed in the hope that it will be useful, |
1697 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1698 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1699 | +# GNU Affero General Public License for more details. |
1700 | +# |
1701 | +# You should have received a copy of the GNU Affero General Public License |
1702 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1703 | +# |
1704 | +############################################################################## |
1705 | + |
1706 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1707 | \ No newline at end of file |
1708 | |
1709 | === added file 'account_invoice_layout/unit_test/test.py' |
1710 | --- account_invoice_layout/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1711 | +++ account_invoice_layout/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1712 | @@ -0,0 +1,153 @@ |
1713 | +# -*- coding: utf-8 -*- |
1714 | +############################################################################## |
1715 | +# |
1716 | +# OpenERP, Open Source Management Solution |
1717 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1718 | +# |
1719 | +# This program is free software: you can redistribute it and/or modify |
1720 | +# it under the terms of the GNU Affero General Public License as |
1721 | +# published by the Free Software Foundation, either version 3 of the |
1722 | +# License, or (at your option) any later version. |
1723 | +# |
1724 | +# This program is distributed in the hope that it will be useful, |
1725 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1726 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1727 | +# GNU Affero General Public License for more details. |
1728 | +# |
1729 | +# You should have received a copy of the GNU Affero General Public License |
1730 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1731 | +# |
1732 | +############################################################################## |
1733 | + |
1734 | +import unittest |
1735 | +import pooler |
1736 | +import netsvc |
1737 | +from osv import osv |
1738 | + |
1739 | +message_id = None |
1740 | +invoice_id = None |
1741 | +journal_id = None |
1742 | + |
1743 | +class account_invoice_layout_test_case(unittest.TestCase): |
1744 | + |
1745 | + |
1746 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1747 | + self.cr = cursor |
1748 | + self.uid = user |
1749 | + unittest.TestCase.__init__(self, methodName) |
1750 | + |
1751 | + def setUp(self): |
1752 | + try: |
1753 | + self.pool = pooler.get_pool(self.cr.dbname) |
1754 | + self.notify_message=self.pool.get('notify.message') |
1755 | + self.account_invoice=self.pool.get('account.invoice') |
1756 | + self.account_invoice_line=self.pool.get('account.invoice.line') |
1757 | + self.account_journal=self.pool.get('account.journal') |
1758 | + except osv.except_osv,e: |
1759 | + self.fail(e.name + e.value) |
1760 | + except Exception,e: |
1761 | + self.fail(e) |
1762 | + |
1763 | + |
1764 | + def tearDown(self): |
1765 | + try: |
1766 | + self.pool = None |
1767 | + self.notify_message=None |
1768 | + self.account_invoice=None |
1769 | + self.account_invoice_line=None |
1770 | + self.account_journal=None |
1771 | + except osv.except_osv,e: |
1772 | + self.fail(e.name + e.value) |
1773 | + except Exception,e: |
1774 | + self.fail(e) |
1775 | + |
1776 | + def test_1_Create(self): |
1777 | + try: |
1778 | + global message_id,invoice_id,journal_id |
1779 | + model_obj = self.pool.get('ir.model.data') |
1780 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2') |
1781 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
1782 | + product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit') |
1783 | + product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id |
1784 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
1785 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
1786 | + partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9') |
1787 | + partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id |
1788 | + journal = model_obj._get_id(self.cr,self.uid, 'account', 'sales_journal') |
1789 | + journal_id = model_obj.browse(self.cr, self.uid, journal).res_id |
1790 | + account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv') |
1791 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
1792 | + |
1793 | + invoice_id=self.account_invoice.create(self.cr,self.uid,{'name':'Unit Test case Invoice', |
1794 | + 'type':'out_invoice', |
1795 | + 'state':'draft', |
1796 | + 'partner_id': partner_id, |
1797 | + 'journal_id': journal_id, |
1798 | + 'address_invoice_id':partner_invoice_id, |
1799 | + 'account_id':account_id, |
1800 | + 'address_contact_id':partner_invoice_id }) |
1801 | + |
1802 | + |
1803 | + invoice_line_id=self.account_invoice_line.create(self.cr,self.uid,{'name':'Unit Test Invoice Line', |
1804 | + 'invoice_id':invoice_id, |
1805 | + 'uos_id':product_uom_id, |
1806 | + 'product_id':product_id, |
1807 | + 'account_id':account_id, |
1808 | + 'price_unit':400, |
1809 | + 'quantity':10,}) |
1810 | + message_id= self.notify_message.create(self.cr,self.uid,{'name':'NEW MESSAGE','msg':'THIS IS A NEW MESSAGE'}) |
1811 | + except osv.except_osv,e: |
1812 | + self.fail(e.name + e.value) |
1813 | + except Exception,e: |
1814 | + self.fail(e) |
1815 | + |
1816 | + def test_2_CreateInvoice(self): |
1817 | + try: |
1818 | + self.failUnless(invoice_id,"No Invoice Created !") |
1819 | + wf_service = netsvc.LocalService("workflow") |
1820 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
1821 | + except osv.except_osv,e: |
1822 | + self.fail(e.name + e.value) |
1823 | + except Exception,e: |
1824 | + self.fail(e) |
1825 | + |
1826 | + def test_3_wizard_test(self): |
1827 | + try: |
1828 | + self.failUnless(message_id,"No Message Created !") |
1829 | + wizard_service = netsvc.ExportService.getService("wizard") |
1830 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.notify_message') |
1831 | + datas = {'form': {'message':message_id}, 'ids': [invoice_id], 'id':invoice_id} |
1832 | + state = 'print' |
1833 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
1834 | + except osv.except_osv,e: |
1835 | + self.fail(e.name + e.value) |
1836 | + except Exception,e: |
1837 | + self.fail(e) |
1838 | + |
1839 | + def test_4_layout_report(self): |
1840 | + try: |
1841 | + self.failUnless(message_id,"No Message Created !") |
1842 | + report_service = netsvc.ExportService.getService('report') |
1843 | + report_service.exp_report(self.cr.dbname, self.uid, 'account.invoice', [invoice_id]) |
1844 | + except osv.except_osv,e: |
1845 | + self.fail(e.name + e.value) |
1846 | + except Exception,e: |
1847 | + self.fail(e) |
1848 | + |
1849 | + def test_5_Unlink_layout(self): |
1850 | + try: |
1851 | + self.failUnless(message_id,"No Message Created !") |
1852 | + self.failUnless(journal_id,"No Journal Created !") |
1853 | + self.notify_message.unlink(self.cr, self.uid, [message_id]) |
1854 | + sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,journal_id) |
1855 | + wf_service = netsvc.LocalService("workflow") |
1856 | + if not sale_journal.update_posted: |
1857 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True}) |
1858 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
1859 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
1860 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':False}) |
1861 | + except osv.except_osv,e: |
1862 | + self.fail(e.name + e.value) |
1863 | + except Exception,e: |
1864 | + self.fail(e) |
1865 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1866 | |
1867 | === added directory 'account_payment/unit_test' |
1868 | === added file 'account_payment/unit_test/__init__.py' |
1869 | --- account_payment/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
1870 | +++ account_payment/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
1871 | @@ -0,0 +1,22 @@ |
1872 | +# -*- coding: utf-8 -*- |
1873 | +############################################################################## |
1874 | +# |
1875 | +# OpenERP, Open Source Management Solution |
1876 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1877 | +# |
1878 | +# This program is free software: you can redistribute it and/or modify |
1879 | +# it under the terms of the GNU Affero General Public License as |
1880 | +# published by the Free Software Foundation, either version 3 of the |
1881 | +# License, or (at your option) any later version. |
1882 | +# |
1883 | +# This program is distributed in the hope that it will be useful, |
1884 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1885 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1886 | +# GNU Affero General Public License for more details. |
1887 | +# |
1888 | +# You should have received a copy of the GNU Affero General Public License |
1889 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1890 | +# |
1891 | +############################################################################## |
1892 | + |
1893 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1894 | \ No newline at end of file |
1895 | |
1896 | === added file 'account_payment/unit_test/test.py' |
1897 | --- account_payment/unit_test/test.py 1970-01-01 00:00:00 +0000 |
1898 | +++ account_payment/unit_test/test.py 2010-03-08 07:28:31 +0000 |
1899 | @@ -0,0 +1,227 @@ |
1900 | +# -*- coding: utf-8 -*- |
1901 | +############################################################################## |
1902 | +# |
1903 | +# OpenERP, Open Source Management Solution |
1904 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1905 | +# |
1906 | +# This program is free software: you can redistribute it and/or modify |
1907 | +# it under the terms of the GNU Affero General Public License as |
1908 | +# published by the Free Software Foundation, either version 3 of the |
1909 | +# License, or (at your option) any later version. |
1910 | +# |
1911 | +# This program is distributed in the hope that it will be useful, |
1912 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1913 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1914 | +# GNU Affero General Public License for more details. |
1915 | +# |
1916 | +# You should have received a copy of the GNU Affero General Public License |
1917 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1918 | +# |
1919 | +############################################################################## |
1920 | +import unittest |
1921 | +import pooler |
1922 | +import netsvc |
1923 | +from osv import osv |
1924 | +import time |
1925 | + |
1926 | +bank_id = None |
1927 | +bank_type_id = None |
1928 | +payment_type_id = None |
1929 | +payment_mode_id = None |
1930 | +partner_bank_id = None |
1931 | +invoice_id = None |
1932 | +invoice_line_id = None |
1933 | +payment_order_id = None |
1934 | + |
1935 | +class account_payment_test_case(unittest.TestCase): |
1936 | + |
1937 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
1938 | + self.cr = cursor |
1939 | + self.uid = user |
1940 | + unittest.TestCase.__init__(self, methodName) |
1941 | + |
1942 | + def setUp(self): |
1943 | + try: |
1944 | + self.pool = pooler.get_pool(self.cr.dbname) |
1945 | + self.payment_type = self.pool.get('payment.type') |
1946 | + self.payment_order = self.pool.get('payment.order') |
1947 | + self.res_partner_bank_type_fields = self.pool.get('res.partner.bank.type.field') |
1948 | + self.res_partner_bank_type = self.pool.get('res.partner.bank.type') |
1949 | + self.payment_mode = self.pool.get('payment.mode') |
1950 | + self.res_partner_bank = self.pool.get('res.partner.bank') |
1951 | + self.res_bank = self.pool.get('res.bank') |
1952 | + self.account_invoice = self.pool.get('account.invoice') |
1953 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
1954 | + except osv.except_osv,e: |
1955 | + self.fail(e.name + e.value) |
1956 | + except Exception,e: |
1957 | + self.fail(e) |
1958 | + |
1959 | + def tearDown(self): |
1960 | + try: |
1961 | + self.payment_type = None |
1962 | + self.res_partner_bank_type_fields = None |
1963 | + self.res_partner_bank_type = None |
1964 | + self.payment_mode = None |
1965 | + self.res_partner_bank = None |
1966 | + self.res_bank = None |
1967 | + self.account_invoice = None |
1968 | + self.account_invoice_line = None |
1969 | + except osv.except_osv,e: |
1970 | + self.fail(e.name + e.value) |
1971 | + except Exception,e: |
1972 | + self.fail(e) |
1973 | + |
1974 | + def test_1_create(self): |
1975 | + try: |
1976 | + global bank_type_id,payment_type_id,payment_mode_id,bank_id,invoice_id,invoice_line_id,payment_order_id,res |
1977 | + |
1978 | + model_obj = self.pool.get('ir.model.data') |
1979 | + journal = model_obj._get_id(self.cr, self.uid, 'account', 'bank_journal') |
1980 | + journal_id = model_obj.browse(self.cr, self.uid,journal).res_id |
1981 | + |
1982 | + # Partner |
1983 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
1984 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
1985 | + |
1986 | + # Partners address |
1987 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1') |
1988 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
1989 | + |
1990 | + # Account |
1991 | + receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv') |
1992 | + receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id |
1993 | + account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay') |
1994 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
1995 | + # Product |
1996 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1') |
1997 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
1998 | + |
1999 | + # Bank |
2000 | + bank_id = self.res_bank.create(self.cr,self.uid,{'name':'IDBI Bank'}) |
2001 | + bank_type_id = self.res_partner_bank_type.create(self.cr,self.uid,{'name':'Industrial Bank','code':'industry'}) |
2002 | + |
2003 | + partner_bank_id = self.res_partner_bank.create(self.cr,self.uid,{'name':'HSBC Bank','acc_number':'78453621254', |
2004 | + 'state':'industry','partner_id':partner_id, |
2005 | + 'bank':bank_id}) |
2006 | + # Payment Type |
2007 | + payment_type_id = self.payment_type.create(self.cr,self.uid,{'name':'My payment mode', |
2008 | + 'code':'mypayment', |
2009 | + 'suitable_bank_types':[(6,0,[bank_type_id])]}) |
2010 | + # Payment Mode |
2011 | + payment_mode_id = self.payment_mode.create(self.cr,self.uid,{'name':'My Payment Mode','bank_id':partner_bank_id, |
2012 | + 'journal':journal_id,'type':payment_type_id}) |
2013 | + # Invoice |
2014 | + invoice_id = self.account_invoice.create(self.cr,self.uid, |
2015 | + {'name': 'Unit Test case Invoice', |
2016 | + 'type': 'out_invoice', |
2017 | + 'partner_id': partner_id, |
2018 | + 'address_invoice_id': partner_address_id, |
2019 | + 'address_contact_id': partner_address_id, |
2020 | + 'account_id':receive_account_id, |
2021 | + }) |
2022 | + # Invoice line |
2023 | + invoice_line_id = self.account_invoice_line.create(self.cr,self.uid, |
2024 | + {'name' :'Unit Test Invoice Line', |
2025 | + 'invoice_id':invoice_id, |
2026 | + 'account_id':account_id, |
2027 | + 'product_id':product_id, |
2028 | + 'price_unit':500 , |
2029 | + 'quantity':5 |
2030 | + }) |
2031 | + except osv.except_osv,e: |
2032 | + self.fail(e.name + e.value) |
2033 | + except Exception,e: |
2034 | + self.fail(e) |
2035 | + |
2036 | + def test_2_InvoiceCreate(self): |
2037 | + try: |
2038 | + self.failUnless(invoice_id,"No Invoice Created !") |
2039 | + wf_service = netsvc.LocalService("workflow") |
2040 | + res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_open', self.cr) |
2041 | + except osv.except_osv,e: |
2042 | + self.fail(e.name + e.value) |
2043 | + except Exception,e: |
2044 | + self.fail(e) |
2045 | + |
2046 | + def test_3_CreatePaymentOrder(self): |
2047 | + try: |
2048 | + global payment_order_id |
2049 | + payment_order_id = self.payment_order.create(self.cr,self.uid,{'mode':payment_type_id}) |
2050 | + line = self.pool.get('account.move.line').search(self.cr,self.uid,[('name','=','Unit Test Invoice Line')]) |
2051 | + self.cr.commit() |
2052 | + self.failUnless(payment_order_id,"No Case Stage Created !") |
2053 | + wizard_service = netsvc.ExportService.getService("wizard") |
2054 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'populate_payment') |
2055 | + datas = {'form': {'duedate': time.strftime('%Y-%m-%d'), 'entries': [[6, 0, line]]}, 'ids': [payment_order_id], 'id': payment_order_id} |
2056 | + state = 'create' |
2057 | + res3 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
2058 | + except osv.except_osv,e: |
2059 | + self.fail(e.name + e.value) |
2060 | + except Exception,e: |
2061 | + self.fail(e) |
2062 | + |
2063 | + def test_4_ConfirmPayment(self): |
2064 | + try: |
2065 | + self.failUnless(payment_order_id,"No Payment Order Created !") |
2066 | + wf_service = netsvc.LocalService("workflow") |
2067 | + res = wf_service.trg_validate(self.uid, 'payment.order',payment_order_id, 'open', self.cr) |
2068 | + except osv.except_osv,e: |
2069 | + self.fail(e.name + e.value) |
2070 | + except Exception,e: |
2071 | + self.fail(e) |
2072 | + |
2073 | + def test_5_MakePayment(self): |
2074 | + try: |
2075 | + self.cr.commit() |
2076 | + self.failUnless(payment_order_id,"No Payment Order Created !") |
2077 | + wizard_service = netsvc.ExportService.getService("wizard") |
2078 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'pay_payment') |
2079 | + datas = {'model': 'payment.order', 'form': {}, 'id': payment_order_id, 'ids': [payment_order_id]} |
2080 | + state = 'init' |
2081 | + res3 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
2082 | + except osv.except_osv,e: |
2083 | + self.fail(e.name + e.value) |
2084 | + except Exception,e: |
2085 | + self.fail(e) |
2086 | + |
2087 | + def test_6_PrintOrder(self): |
2088 | + try: |
2089 | + self.failUnless(payment_order_id,"No Payment Order Created !") |
2090 | + report_service = netsvc.ExportService.getService('report') |
2091 | + report_service.exp_report(self.cr.dbname, self.uid, 'payment.order', [payment_order_id]) |
2092 | + except osv.except_osv,e: |
2093 | + self.fail(e.name + e.value) |
2094 | + except Exception,e: |
2095 | + self.fail(e) |
2096 | + |
2097 | + def test_7_UnlinkPaymentOrder(self): |
2098 | + try: |
2099 | + self.failUnless(payment_order_id,"No Payment Order Created !") |
2100 | + self.payment_order.unlink(self.cr,self.uid,[payment_order_id]) |
2101 | + self.payment_mode.unlink(self.cr,self.uid,[payment_mode_id]) |
2102 | + self.payment_type.unlink(self.cr,self.uid,[payment_type_id]) |
2103 | + self.res_partner_bank.unlink(self.cr,self.uid,[partner_bank_id]) |
2104 | + self.res_partner_bank_type.unlink(self.cr,self.uid,[bank_type_id]) |
2105 | + self.res_bank.unlink(self.cr,self.uid,[bank_id]) |
2106 | + except osv.except_osv,e: |
2107 | + self.fail(e.name + e.value) |
2108 | + except Exception,e: |
2109 | + self.fail(e) |
2110 | + |
2111 | + def test_8_UnlinkInvoice(self): |
2112 | + try: |
2113 | + sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')]) |
2114 | + sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0] |
2115 | + wf_service = netsvc.LocalService("workflow") |
2116 | + if not sale_journal_id.update_posted: |
2117 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True}) |
2118 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
2119 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
2120 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False}) |
2121 | + except osv.except_osv,e: |
2122 | + self.fail(e.name + e.value) |
2123 | + except Exception,e: |
2124 | + self.fail(e) |
2125 | + |
2126 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2127 | |
2128 | === added directory 'account_report/unit_test' |
2129 | === added file 'account_report/unit_test/__init__.py' |
2130 | --- account_report/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2131 | +++ account_report/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2132 | @@ -0,0 +1,22 @@ |
2133 | +# -*- coding: utf-8 -*- |
2134 | +############################################################################## |
2135 | +# |
2136 | +# OpenERP, Open Source Management Solution |
2137 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2138 | +# |
2139 | +# This program is free software: you can redistribute it and/or modify |
2140 | +# it under the terms of the GNU Affero General Public License as |
2141 | +# published by the Free Software Foundation, either version 3 of the |
2142 | +# License, or (at your option) any later version. |
2143 | +# |
2144 | +# This program is distributed in the hope that it will be useful, |
2145 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2146 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2147 | +# GNU Affero General Public License for more details. |
2148 | +# |
2149 | +# You should have received a copy of the GNU Affero General Public License |
2150 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2151 | +# |
2152 | +############################################################################## |
2153 | + |
2154 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2155 | \ No newline at end of file |
2156 | |
2157 | === added file 'account_report/unit_test/test.py' |
2158 | --- account_report/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2159 | +++ account_report/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2160 | @@ -0,0 +1,89 @@ |
2161 | +# -*- coding: utf-8 -*- |
2162 | +############################################################################## |
2163 | +# |
2164 | +# OpenERP, Open Source Management Solution |
2165 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2166 | +# |
2167 | +# This program is free software: you can redistribute it and/or modify |
2168 | +# it under the terms of the GNU Affero General Public License as |
2169 | +# published by the Free Software Foundation, either version 3 of the |
2170 | +# License, or (at your option) any later version. |
2171 | +# |
2172 | +# This program is distributed in the hope that it will be useful, |
2173 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2174 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2175 | +# GNU Affero General Public License for more details. |
2176 | +# |
2177 | +# You should have received a copy of the GNU Affero General Public License |
2178 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2179 | +# |
2180 | +############################################################################## |
2181 | +import unittest |
2182 | +import pooler |
2183 | +from osv import osv |
2184 | +import netsvc |
2185 | + |
2186 | +account_report_report_id = None |
2187 | + |
2188 | +class account(unittest.TestCase): |
2189 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2190 | + self.cr = cursor |
2191 | + self.uid = user |
2192 | + unittest.TestCase.__init__(self, methodName) |
2193 | + |
2194 | + def setUp(self): |
2195 | + try: |
2196 | + self.pool = pooler.get_pool(self.cr.dbname) |
2197 | + self.account_account_report = self.pool.get('account.report.report') |
2198 | + except osv.except_osv,e: |
2199 | + self.fail(e.name + e.value) |
2200 | + except Exception,e: |
2201 | + self.fail(e) |
2202 | + |
2203 | + def tearDown(self): |
2204 | + try: |
2205 | + self.pool = None |
2206 | + self.account_account_report = None |
2207 | + except osv.except_osv,e: |
2208 | + self.fail(e.name + e.value) |
2209 | + except Exception,e: |
2210 | + self.fail(e) |
2211 | + |
2212 | + def test_1_creat_custom_report(self): |
2213 | + try: |
2214 | + global account_report_report_id |
2215 | + account_report_report_id = self.account_account_report.create(self.cr,self.uid,{ |
2216 | + 'name':'Unit test of account report', |
2217 | + 'code':'TEST', |
2218 | + 'goodness_limit':-100, |
2219 | + 'badness_limit':-100, |
2220 | + 'expression':'credit([\'x 40000\'],Fiscal Year 2009)', |
2221 | + 'disp_tree':True, |
2222 | + 'disp_graph':True |
2223 | + }) |
2224 | + except osv.except_osv,e: |
2225 | + self.fail(e.name + e.value) |
2226 | + except Exception,e: |
2227 | + self.fail(e) |
2228 | + |
2229 | + def test_2_print_report(self): |
2230 | + try: |
2231 | + self.cr.commit() |
2232 | + self.failUnless(account_report_report_id,"No custom report created !") |
2233 | + report_service = netsvc.ExportService.getService('report') |
2234 | + report_service.exp_report(self.cr.dbname, self.uid, "accounting.report", [account_report_report_id]) |
2235 | + except osv.except_osv,e: |
2236 | + self.fail(e.name + e.value) |
2237 | + except Exception,e: |
2238 | + self.fail(e) |
2239 | + |
2240 | + def test_2_unlink_custom_report(self): |
2241 | + try: |
2242 | + self.failUnless(account_report_report_id,"No custome report created !") |
2243 | + self.account_account_report.unlink(self.cr,self.uid,[account_report_report_id]) |
2244 | + except osv.except_osv,e: |
2245 | + self.fail(e.name + e.value) |
2246 | + except Exception,e: |
2247 | + self.fail(e) |
2248 | + |
2249 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2250 | |
2251 | === added directory 'account_reporting/unit_test' |
2252 | === added file 'account_reporting/unit_test/__init__.py' |
2253 | --- account_reporting/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2254 | +++ account_reporting/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2255 | @@ -0,0 +1,22 @@ |
2256 | +# -*- coding: utf-8 -*- |
2257 | +############################################################################## |
2258 | +# |
2259 | +# OpenERP, Open Source Management Solution |
2260 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2261 | +# |
2262 | +# This program is free software: you can redistribute it and/or modify |
2263 | +# it under the terms of the GNU Affero General Public License as |
2264 | +# published by the Free Software Foundation, either version 3 of the |
2265 | +# License, or (at your option) any later version. |
2266 | +# |
2267 | +# This program is distributed in the hope that it will be useful, |
2268 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2269 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2270 | +# GNU Affero General Public License for more details. |
2271 | +# |
2272 | +# You should have received a copy of the GNU Affero General Public License |
2273 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2274 | +# |
2275 | +############################################################################## |
2276 | + |
2277 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2278 | \ No newline at end of file |
2279 | |
2280 | === added file 'account_reporting/unit_test/test.py' |
2281 | --- account_reporting/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2282 | +++ account_reporting/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2283 | @@ -0,0 +1,99 @@ |
2284 | +# -*- coding: utf-8 -*- |
2285 | +############################################################################## |
2286 | +# |
2287 | +# OpenERP, Open Source Management Solution |
2288 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2289 | +# |
2290 | +# This program is free software: you can redistribute it and/or modify |
2291 | +# it under the terms of the GNU Affero General Public License as |
2292 | +# published by the Free Software Foundation, either version 3 of the |
2293 | +# License, or (at your option) any later version. |
2294 | +# |
2295 | +# This program is distributed in the hope that it will be useful, |
2296 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2297 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2298 | +# GNU Affero General Public License for more details. |
2299 | +# |
2300 | +# You should have received a copy of the GNU Affero General Public License |
2301 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2302 | +# |
2303 | +############################################################################## |
2304 | + |
2305 | +import unittest |
2306 | +import pooler |
2307 | +import netsvc |
2308 | +from osv import osv |
2309 | + |
2310 | +report_bs_id = None |
2311 | +period_id = None |
2312 | + |
2313 | +class account_reporting_test_case(unittest.TestCase): |
2314 | + |
2315 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2316 | + self.cr = cursor |
2317 | + self.uid = user |
2318 | + unittest.TestCase.__init__(self, methodName) |
2319 | + |
2320 | + def setUp(self): |
2321 | + try: |
2322 | + self.pool = pooler.get_pool(self.cr.dbname) |
2323 | + self.account_report_bs = self.pool.get('account.report.bs') |
2324 | + except osv.except_osv,e: |
2325 | + self.fail(e.name + e.value) |
2326 | + except Exception,e: |
2327 | + self.fail(e) |
2328 | + |
2329 | + def tearDown(self): |
2330 | + try: |
2331 | + self.pool = None |
2332 | + self.account_report_bs = None |
2333 | + except osv.except_osv,e: |
2334 | + self.fail(e.name + e.value) |
2335 | + except Exception,e: |
2336 | + self.fail(e) |
2337 | + |
2338 | + def test_1_Create(self): |
2339 | + try: |
2340 | + global report_bs_id,period_id |
2341 | + |
2342 | + model_obj = self.pool.get('ir.model.data') |
2343 | + self.cr.execute("select id from account_account limit 5") |
2344 | + acc_id = map(lambda x: x[0], self.cr.fetchall()) |
2345 | + |
2346 | + self.cr.execute("select id from account_period") |
2347 | + period_id = map(lambda x: x[0], self.cr.fetchall()) |
2348 | + |
2349 | + report_bs_id = self.account_report_bs.create(self.cr,self.uid,{'name':'Unit test balance sheet report', |
2350 | + 'code':'Unit BS', |
2351 | + 'account_id':[(6,0,acc_id)], |
2352 | + 'font_style':'Courier', |
2353 | + 'report_type':'acc_with_child'}) |
2354 | + except osv.except_osv,e: |
2355 | + self.fail(e.name + e.value) |
2356 | + except Exception,e: |
2357 | + self.fail(e) |
2358 | + |
2359 | + def test_2_Report(self): |
2360 | + try: |
2361 | + self.failUnless(report_bs_id,"No Report Balance Sheet record Created !") |
2362 | + self.cr.commit() |
2363 | + wizard_service = netsvc.ExportService.getService("wizard") |
2364 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.account.balancesheet.report') |
2365 | + datas = {'id': report_bs_id, 'model': 'account.report.bs', 'form': {'periods': [[6, 0, period_id]], 'report_type': 'only_obj', 'fiscalyear': 1},} |
2366 | + state = 'report' |
2367 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
2368 | + except osv.except_osv,e: |
2369 | + self.fail(e.name + e.value) |
2370 | + except Exception,e: |
2371 | + self.fail(e) |
2372 | + |
2373 | + def test_3_UnlinkInvoice(self): |
2374 | + try: |
2375 | + self.failUnless(report_bs_id,"No Report Balance Sheet record Created !") |
2376 | + self.account_report_bs.unlink(self.cr,self.uid,[report_bs_id]) |
2377 | + except osv.except_osv,e: |
2378 | + self.fail(e.name + e.value) |
2379 | + except Exception,e: |
2380 | + self.fail(e) |
2381 | + |
2382 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2383 | |
2384 | === added directory 'account_tax_include/unit_test' |
2385 | === added file 'account_tax_include/unit_test/__init__.py' |
2386 | --- account_tax_include/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2387 | +++ account_tax_include/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2388 | @@ -0,0 +1,22 @@ |
2389 | +# -*- coding: utf-8 -*- |
2390 | +############################################################################## |
2391 | +# |
2392 | +# OpenERP, Open Source Management Solution |
2393 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2394 | +# |
2395 | +# This program is free software: you can redistribute it and/or modify |
2396 | +# it under the terms of the GNU Affero General Public License as |
2397 | +# published by the Free Software Foundation, either version 3 of the |
2398 | +# License, or (at your option) any later version. |
2399 | +# |
2400 | +# This program is distributed in the hope that it will be useful, |
2401 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2402 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2403 | +# GNU Affero General Public License for more details. |
2404 | +# |
2405 | +# You should have received a copy of the GNU Affero General Public License |
2406 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2407 | +# |
2408 | +############################################################################## |
2409 | + |
2410 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2411 | \ No newline at end of file |
2412 | |
2413 | === added file 'account_tax_include/unit_test/test.py' |
2414 | --- account_tax_include/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2415 | +++ account_tax_include/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2416 | @@ -0,0 +1,135 @@ |
2417 | +# -*- coding: utf-8 -*- |
2418 | +############################################################################## |
2419 | +# |
2420 | +# OpenERP, Open Source Management Solution |
2421 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2422 | +# |
2423 | +# This program is free software: you can redistribute it and/or modify |
2424 | +# it under the terms of the GNU Affero General Public License as |
2425 | +# published by the Free Software Foundation, either version 3 of the |
2426 | +# License, or (at your option) any later version. |
2427 | +# |
2428 | +# This program is distributed in the hope that it will be useful, |
2429 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2430 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2431 | +# GNU Affero General Public License for more details. |
2432 | +# |
2433 | +# You should have received a copy of the GNU Affero General Public License |
2434 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2435 | +# |
2436 | +############################################################################## |
2437 | + |
2438 | +import unittest |
2439 | +import pooler |
2440 | +import netsvc |
2441 | +from osv import osv |
2442 | + |
2443 | +invoice_id = None |
2444 | +invoice_line_id = None |
2445 | +tax_id = None |
2446 | + |
2447 | +class account_tax_include_test_case(unittest.TestCase): |
2448 | + |
2449 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2450 | + self.cr = cursor |
2451 | + self.uid = user |
2452 | + unittest.TestCase.__init__(self, methodName) |
2453 | + |
2454 | + def setUp(self): |
2455 | + try: |
2456 | + self.pool = pooler.get_pool(self.cr.dbname) |
2457 | + self.account_invoice = self.pool.get('account.invoice') |
2458 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
2459 | + self.account_tax = self.pool.get('account.tax') |
2460 | + except osv.except_osv,e: |
2461 | + self.fail(e.name + e.value) |
2462 | + except Exception,e: |
2463 | + self.fail(e) |
2464 | + |
2465 | + def tearDown(self): |
2466 | + try: |
2467 | + self.account_invoice = None |
2468 | + self.account_invoice_line = None |
2469 | + self.account_tax = None |
2470 | + except osv.except_osv,e: |
2471 | + self.fail(e.name + e.value) |
2472 | + except Exception,e: |
2473 | + self.fail(e) |
2474 | + |
2475 | + def test_1_Create(self): |
2476 | + try: |
2477 | + global invoice_id,invoice_line_id,tax_id,sales_journal_id |
2478 | + model_obj = self.pool.get('ir.model.data') |
2479 | + # Product |
2480 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1') |
2481 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
2482 | + # Partner |
2483 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes') |
2484 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
2485 | + |
2486 | + # Partners address |
2487 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1') |
2488 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
2489 | + |
2490 | + # Account |
2491 | + receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv') |
2492 | + receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id |
2493 | + pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay') |
2494 | + pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id |
2495 | + |
2496 | + # Journal |
2497 | + sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
2498 | + sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id |
2499 | + |
2500 | + tax_id = self.account_tax.create(self.cr,self.uid,{'name':'Unit test case tax', |
2501 | + 'amount':0.10}) |
2502 | + invoice_id = self.account_invoice.create(self.cr,self.uid, |
2503 | + {'name': 'Unit Test Account tax include case Invoice', |
2504 | + 'type': 'out_invoice', |
2505 | + 'partner_id': partner_id, |
2506 | + 'address_invoice_id': partner_address_id, |
2507 | + 'address_contact_id': partner_address_id, |
2508 | + 'account_id':receive_account_id, |
2509 | + }) |
2510 | + |
2511 | + invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid, |
2512 | + {'name' :'Unit Test Invoice Line', |
2513 | + 'invoice_id':invoice_id, |
2514 | + 'account_id':pay_account_id, |
2515 | + 'product_id':product_id, |
2516 | + 'price_unit':450 , |
2517 | + 'quantity':4, |
2518 | + 'invoice_line_tax_id':[(6,0,[tax_id])], |
2519 | + }) |
2520 | + except osv.except_osv,e: |
2521 | + self.fail(e.name + e.value) |
2522 | + except Exception,e: |
2523 | + self.fail(e) |
2524 | + |
2525 | + def test_2_CreateInvoice(self): |
2526 | + try: |
2527 | + self.failUnless(invoice_id,"No Invoice Created !") |
2528 | + wf_service = netsvc.LocalService("workflow") |
2529 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr) |
2530 | + except osv.except_osv,e: |
2531 | + self.fail(e.name + e.value) |
2532 | + except Exception,e: |
2533 | + self.fail(e) |
2534 | + |
2535 | + def test_3_Unlink(self): |
2536 | + try: |
2537 | + self.failUnless(invoice_id,"No Invoice Created !") |
2538 | + sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id) |
2539 | + wf_service = netsvc.LocalService("workflow") |
2540 | + if not sale_journal.update_posted: |
2541 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True}) |
2542 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr) |
2543 | + self.account_invoice.unlink(self.cr,self.uid,[invoice_id]) |
2544 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':False}) |
2545 | + self.account_tax.unlink(self.cr,self.uid,[tax_id]) |
2546 | + except osv.except_osv,e: |
2547 | + self.fail(e.name + e.value) |
2548 | + except Exception,e: |
2549 | + self.fail(e) |
2550 | + |
2551 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2552 | |
2553 | === added directory 'account_voucher/unit_test' |
2554 | === added file 'account_voucher/unit_test/__init__.py' |
2555 | --- account_voucher/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2556 | +++ account_voucher/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2557 | @@ -0,0 +1,22 @@ |
2558 | +# -*- coding: utf-8 -*- |
2559 | +############################################################################## |
2560 | +# |
2561 | +# OpenERP, Open Source Management Solution |
2562 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2563 | +# |
2564 | +# This program is free software: you can redistribute it and/or modify |
2565 | +# it under the terms of the GNU Affero General Public License as |
2566 | +# published by the Free Software Foundation, either version 3 of the |
2567 | +# License, or (at your option) any later version. |
2568 | +# |
2569 | +# This program is distributed in the hope that it will be useful, |
2570 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2571 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2572 | +# GNU Affero General Public License for more details. |
2573 | +# |
2574 | +# You should have received a copy of the GNU Affero General Public License |
2575 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2576 | +# |
2577 | +############################################################################## |
2578 | + |
2579 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2580 | \ No newline at end of file |
2581 | |
2582 | === added file 'account_voucher/unit_test/test.py' |
2583 | --- account_voucher/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2584 | +++ account_voucher/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2585 | @@ -0,0 +1,144 @@ |
2586 | +# -*- coding: utf-8 -*- |
2587 | +############################################################################## |
2588 | +# |
2589 | +# OpenERP, Open Source Management Solution |
2590 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2591 | +# |
2592 | +# This program is free software: you can redistribute it and/or modify |
2593 | +# it under the terms of the GNU Affero General Public License as |
2594 | +# published by the Free Software Foundation, either version 3 of the |
2595 | +# License, or (at your option) any later version. |
2596 | +# |
2597 | +# This program is distributed in the hope that it will be useful, |
2598 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2599 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2600 | +# GNU Affero General Public License for more details. |
2601 | +# |
2602 | +# You should have received a copy of the GNU Affero General Public License |
2603 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2604 | +# |
2605 | +############################################################################## |
2606 | +import unittest |
2607 | +import pooler |
2608 | +import netsvc |
2609 | +from osv import osv |
2610 | + |
2611 | +voucher_id = None |
2612 | +voucher_line_id = None |
2613 | +account_id = None |
2614 | + |
2615 | +class account_voucher_test_case(unittest.TestCase): |
2616 | + |
2617 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2618 | + self.cr = cursor |
2619 | + self.uid = user |
2620 | + unittest.TestCase.__init__(self, methodName) |
2621 | + |
2622 | + def setUp(self): |
2623 | + try: |
2624 | + self.pool = pooler.get_pool(self.cr.dbname) |
2625 | + self.account_invoice = self.pool.get('account.invoice') |
2626 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
2627 | + self.account_voucher = self.pool.get('account.voucher') |
2628 | + self.account_voucher_line = self.pool.get('account.voucher.line') |
2629 | + except osv.except_osv,e: |
2630 | + self.fail(e.name + e.value) |
2631 | + except Exception,e: |
2632 | + self.fail(e) |
2633 | + |
2634 | + def tearDown(self): |
2635 | + try: |
2636 | + self.account_invoice = None |
2637 | + self.account_invoice_line = None |
2638 | + self.account_voucher = None |
2639 | + self.account_voucher_line = None |
2640 | + except osv.except_osv,e: |
2641 | + self.fail(e.name + e.value) |
2642 | + except Exception,e: |
2643 | + self.fail(e) |
2644 | + |
2645 | + def test_1_CreateVoucher(self): |
2646 | + try: |
2647 | + global voucher_id,voucher_line_id,receive_account_id,account_id,analytic_journal_id,journal |
2648 | + |
2649 | + model_obj = self.pool.get('ir.model.data') |
2650 | + |
2651 | + account = model_obj._get_id(self.cr,self.uid, 'account', 'cash') |
2652 | + account_id = model_obj.browse(self.cr, self.uid, account).res_id |
2653 | + receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv') |
2654 | + receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id |
2655 | + # Analytic Account |
2656 | + analytic_account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1') |
2657 | + analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id |
2658 | + # Partner |
2659 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_asus') |
2660 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
2661 | + |
2662 | + sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
2663 | + sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id |
2664 | + analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale') |
2665 | + analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id |
2666 | + |
2667 | + voucher_id = self.account_voucher.create(self.cr,self.uid,{'name':'Unit test case voucher', |
2668 | + 'narration':'Ref: Unit test case', |
2669 | + 'account_id':account_id}) |
2670 | + |
2671 | + voucher_line_id = self.account_voucher_line.create(self.cr,self.uid,{'voucher_id':voucher_id, |
2672 | + 'name':'Unit test voucher line', |
2673 | + 'account_analytic_id':analytic_account_id, |
2674 | + 'account_id':receive_account_id, |
2675 | + 'partner_id':partner_id, |
2676 | + 'type':'cr', |
2677 | + 'amount':1000.00}) |
2678 | + |
2679 | + except osv.except_osv,e: |
2680 | + self.fail(e.name + e.value) |
2681 | + except Exception,e: |
2682 | + self.fail(e) |
2683 | + |
2684 | + def test_2_open_voucher(self): |
2685 | + try: |
2686 | + self.failUnless(voucher_id,"No Voucher Created !") |
2687 | + self.account_voucher.open_voucher(self.cr,self.uid,[voucher_id]) |
2688 | + except osv.except_osv,e: |
2689 | + self.fail(e.name + e.value) |
2690 | + except Exception,e: |
2691 | + self.fail(e) |
2692 | + |
2693 | + def test_3_proforma_voucher(self): |
2694 | + try: |
2695 | + self.failUnless(voucher_id,"No Voucher Created !") |
2696 | + global journal |
2697 | + journal = self.account_voucher.browse(self.cr,self.uid,voucher_id) |
2698 | + if not journal.journal_id.analytic_journal_id.id: |
2699 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':analytic_journal_id}) |
2700 | + self.account_voucher.proforma_voucher(self.cr,self.uid,[voucher_id]) |
2701 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False}) |
2702 | + except osv.except_osv,e: |
2703 | + self.fail(e.name + e.value) |
2704 | + except Exception,e: |
2705 | + self.fail(e) |
2706 | + |
2707 | + def test_4_CancelVoucher(self): |
2708 | + try: |
2709 | + bank_journal = self.pool.get('account.journal').browse(self.cr,self.uid,journal.journal_id.id) |
2710 | + if not bank_journal.update_posted: |
2711 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'update_posted':True}) |
2712 | + self.account_voucher.cancel_voucher(self.cr,self.uid,[voucher_id]) |
2713 | + self.account_voucher.action_cancel_draft(self.cr,self.uid,[voucher_id]) |
2714 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False,'update_posted':False}) |
2715 | + except osv.except_osv,e: |
2716 | + self.fail(e.name + e.value) |
2717 | + except Exception,e: |
2718 | + self.fail(e) |
2719 | + |
2720 | + def test_5_Unlink(self): |
2721 | + try: |
2722 | + self.failUnless(voucher_id,"No Voucher Created !") |
2723 | + self.account_voucher.unlink(self.cr,self.uid,[voucher_id]) |
2724 | + except osv.except_osv,e: |
2725 | + self.fail(e.name + e.value) |
2726 | + except Exception,e: |
2727 | + self.fail(e) |
2728 | + |
2729 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2730 | |
2731 | === added directory 'analytic_journal_billing_rate/unit_test' |
2732 | === added file 'analytic_journal_billing_rate/unit_test/__init__.py' |
2733 | --- analytic_journal_billing_rate/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2734 | +++ analytic_journal_billing_rate/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2735 | @@ -0,0 +1,23 @@ |
2736 | +# -*- coding: utf-8 -*- |
2737 | +############################################################################## |
2738 | +# |
2739 | +# OpenERP, Open Source Management Solution |
2740 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2741 | +# |
2742 | +# This program is free software: you can redistribute it and/or modify |
2743 | +# it under the terms of the GNU Affero General Public License as |
2744 | +# published by the Free Software Foundation, either version 3 of the |
2745 | +# License, or (at your option) any later version. |
2746 | +# |
2747 | +# This program is distributed in the hope that it will be useful, |
2748 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2749 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2750 | +# GNU Affero General Public License for more details. |
2751 | +# |
2752 | +# You should have received a copy of the GNU Affero General Public License |
2753 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2754 | +# |
2755 | +############################################################################## |
2756 | + |
2757 | + |
2758 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2759 | |
2760 | === added file 'analytic_journal_billing_rate/unit_test/test.py' |
2761 | --- analytic_journal_billing_rate/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2762 | +++ analytic_journal_billing_rate/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2763 | @@ -0,0 +1,161 @@ |
2764 | +# -*- coding: utf-8 -*- |
2765 | +############################################################################## |
2766 | +# |
2767 | +# OpenERP, Open Source Management Solution |
2768 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2769 | +# |
2770 | +# This program is free software: you can redistribute it and/or modify |
2771 | +# it under the terms of the GNU Affero General Public License as |
2772 | +# published by the Free Software Foundation, either version 3 of the |
2773 | +# License, or (at your option) any later version. |
2774 | +# |
2775 | +# This program is distributed in the hope that it will be useful, |
2776 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2777 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2778 | +# GNU Affero General Public License for more details. |
2779 | +# |
2780 | +# You should have received a copy of the GNU Affero General Public License |
2781 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2782 | +# |
2783 | +############################################################################## |
2784 | +import unittest |
2785 | +import pooler |
2786 | +import netsvc |
2787 | +from osv import osv |
2788 | +import hr_timesheet.unit_test.test as ht |
2789 | + |
2790 | +journal_rate_id = None |
2791 | + |
2792 | +class analytic_journal_billing_rate_test_case(unittest.TestCase): |
2793 | + |
2794 | + third_party_cases={ht.hr_timesheet_test_case: ['test_1_Create']} |
2795 | + |
2796 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2797 | + self.cr = cursor |
2798 | + self.uid = user |
2799 | + unittest.TestCase.__init__(self, methodName) |
2800 | + |
2801 | + def setUp(self): |
2802 | + try: |
2803 | + self.pool = pooler.get_pool(self.cr.dbname) |
2804 | + self.account_invoice = self.pool.get('account.invoice') |
2805 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
2806 | + self.analytic_journal_rate_grid = self.pool.get('analytic_journal_rate_grid') |
2807 | + self.hr_analytic_timesheet = self.pool.get('hr.analytic.timesheet') |
2808 | + except osv.except_osv,e: |
2809 | + self.fail(e.name + e.value) |
2810 | + except Exception,e: |
2811 | + self.fail(e) |
2812 | + |
2813 | + def tearDown(self): |
2814 | + try: |
2815 | + self.account_invoice = None |
2816 | + self.account_invoice_line = None |
2817 | + self.analytic_journal_rate_grid = None |
2818 | + self.hr_analytic_timesheet = None |
2819 | + except osv.except_osv,e: |
2820 | + self.fail(e.name + e.value) |
2821 | + except Exception,e: |
2822 | + self.fail(e) |
2823 | + |
2824 | + def test_1_Create(self): |
2825 | + try: |
2826 | + global journal_rate_id,analytic_account_id,product_id,journal_id,invoice_id,sales_journal_id,flag |
2827 | + model_obj = self.pool.get('ir.model.data') |
2828 | + |
2829 | + product = model_obj._get_id(self.cr,self.uid, 'hr_timesheet', 'product_consultant') |
2830 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
2831 | + analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1') |
2832 | + analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id |
2833 | + journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale') |
2834 | + journal_id = model_obj.browse(self.cr, self.uid, journal).res_id |
2835 | + rate = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2') |
2836 | + rate_id = model_obj.browse(self.cr, self.uid, rate).res_id |
2837 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
2838 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
2839 | + pricelist = model_obj._get_id(self.cr, self.uid, 'product', 'list0') |
2840 | + pricelist_id = model_obj.browse(self.cr, self.uid, pricelist).res_id |
2841 | + invoice_discount = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2') |
2842 | + invoice_discount_id = model_obj.browse(self.cr, self.uid, invoice_discount).res_id |
2843 | + sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
2844 | + sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id |
2845 | + |
2846 | + journal_rate_id = self.analytic_journal_rate_grid.create(self.cr,self.uid,{'account_id':analytic_account_id, |
2847 | + 'journal_id':journal_id, |
2848 | + 'rate_id':rate_id}) |
2849 | + |
2850 | + analytic_id = self.pool.get('account.analytic.account').browse(self.cr,self.uid,[analytic_account_id])[0] |
2851 | + if not (analytic_id.pricelist_id and analytic_id.partner_id): |
2852 | + self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{ |
2853 | + 'pricelist_id':pricelist_id, |
2854 | + 'partner_id':partner_id |
2855 | + }) |
2856 | + self.hr_analytic_timesheet.write(self.cr,self.uid,[ht.timesheet_id],{'to_invoice':invoice_discount_id}) |
2857 | + except osv.except_osv,e: |
2858 | + self.fail(e.name + e.value) |
2859 | + except Exception,e: |
2860 | + self.fail(e) |
2861 | + |
2862 | + def test_2_wizard_case(self): |
2863 | + try: |
2864 | + self.failUnless(analytic_account_id,"No analytic_account Created !") |
2865 | + self.cr.commit() |
2866 | + wizard_service = netsvc.ExportService.getService("wizard") |
2867 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'hr.timesheet.invoice.create') |
2868 | + datas = {'form':{'date':True,'time':True,'name':True,'price':True,'accounts':[(6,0,[analytic_account_id ])],'product':product_id} ,'ids':[ht.timesheet_id],'id':ht.timesheet_id} |
2869 | + state = 'create' |
2870 | + global res |
2871 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
2872 | + except osv.except_osv,e: |
2873 | + self.fail(e.name + e.value) |
2874 | + except Exception,e: |
2875 | + self.fail(e) |
2876 | + |
2877 | + def test_3_CreateInvoice(self): |
2878 | + try: |
2879 | + global invoice_id |
2880 | + invoice_id = res['action']['domain'][0][2] |
2881 | + self.failUnless(invoice_id,"No invoices Created !") |
2882 | + journal = self.account_invoice.browse(self.cr,self.uid,invoice_id)[0] |
2883 | + wf_service = netsvc.LocalService("workflow") |
2884 | + if not journal.journal_id.analytic_journal_id: |
2885 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':journal_id}) |
2886 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0], 'invoice_open', self.cr) |
2887 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False}) |
2888 | + except osv.except_osv,e: |
2889 | + self.fail(e.name + e.value) |
2890 | + except Exception,e: |
2891 | + self.fail(e) |
2892 | + |
2893 | + def test_4_CancelInvoice(self): |
2894 | + try: |
2895 | + self.failUnless(invoice_id,"No invoices Created !") |
2896 | + sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id) |
2897 | + wf_service = netsvc.LocalService("workflow") |
2898 | + if not sale_journal.update_posted: |
2899 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True}) |
2900 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0],'invoice_cancel', self.cr) |
2901 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False}) |
2902 | + self.account_invoice.unlink(self.cr,self.uid,invoice_id) |
2903 | + except osv.except_osv,e: |
2904 | + self.fail(e.name + e.value) |
2905 | + except Exception,e: |
2906 | + self.fail(e) |
2907 | + |
2908 | + def test_5_Unlink(self): |
2909 | + try: |
2910 | + self.failUnless(ht.timesheet_id,"No timesheet Created !") |
2911 | + self.failUnless(journal_rate_id,"No journal_rate Created !") |
2912 | + self.failUnless(analytic_account_id,"No analytic_account Created !") |
2913 | + self.hr_analytic_timesheet.unlink(self.cr,self.uid,[ht.timesheet_id]) |
2914 | + self.analytic_journal_rate_grid.unlink(self.cr,self.uid,[journal_rate_id]) |
2915 | + self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{ |
2916 | + 'pricelist_id':False, |
2917 | + 'partner_id':False |
2918 | + }) |
2919 | + except osv.except_osv,e: |
2920 | + self.fail(e.name + e.value) |
2921 | + except Exception,e: |
2922 | + self.fail(e) |
2923 | + |
2924 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2925 | |
2926 | === added directory 'analytic_user_function/unit_test' |
2927 | === added file 'analytic_user_function/unit_test/__init__.py' |
2928 | --- analytic_user_function/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
2929 | +++ analytic_user_function/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
2930 | @@ -0,0 +1,23 @@ |
2931 | +# -*- coding: utf-8 -*- |
2932 | +############################################################################## |
2933 | +# |
2934 | +# OpenERP, Open Source Management Solution |
2935 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2936 | +# |
2937 | +# This program is free software: you can redistribute it and/or modify |
2938 | +# it under the terms of the GNU Affero General Public License as |
2939 | +# published by the Free Software Foundation, either version 3 of the |
2940 | +# License, or (at your option) any later version. |
2941 | +# |
2942 | +# This program is distributed in the hope that it will be useful, |
2943 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2944 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2945 | +# GNU Affero General Public License for more details. |
2946 | +# |
2947 | +# You should have received a copy of the GNU Affero General Public License |
2948 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2949 | +# |
2950 | +############################################################################## |
2951 | + |
2952 | + |
2953 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2954 | |
2955 | === added file 'analytic_user_function/unit_test/test.py' |
2956 | --- analytic_user_function/unit_test/test.py 1970-01-01 00:00:00 +0000 |
2957 | +++ analytic_user_function/unit_test/test.py 2010-03-08 07:28:31 +0000 |
2958 | @@ -0,0 +1,161 @@ |
2959 | +# -*- coding: utf-8 -*- |
2960 | +############################################################################## |
2961 | +# |
2962 | +# OpenERP, Open Source Management Solution |
2963 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2964 | +# |
2965 | +# This program is free software: you can redistribute it and/or modify |
2966 | +# it under the terms of the GNU Affero General Public License as |
2967 | +# published by the Free Software Foundation, either version 3 of the |
2968 | +# License, or (at your option) any later version. |
2969 | +# |
2970 | +# This program is distributed in the hope that it will be useful, |
2971 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2972 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2973 | +# GNU Affero General Public License for more details. |
2974 | +# |
2975 | +# You should have received a copy of the GNU Affero General Public License |
2976 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2977 | +# |
2978 | +############################################################################## |
2979 | +import unittest |
2980 | +import pooler |
2981 | +import netsvc |
2982 | +from osv import osv |
2983 | +import hr_timesheet.unit_test.test as ht |
2984 | + |
2985 | +user_function_id = None |
2986 | + |
2987 | +class analytic_user_function_test_case(unittest.TestCase): |
2988 | + |
2989 | + third_party_cases={ht.hr_timesheet_test_case: ['test_1_Create']} |
2990 | + |
2991 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
2992 | + self.cr = cursor |
2993 | + self.uid = user |
2994 | + unittest.TestCase.__init__(self, methodName) |
2995 | + |
2996 | + def setUp(self): |
2997 | + try: |
2998 | + self.pool = pooler.get_pool(self.cr.dbname) |
2999 | + self.account_invoice = self.pool.get('account.invoice') |
3000 | + self.account_invoice_line = self.pool.get('account.invoice.line') |
3001 | + self.analytic_user_funct_grid = self.pool.get('analytic_user_funct_grid') |
3002 | + self.hr_analytic_timesheet = self.pool.get('hr.analytic.timesheet') |
3003 | + except osv.except_osv,e: |
3004 | + self.fail(e.name + e.value) |
3005 | + except Exception,e: |
3006 | + self.fail(e) |
3007 | + |
3008 | + def tearDown(self): |
3009 | + try: |
3010 | + self.account_invoice = None |
3011 | + self.account_invoice_line = None |
3012 | + self.analytic_user_funct_grid = None |
3013 | + self.hr_analytic_timesheet = None |
3014 | + except osv.except_osv,e: |
3015 | + self.fail(e.name + e.value) |
3016 | + except Exception,e: |
3017 | + self.fail(e) |
3018 | + |
3019 | + def test_1_Create(self): |
3020 | + try: |
3021 | + global journal_rate_id,analytic_account_id,product_id,journal_id,invoice_id,sales_journal_id,flag |
3022 | + model_obj = self.pool.get('ir.model.data') |
3023 | + |
3024 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1') |
3025 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
3026 | + analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1') |
3027 | + analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id |
3028 | + journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale') |
3029 | + journal_id = model_obj.browse(self.cr, self.uid, journal).res_id |
3030 | + rate = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2') |
3031 | + rate_id = model_obj.browse(self.cr, self.uid, rate).res_id |
3032 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
3033 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
3034 | + pricelist = model_obj._get_id(self.cr, self.uid, 'product', 'list0') |
3035 | + pricelist_id = model_obj.browse(self.cr, self.uid, pricelist).res_id |
3036 | + invoice_discount = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2') |
3037 | + invoice_discount_id = model_obj.browse(self.cr, self.uid, invoice_discount).res_id |
3038 | + sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
3039 | + sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id |
3040 | + |
3041 | + user_function_id = self.analytic_user_funct_grid.create(self.cr,self.uid,{'account_id':analytic_account_id, |
3042 | + 'user_id':self.uid, |
3043 | + 'product_id':product_id}) |
3044 | + |
3045 | + analytic_id = self.pool.get('account.analytic.account').browse(self.cr,self.uid,[analytic_account_id])[0] |
3046 | + if not (analytic_id.pricelist_id and analytic_id.partner_id): |
3047 | + self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{ |
3048 | + 'pricelist_id':pricelist_id, |
3049 | + 'partner_id':partner_id |
3050 | + }) |
3051 | + self.hr_analytic_timesheet.write(self.cr,self.uid,[ht.timesheet_id],{'to_invoice':invoice_discount_id}) |
3052 | + except osv.except_osv,e: |
3053 | + self.fail(e.name + e.value) |
3054 | + except Exception,e: |
3055 | + self.fail(e) |
3056 | + |
3057 | + def test_2_wizard_case(self): |
3058 | + try: |
3059 | + self.cr.commit() |
3060 | + self.failUnless(analytic_account_id,"No analytic_account Created !") |
3061 | + wizard_service = netsvc.ExportService.getService("wizard") |
3062 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'hr.timesheet.invoice.create') |
3063 | + datas = {'form':{'date':True,'time':True,'name':True,'price':True,'accounts':[(6,0,[analytic_account_id ])],'product':product_id} ,'ids':[ht.timesheet_id],'id':ht.timesheet_id} |
3064 | + state = 'create' |
3065 | + global res |
3066 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
3067 | + except osv.except_osv,e: |
3068 | + self.fail(e.name + e.value) |
3069 | + except Exception,e: |
3070 | + self.fail(e) |
3071 | + |
3072 | + def test_3_CreateInvoice(self): |
3073 | + try: |
3074 | + global invoice_id |
3075 | + invoice_id = res['action']['domain'][0][2] |
3076 | + self.failUnless(invoice_id,"No invoices Created !") |
3077 | + journal = self.account_invoice.browse(self.cr,self.uid,invoice_id)[0] |
3078 | + wf_service = netsvc.LocalService("workflow") |
3079 | + if not journal.journal_id.analytic_journal_id: |
3080 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':journal_id}) |
3081 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0], 'invoice_open', self.cr) |
3082 | + self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False}) |
3083 | + except osv.except_osv,e: |
3084 | + self.fail(e.name + e.value) |
3085 | + except Exception,e: |
3086 | + self.fail(e) |
3087 | + |
3088 | + def test_4_CancelInvoice(self): |
3089 | + try: |
3090 | + self.failUnless(invoice_id,"No invoices Created !") |
3091 | + sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id) |
3092 | + wf_service = netsvc.LocalService("workflow") |
3093 | + if not sale_journal.update_posted: |
3094 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True}) |
3095 | + wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0],'invoice_cancel', self.cr) |
3096 | + self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False}) |
3097 | + self.account_invoice.unlink(self.cr,self.uid,invoice_id) |
3098 | + except osv.except_osv,e: |
3099 | + self.fail(e.name + e.value) |
3100 | + except Exception,e: |
3101 | + self.fail(e) |
3102 | + |
3103 | + def test_5_Unlink(self): |
3104 | + try: |
3105 | + self.failUnless(ht.timesheet_id,"No timesheet Created !") |
3106 | + self.failUnless(user_function_id,"No user_function Created !") |
3107 | + self.failUnless(analytic_account_id,"No analytic_account Created !") |
3108 | + self.hr_analytic_timesheet.unlink(self.cr,self.uid,[ht.timesheet_id]) |
3109 | + self.analytic_user_funct_grid.unlink(self.cr,self.uid,[user_function_id]) |
3110 | + self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{ |
3111 | + 'pricelist_id':False, |
3112 | + 'partner_id':False |
3113 | + }) |
3114 | + except osv.except_osv,e: |
3115 | + self.fail(e.name + e.value) |
3116 | + except Exception,e: |
3117 | + self.fail(e) |
3118 | + |
3119 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3120 | |
3121 | === added directory 'auction/unit_test' |
3122 | === added file 'auction/unit_test/__init__.py' |
3123 | --- auction/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
3124 | +++ auction/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
3125 | @@ -0,0 +1,23 @@ |
3126 | +# -*- coding: utf-8 -*- |
3127 | +############################################################################## |
3128 | +# |
3129 | +# OpenERP, Open Source Management Solution |
3130 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3131 | +# |
3132 | +# This program is free software: you can redistribute it and/or modify |
3133 | +# it under the terms of the GNU Affero General Public License as |
3134 | +# published by the Free Software Foundation, either version 3 of the |
3135 | +# License, or (at your option) any later version. |
3136 | +# |
3137 | +# This program is distributed in the hope that it will be useful, |
3138 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3139 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3140 | +# GNU Affero General Public License for more details. |
3141 | +# |
3142 | +# You should have received a copy of the GNU Affero General Public License |
3143 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3144 | +# |
3145 | +############################################################################## |
3146 | + |
3147 | + |
3148 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3149 | \ No newline at end of file |
3150 | |
3151 | === added file 'auction/unit_test/test.py' |
3152 | --- auction/unit_test/test.py 1970-01-01 00:00:00 +0000 |
3153 | +++ auction/unit_test/test.py 2010-03-08 07:28:31 +0000 |
3154 | @@ -0,0 +1,184 @@ |
3155 | +# -*- coding: utf-8 -*- |
3156 | +############################################################################## |
3157 | +# |
3158 | +# OpenERP, Open Source Management Solution |
3159 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3160 | +# |
3161 | +# This program is free software: you can redistribute it and/or modify |
3162 | +# it under the terms of the GNU Affero General Public License as |
3163 | +# published by the Free Software Foundation, either version 3 of the |
3164 | +# License, or (at your option) any later version. |
3165 | +# |
3166 | +# This program is distributed in the hope that it will be useful, |
3167 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3168 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3169 | +# GNU Affero General Public License for more details. |
3170 | +# |
3171 | +# You should have received a copy of the GNU Affero General Public License |
3172 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3173 | +# |
3174 | +############################################################################## |
3175 | +import unittest |
3176 | +import pooler |
3177 | +import netsvc |
3178 | +from osv import osv |
3179 | +import time |
3180 | + |
3181 | +auction_lots_id = None |
3182 | +auction_date_id = None |
3183 | +auction_deposit_id = None |
3184 | + |
3185 | +class auction_test_case(unittest.TestCase): |
3186 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
3187 | + self.cr = cursor |
3188 | + self.uid = user |
3189 | + unittest.TestCase.__init__(self, methodName) |
3190 | + |
3191 | + def setUp(self): |
3192 | + try: |
3193 | + self.pool = pooler.get_pool(self.cr.dbname) |
3194 | + self.auction_lots = self.pool.get('auction.lots') |
3195 | + self.auction_dates = self.pool.get('auction.dates') |
3196 | + self.auction_deposit = self.pool.get('auction.deposit') |
3197 | + except osv.except_osv,e: |
3198 | + self.fail(e.name + e.value) |
3199 | + except Exception,e: |
3200 | + self.fail(e) |
3201 | + |
3202 | + |
3203 | + def tearDown(self): |
3204 | + try: |
3205 | + self.pool = None |
3206 | + self.auction_lots = None |
3207 | + self.auction_dates = None |
3208 | + self.auction_deposit = None |
3209 | + except osv.except_osv,e: |
3210 | + self.fail(e.name + e.value) |
3211 | + except Exception,e: |
3212 | + self.fail(e) |
3213 | + |
3214 | + |
3215 | + def test_1_Create(self): |
3216 | + |
3217 | + try: |
3218 | + global auction_lots_id,auction_date_id,auction_deposit_id |
3219 | + vals = {} |
3220 | + model_obj = self.pool.get('ir.model.data') |
3221 | + |
3222 | + buyer_costs = self.pool.get('account.tax').search(self.cr,self.uid,[('name','=','Buyer Costs')]) |
3223 | + buyer_costs_id = self.pool.get('account.tax').browse(self.cr,self.uid,buyer_costs)[0] |
3224 | + seller_costs = self.pool.get('account.tax').search(self.cr,self.uid,[('name','=','Seller Costs')]) |
3225 | + seller_costs_id = self.pool.get('account.tax').browse(self.cr,self.uid,buyer_costs)[0] |
3226 | + |
3227 | + acc_income = model_obj._get_id(self.cr, self.uid, 'account', 'a_sale') |
3228 | + acc_income_id = model_obj.browse(self.cr, self.uid,acc_income).res_id |
3229 | + acc_expense = model_obj._get_id(self.cr, self.uid, 'account', 'a_expense') |
3230 | + acc_expense_id = model_obj.browse(self.cr, self.uid,acc_expense).res_id |
3231 | + journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal') |
3232 | + journal_id = model_obj.browse(self.cr, self.uid,journal).res_id |
3233 | + journal_seller = model_obj._get_id(self.cr, self.uid, 'account', 'expenses_journal') |
3234 | + journal_seller_id = model_obj.browse(self.cr, self.uid,journal_seller).res_id |
3235 | + account_analytic = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_absences') |
3236 | + account_analytic_id = model_obj.browse(self.cr, self.uid,account_analytic).res_id |
3237 | + product = model_obj._get_id(self.cr, self.uid, 'auction', 'monproduit') |
3238 | + product_id = model_obj.browse(self.cr, self.uid,product).res_id |
3239 | + auction_tax = model_obj._get_id(self.cr, self.uid, 'auction', 'auction_tax') |
3240 | + auction_tax_id = model_obj.browse(self.cr, self.uid,auction_tax).res_id |
3241 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
3242 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
3243 | + analytic_journal = model_obj._get_id(self.cr,self.uid, 'account', 'cose_journal_sale') |
3244 | + analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal,).res_id |
3245 | + |
3246 | + |
3247 | + auction_date_id = self.auction_dates.create(self.cr,self.uid,{'name':'Furniture Exhibition', |
3248 | + 'expo1':time.strftime('%Y-%m-01'),'expo2':time.strftime('%Y-%m-20'), |
3249 | + 'auction1':time.strftime('%Y-%m-21'),'auction2':time.strftime('%Y-%m-29'), |
3250 | + 'buyer_costs':[(6,0,[buyer_costs_id.id])], |
3251 | + 'seller_costs':[(6,0,[seller_costs_id.id])], |
3252 | + 'acc_income':acc_income_id, |
3253 | + 'acc_expense':acc_expense_id, |
3254 | + 'journal_id':journal_id, |
3255 | + 'journal_seller_id':journal_seller_id, |
3256 | + 'account_analytic_id':account_analytic_id}) |
3257 | + |
3258 | + auction_deposit_id = self.auction_deposit.create(self.cr,self.uid,{'date_dep':time.strftime('%Y-4-20'), |
3259 | + 'partner_id':partner_id, |
3260 | + 'method':'keep',}) |
3261 | + |
3262 | + auction_lots_id = self.auction_lots.create(self.cr,self.uid,{'name':'Golden sofa', |
3263 | + 'auction_id':auction_date_id, |
3264 | + 'lot_num':1,'lot_est1':10000,'lot_est2':20000, |
3265 | + 'obj_desc':'Coverd by gold sheet','obj_ret':9000, |
3266 | + 'obj_num':21,'obj_price':9500,'bord_vnd_id':auction_deposit_id, |
3267 | + 'product_id':product_id,'author_right':auction_tax_id, |
3268 | + 'ach_login':'admin', |
3269 | + 'ach_uid':partner_id}) |
3270 | + |
3271 | + self.pool.get('account.journal').write(self.cr,self.uid,[analytic_journal_id], |
3272 | + {'analytic_journal_id' :analytic_journal_id}) |
3273 | + except osv.except_osv,e: |
3274 | + self.fail(e.name + e.value) |
3275 | + except Exception,e: |
3276 | + self.fail(e) |
3277 | + |
3278 | + def test_2_SoldObject(self): |
3279 | + try: |
3280 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3281 | + self.auction_lots.button_bought(self.cr,self.uid,auction_lots_id) |
3282 | + except osv.except_osv,e: |
3283 | + self.fail(e.name + e.value) |
3284 | + except Exception,e: |
3285 | + self.fail(e) |
3286 | + |
3287 | + def test_3_NotSoldObject(self): |
3288 | + try: |
3289 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3290 | + self.auction_lots.button_not_bought(self.cr,self.uid,auction_lots_id) |
3291 | + except osv.except_osv,e: |
3292 | + self.fail(e.name + e.value) |
3293 | + except Exception,e: |
3294 | + self.fail(e) |
3295 | + |
3296 | + def test_4_SetToDraftObject(self): |
3297 | + try: |
3298 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3299 | + self.auction_lots.button_draft(self.cr,self.uid,auction_lots_id) |
3300 | + except osv.except_osv,e: |
3301 | + self.fail(e.name + e.value) |
3302 | + except Exception,e: |
3303 | + self.fail(e) |
3304 | + |
3305 | + def test_5_TakenAwayObject(self): |
3306 | + try: |
3307 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3308 | + self.auction_lots.button_taken_away(self.cr,self.uid,auction_lots_id) |
3309 | + except osv.except_osv,e: |
3310 | + self.fail(e.name + e.value) |
3311 | + except Exception,e: |
3312 | + self.fail(e) |
3313 | + |
3314 | + def test_6_PrintOrder(self): |
3315 | + try: |
3316 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3317 | + self.cr.commit() |
3318 | + report_service = netsvc.ExportService.getService('report') |
3319 | + report_service.exp_report(self.cr.dbname, self.uid, 'report.auction.ach_bordereau', [auction_lots_id]) |
3320 | + except osv.except_osv,e: |
3321 | + self.fail(e.name + e.value) |
3322 | + except Exception,e: |
3323 | + self.fail(e) |
3324 | + |
3325 | + def test_7_Unlink(self): |
3326 | + try: |
3327 | + self.failUnless(auction_lots_id,"No auction lots Created !") |
3328 | + self.failUnless(auction_deposit_id,"No auction deposit Created !") |
3329 | + self.failUnless(auction_date_id,"No auction date Created !") |
3330 | + self.auction_lots.unlink(self.cr,self.uid,[auction_lots_id]) |
3331 | + self.auction_deposit.unlink(self.cr,self.uid,[auction_deposit_id]) |
3332 | + self.auction_dates.unlink(self.cr,self.uid,[auction_date_id]) |
3333 | + except osv.except_osv,e: |
3334 | + self.fail(e.name + e.value) |
3335 | + except Exception,e: |
3336 | + self.fail(e) |
3337 | + |
3338 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3339 | |
3340 | === added directory 'audittrail/unit_test' |
3341 | === added file 'audittrail/unit_test/__init__.py' |
3342 | --- audittrail/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
3343 | +++ audittrail/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
3344 | @@ -0,0 +1,22 @@ |
3345 | +# -*- coding: utf-8 -*- |
3346 | +############################################################################## |
3347 | +# |
3348 | +# OpenERP, Open Source Management Solution |
3349 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3350 | +# |
3351 | +# This program is free software: you can redistribute it and/or modify |
3352 | +# it under the terms of the GNU Affero General Public License as |
3353 | +# published by the Free Software Foundation, either version 3 of the |
3354 | +# License, or (at your option) any later version. |
3355 | +# |
3356 | +# This program is distributed in the hope that it will be useful, |
3357 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3358 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3359 | +# GNU Affero General Public License for more details. |
3360 | +# |
3361 | +# You should have received a copy of the GNU Affero General Public License |
3362 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3363 | +# |
3364 | +############################################################################## |
3365 | + |
3366 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3367 | \ No newline at end of file |
3368 | |
3369 | === added file 'audittrail/unit_test/test.py' |
3370 | --- audittrail/unit_test/test.py 1970-01-01 00:00:00 +0000 |
3371 | +++ audittrail/unit_test/test.py 2010-03-08 07:28:31 +0000 |
3372 | @@ -0,0 +1,103 @@ |
3373 | +# -*- coding: utf-8 -*- |
3374 | +############################################################################## |
3375 | +# |
3376 | +# OpenERP, Open Source Management Solution |
3377 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3378 | +# |
3379 | +# This program is free software: you can redistribute it and/or modify |
3380 | +# it under the terms of the GNU Affero General Public License as |
3381 | +# published by the Free Software Foundation, either version 3 of the |
3382 | +# License, or (at your option) any later version. |
3383 | +# |
3384 | +# This program is distributed in the hope that it will be useful, |
3385 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3386 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3387 | +# GNU Affero General Public License for more details. |
3388 | +# |
3389 | +# You should have received a copy of the GNU Affero General Public License |
3390 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3391 | +# |
3392 | +############################################################################## |
3393 | +import unittest |
3394 | +import pooler |
3395 | +import netsvc |
3396 | +from osv import osv |
3397 | + |
3398 | +class audittrail_test_case(unittest.TestCase): |
3399 | + |
3400 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
3401 | + self.cr = cursor |
3402 | + self.uid = user |
3403 | + unittest.TestCase.__init__(self, methodName) |
3404 | + |
3405 | + def setUp(self): |
3406 | + try: |
3407 | + self.pool = pooler.get_pool(self.cr.dbname) |
3408 | + self.audittrail_rule = self.pool.get('audittrail.rule') |
3409 | + self.audittrail_log=self.pool.get('audittrail.log') |
3410 | + self.audittrail_log_line=self.pool.get('audittrail.log.line') |
3411 | + except osv.except_osv,e: |
3412 | + self.fail(e.name + e.value) |
3413 | + except Exception,e: |
3414 | + self.fail(e) |
3415 | + |
3416 | + def tearDown(self): |
3417 | + try: |
3418 | + self.pool = None |
3419 | + self.audittrail_rule = None |
3420 | + self.audittrail_log = None |
3421 | + self.audittrail_log_line= None |
3422 | + except osv.except_osv,e: |
3423 | + self.fail(e.name + e.value) |
3424 | + except Exception,e: |
3425 | + self.fail(e) |
3426 | + |
3427 | + def test_1_Create(self): |
3428 | + |
3429 | + try: |
3430 | + global rule_id |
3431 | + objects = self.pool.get('ir.model').search(self.cr,self.uid,[('name','=','Fields')]) |
3432 | + objects_id = self.pool.get('ir.model').browse(self.cr,self.uid, objects)[0] |
3433 | + user_ids=self.pool.get('res.users').search(self.cr,self.uid,[]) |
3434 | + rule_id=self.audittrail_rule.create(self.cr,self.uid,{'name':'New Log', |
3435 | + 'object_id':objects_id.id, |
3436 | + 'user_id':[(6,0,user_ids)], |
3437 | + 'log_read':True, |
3438 | + 'log_write':True, |
3439 | + 'log_unlink':True, |
3440 | + 'log_create':True, |
3441 | + 'state':'draft'}) |
3442 | + |
3443 | + except osv.except_osv,e: |
3444 | + self.fail(e.name + e.value) |
3445 | + except Exception,e: |
3446 | + self.fail(e) |
3447 | + |
3448 | + def test_2_Subscribe(self): |
3449 | + try: |
3450 | + self.failUnless(rule_id,"No rule Created !") |
3451 | + self.audittrail_rule.subscribe(self.cr,self.uid,[rule_id]) |
3452 | + except osv.except_osv,e: |
3453 | + self.fail(e.name + e.value) |
3454 | + except Exception,e: |
3455 | + self.fail(e) |
3456 | + |
3457 | + def test_3_Unsubscribe(self): |
3458 | + try: |
3459 | + self.failUnless(rule_id,"No rule Created !") |
3460 | + self.audittrail_rule.unsubscribe(self.cr,self.uid,[rule_id]) |
3461 | + except osv.except_osv,e: |
3462 | + self.fail(e.name + e.value) |
3463 | + except Exception,e: |
3464 | + self.fail(e) |
3465 | + |
3466 | + def test_4_Unlink(self): |
3467 | + try: |
3468 | + self.failUnless(rule_id,"No rule Created !") |
3469 | + self.audittrail_rule.unlink(self.cr,self.uid,[rule_id]) |
3470 | + except osv.except_osv,e: |
3471 | + self.fail(e.name + e.value) |
3472 | + except Exception,e: |
3473 | + self.fail(e) |
3474 | + |
3475 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3476 | |
3477 | === modified file 'base_module_quality/unit_test/__init__.py' |
3478 | --- base_module_quality/unit_test/__init__.py 2010-01-12 09:18:39 +0000 |
3479 | +++ base_module_quality/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
3480 | @@ -2,23 +2,25 @@ |
3481 | ############################################################################## |
3482 | # |
3483 | # OpenERP, Open Source Management Solution |
3484 | +<<<<<<< TREE |
3485 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3486 | # $Id$ |
3487 | +======= |
3488 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3489 | +>>>>>>> MERGE-SOURCE |
3490 | # |
3491 | # This program is free software: you can redistribute it and/or modify |
3492 | -# it under the terms of the GNU General Public License as published by |
3493 | -# the Free Software Foundation, either version 3 of the License, or |
3494 | -# (at your option) any later version. |
3495 | +# it under the terms of the GNU Affero General Public License as |
3496 | +# published by the Free Software Foundation, either version 3 of the |
3497 | +# License, or (at your option) any later version. |
3498 | # |
3499 | # This program is distributed in the hope that it will be useful, |
3500 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3501 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3502 | -# GNU General Public License for more details. |
3503 | +# GNU Affero General Public License for more details. |
3504 | # |
3505 | -# You should have received a copy of the GNU General Public License |
3506 | +# You should have received a copy of the GNU Affero General Public License |
3507 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3508 | # |
3509 | ############################################################################## |
3510 | - |
3511 | - |
3512 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3513 | |
3514 | === modified file 'base_module_quality/unit_test/unit_test.py' |
3515 | --- base_module_quality/unit_test/unit_test.py 2010-02-24 10:55:29 +0000 |
3516 | +++ base_module_quality/unit_test/unit_test.py 2010-03-08 07:28:31 +0000 |
3517 | @@ -1,6 +1,7 @@ |
3518 | # -*- coding: utf-8 -*- |
3519 | ############################################################################## |
3520 | # |
3521 | +<<<<<<< TREE |
3522 | # OpenERP, Open Source Management Solution |
3523 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3524 | # $Id$ |
3525 | @@ -17,98 +18,160 @@ |
3526 | # |
3527 | # You should have received a copy of the GNU General Public License |
3528 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3529 | +======= |
3530 | +# OpenERP, Open Source Management Solution |
3531 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3532 | +# |
3533 | +# This program is free software: you can redistribute it and/or modify |
3534 | +# it under the terms of the GNU Affero General Public License as |
3535 | +# published by the Free Software Foundation, either version 3 of the |
3536 | +# License, or (at your option) any later version. |
3537 | +# |
3538 | +# This program is distributed in the hope that it will be useful, |
3539 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3540 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3541 | +# GNU Affero General Public License for more details. |
3542 | +# |
3543 | +# You should have received a copy of the GNU Affero General Public License |
3544 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3545 | +>>>>>>> MERGE-SOURCE |
3546 | # |
3547 | ############################################################################## |
3548 | import os |
3549 | - |
3550 | +import unittest |
3551 | from osv import fields, osv |
3552 | from tools.translate import _ |
3553 | import pooler |
3554 | from tools import config |
3555 | +from cStringIO import StringIO |
3556 | from base_module_quality import base_module_quality |
3557 | +import types |
3558 | + |
3559 | +class OpenERPTestLoader(unittest.TestLoader): |
3560 | + |
3561 | + def loadTestsFromTestCase(self, testCaseClass,cursor=False,user=False): |
3562 | + """Return a suite of all tests cases contained in testCaseClass""" |
3563 | + if issubclass(testCaseClass, unittest.TestSuite): |
3564 | + raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?") |
3565 | + testCaseNames = self.getTestCaseNames(testCaseClass) |
3566 | + if not testCaseNames and hasattr(testCaseClass, 'runTest'): |
3567 | + testCaseNames = ['runTest'] |
3568 | + return self.suiteClass(map(testCaseClass, [cursor]*len(testCaseNames),[user]*len(testCaseNames),testCaseNames)) |
3569 | + |
3570 | + |
3571 | |
3572 | class quality_test(base_module_quality.abstract_quality_check): |
3573 | |
3574 | - def __init__(self): |
3575 | - super(quality_test, self).__init__() |
3576 | - self.bool_installed_only = True |
3577 | - self.name = _("Unit Test") |
3578 | - self.note = _(""" |
3579 | + def __init__(self): |
3580 | + super(quality_test, self).__init__() |
3581 | + self.bool_installed_only = True |
3582 | + self.name = _("Unit Test") |
3583 | + self.note = _(""" |
3584 | This test checks the Unit Test(PyUnit) Cases of the module. Note that 'unit_test/test.py' is needed in module. |
3585 | |
3586 | """) |
3587 | - self.min_score = 0 |
3588 | - self.message = 'This test does not calculate score' |
3589 | - self.bool_count_score = False |
3590 | - return None |
3591 | - |
3592 | - def run_test(self, cr, uid, module_path): |
3593 | - pool = pooler.get_pool(cr.dbname) |
3594 | - module_name = module_path.split('/')[-1] |
3595 | - test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py' |
3596 | - if not os.path.isfile(test_file): |
3597 | - self.result += _("Module does not have 'unit_test/test.py' file") |
3598 | - return None |
3599 | - module_obj = pool.get('ir.module.module') |
3600 | - module_ids = module_obj.search(cr, uid, [('name', '=', module_name)]) |
3601 | - module = module_obj.browse(cr, uid, module_ids) |
3602 | - if not len(module): |
3603 | - self.result += _("Error! Module is not properly loaded/installed") |
3604 | - return None |
3605 | - module = module[0] |
3606 | - test = module.name + '.' + 'unit_test.test' |
3607 | - test_module = __import__(test) |
3608 | - test_file = getattr(test_module, 'unit_test') |
3609 | - test_obj = getattr(test_file, 'test') |
3610 | - |
3611 | - test_result = test_obj.runTest(cr,uid) |
3612 | - self.result = self.get_result(test_result) |
3613 | - self.result_details += self.get_result_details(test_result) |
3614 | - return None |
3615 | - |
3616 | - def get_result(self, data_list): |
3617 | - header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-40s \n', [_('Summary'), _('Status')]) |
3618 | - result_unit = {} |
3619 | - res_list = [] |
3620 | - if data_list[0]: |
3621 | - res = data_list[1].split('\n') |
3622 | - res_list.append(res[-4:][0]) |
3623 | - res_list.append(res[-4:][2]) |
3624 | - result_unit['unit_test'] = res_list |
3625 | - return self.format_table(header, data_list=result_unit) |
3626 | - return "Unit Test Fail" |
3627 | - |
3628 | - def get_result_details(self, data_list): |
3629 | - detail = '''<html><head>%s</head><body><table class="tablestyle"> |
3630 | - <tr><th class="tdatastyle">Test Cases</th ><th class="tdatastyle">Result</th>'''%(self.get_style()) |
3631 | - html = '' |
3632 | - |
3633 | - if data_list[0] == True: |
3634 | - data = data_list[1].split('... ok') |
3635 | - for case in map(lambda x:x[0].replace('\n',''),map(lambda x: x.split(' ('),data)): |
3636 | - if case.find('Ran') != -1: |
3637 | - case = case[case.index('Ran'):-2] |
3638 | - html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">OK</th></tr>'%(case) |
3639 | - else: |
3640 | - html += '<tr><td class="tdatastyle">%s</td><td class="tdatastyle">OK</td></tr>'%(case) |
3641 | - res = detail + html + '</table></body></html>' |
3642 | - return res |
3643 | - else: |
3644 | - detail_dict = {} |
3645 | - detail += '''<th class="tdatastyle">Details</th></tr>''' |
3646 | - data = data_list[1].split("======================================================================") |
3647 | - test = data[0].split('\n') |
3648 | - for err in (data_list[0].failures,data_list[0].errors): |
3649 | - for value in err: |
3650 | - detail_dict[value[0]._testMethodName] = value[1] |
3651 | - for case in map(lambda x:x.split('...'), test): |
3652 | - if len(case[0]) < 2: |
3653 | - continue |
3654 | - test_name = case[0].split(' (')[0] |
3655 | - if not detail_dict.has_key(test_name): |
3656 | - detail_dict[test_name] = '' |
3657 | - html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">%s</th><td class="tdatastyle">%s</td></tr>'%(test_name, case[1], detail_dict[test_name]) |
3658 | - return detail + html +'</tr></table></body></html>' |
3659 | - return '' |
3660 | - |
3661 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3662 | \ No newline at end of file |
3663 | + self.min_score = 0 |
3664 | + self.message = 'This test does not calculate score' |
3665 | + self.bool_count_score = False |
3666 | + self.test_suite = [] |
3667 | + return None |
3668 | + |
3669 | + def run_test(self, cr, uid, module_path): |
3670 | + pool = pooler.get_pool(cr.dbname) |
3671 | + module_name = module_path.split('/')[-1] |
3672 | + test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py' |
3673 | + if not os.path.isfile(test_file): |
3674 | + self.result += _("Module does not have 'unit_test/test.py' file") |
3675 | + return None |
3676 | + module_obj = pool.get('ir.module.module') |
3677 | + module_ids = module_obj.search(cr, uid, [('name', '=', module_name)]) |
3678 | + module = module_obj.browse(cr, uid, module_ids) |
3679 | + if not len(module): |
3680 | + self.result += _("Error! Module is not properly loaded/installed") |
3681 | + return None |
3682 | + module = module[0] |
3683 | + test = module.name + '.' + 'unit_test.test' |
3684 | + test_module = __import__(test) |
3685 | + test_file = getattr(test_module, 'unit_test') |
3686 | + test_obj = getattr(test_file, 'test') |
3687 | + |
3688 | + out = StringIO() |
3689 | + for name in dir(test_obj): |
3690 | + obj = getattr(test_obj, name) |
3691 | + if isinstance(obj, (type, types.ClassType)): |
3692 | + testcase = obj |
3693 | + if not issubclass(testcase, unittest.TestCase): |
3694 | + self.result += _("Test cases should be derived from unittest.TestCase") |
3695 | + return None |
3696 | + |
3697 | + self.get_suites(cr,uid,testcase) |
3698 | + suite = OpenERPTestLoader().loadTestsFromTestCase(testcase,cr,uid) |
3699 | + self.test_suite.append(suite) |
3700 | + finalsuite = unittest.TestSuite() |
3701 | + for suite in self.test_suite: |
3702 | + finalsuite.addTest(suite) |
3703 | + res = unittest.TextTestRunner(stream=out,verbosity=2).run(finalsuite) |
3704 | + if res.wasSuccessful(): |
3705 | + test_result = (True,out.getvalue()) |
3706 | + else: |
3707 | + test_result = (res,out.getvalue()) |
3708 | + self.result = self.get_result(test_result) |
3709 | + self.result_details += self.get_result_details(test_result) |
3710 | + return None |
3711 | + |
3712 | + def get_suites(self,cr,uid,object): |
3713 | + if 'third_party_cases' in dir(object): |
3714 | + for testclass,case in object.third_party_cases.items(): |
3715 | + self.get_suites(cr,uid,testclass) |
3716 | + third_party_suite = unittest.TestSuite() |
3717 | + for test in case: |
3718 | + third_party_suite.addTest(testclass(cr,uid,test)) |
3719 | + self.test_suite.append(third_party_suite) |
3720 | + return True |
3721 | + |
3722 | + def get_result(self, data_list): |
3723 | + header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-40s \n', [_('Summary'), _('Status')]) |
3724 | + result_unit = {} |
3725 | + res_list = [] |
3726 | + if data_list[0]: |
3727 | + res = data_list[1].split('\n') |
3728 | + res_list.append(res[-4:][0]) |
3729 | + res_list.append(res[-4:][2]) |
3730 | + result_unit['unit_test'] = res_list |
3731 | + return self.format_table(header, data_list=result_unit) |
3732 | + return "Unit Test Fail" |
3733 | + |
3734 | + def get_result_details(self, data_list): |
3735 | + detail = '''<html><head>%s</head><body><table class="tablestyle"> |
3736 | + <tr><th class="tdatastyle">Test Cases</th ><th class="tdatastyle">Result</th>'''%(self.get_style()) |
3737 | + html = '' |
3738 | + |
3739 | + if data_list[0] == True: |
3740 | + data = data_list[1].split('... ok') |
3741 | + for case in map(lambda x:x[0].replace('\n',''),map(lambda x: x.split(' ('),data)): |
3742 | + if case.find('Ran') != -1: |
3743 | + case = case[case.index('Ran'):-2] |
3744 | + html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">OK</th></tr>'%(case) |
3745 | + else: |
3746 | + html += '<tr><td class="tdatastyle">%s</td><td class="tdatastyle">OK</td></tr>'%(case) |
3747 | + res = detail + html + '</table></body></html>' |
3748 | + return res |
3749 | + else: |
3750 | + detail_dict = {} |
3751 | + detail += '''<th class="tdatastyle">Details</th></tr>''' |
3752 | + data = data_list[1].split("======================================================================") |
3753 | + test = data[0].split('\n') |
3754 | + for err in (data_list[0].failures,data_list[0].errors): |
3755 | + for value in err: |
3756 | + detail_dict[value[0]._testMethodName] = value[1] |
3757 | + for case in map(lambda x:x.split('...'), test): |
3758 | + if len(case[0]) < 2: |
3759 | + continue |
3760 | + test_name = case[0].split(' (')[0] |
3761 | + if not detail_dict.has_key(test_name): |
3762 | + detail_dict[test_name] = '' |
3763 | + html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">%s</th><td class="tdatastyle">%s</td></tr>'%(test_name, case[1], detail_dict[test_name]) |
3764 | + return detail + html +'</tr></table></body></html>' |
3765 | + return '' |
3766 | + |
3767 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3768 | |
3769 | === added directory 'crm/unit_test' |
3770 | === added file 'crm/unit_test/__init__.py' |
3771 | --- crm/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
3772 | +++ crm/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
3773 | @@ -0,0 +1,22 @@ |
3774 | +# -*- coding: utf-8 -*- |
3775 | +############################################################################## |
3776 | +# |
3777 | +# OpenERP, Open Source Management Solution |
3778 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3779 | +# |
3780 | +# This program is free software: you can redistribute it and/or modify |
3781 | +# it under the terms of the GNU Affero General Public License as |
3782 | +# published by the Free Software Foundation, either version 3 of the |
3783 | +# License, or (at your option) any later version. |
3784 | +# |
3785 | +# This program is distributed in the hope that it will be useful, |
3786 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3787 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3788 | +# GNU Affero General Public License for more details. |
3789 | +# |
3790 | +# You should have received a copy of the GNU Affero General Public License |
3791 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3792 | +# |
3793 | +############################################################################## |
3794 | + |
3795 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3796 | \ No newline at end of file |
3797 | |
3798 | === added file 'crm/unit_test/test.py' |
3799 | --- crm/unit_test/test.py 1970-01-01 00:00:00 +0000 |
3800 | +++ crm/unit_test/test.py 2010-03-08 07:28:31 +0000 |
3801 | @@ -0,0 +1,189 @@ |
3802 | +# -*- coding: utf-8 -*- |
3803 | +############################################################################## |
3804 | +# |
3805 | +# OpenERP, Open Source Management Solution |
3806 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3807 | +# |
3808 | +# This program is free software: you can redistribute it and/or modify |
3809 | +# it under the terms of the GNU Affero General Public License as |
3810 | +# published by the Free Software Foundation, either version 3 of the |
3811 | +# License, or (at your option) any later version. |
3812 | +# |
3813 | +# This program is distributed in the hope that it will be useful, |
3814 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3815 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3816 | +# GNU Affero General Public License for more details. |
3817 | +# |
3818 | +# You should have received a copy of the GNU Affero General Public License |
3819 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3820 | +# |
3821 | +############################################################################## |
3822 | +import unittest |
3823 | +import pooler |
3824 | +import netsvc |
3825 | +from osv import osv |
3826 | + |
3827 | +section_id = None |
3828 | +case_category_id = None |
3829 | +case_rule_id = None |
3830 | +section_id_2 = None |
3831 | +case_id = None |
3832 | +segmentation_id = None |
3833 | +segmentation_line_id = None |
3834 | + |
3835 | +class crm_test_case(unittest.TestCase): |
3836 | + |
3837 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
3838 | + self.cr = cursor |
3839 | + self.uid = user |
3840 | + unittest.TestCase.__init__(self, methodName) |
3841 | + |
3842 | + def setUp(self): |
3843 | + try: |
3844 | + self.pool = pooler.get_pool(self.cr.dbname) |
3845 | + self.crm_case_section = self.pool.get('crm.case.section') |
3846 | + self.crm_case_categ = self.pool.get('crm.case.categ') |
3847 | + self.crm_case_rule = self.pool.get('crm.case.rule') |
3848 | + self.crm_case = self.pool.get('crm.case') |
3849 | + self.crm_segmentation = self.pool.get('crm.segmentation') |
3850 | + self.crm_segmentation_line = self.pool.get('crm.segmentation.line') |
3851 | + except osv.except_osv,e: |
3852 | + self.fail(e.name + e.value) |
3853 | + except Exception,e: |
3854 | + self.fail(e) |
3855 | + |
3856 | + def tearDown(self): |
3857 | + try: |
3858 | + self.pool = None |
3859 | + self.crm_case_section = None |
3860 | + self.crm_case_categ = None |
3861 | + self.crm_case_rule = None |
3862 | + self.crm_case = None |
3863 | + self.crm_segmentation = None |
3864 | + self.crm_segmentation_line = None |
3865 | + except osv.except_osv,e: |
3866 | + self.fail(e.name + e.value) |
3867 | + except Exception,e: |
3868 | + self.fail(e) |
3869 | + |
3870 | + def test_1_Create(self): |
3871 | + try: |
3872 | + global section_id,section_id_2,case_category_id,case_rule_id,case_id,segmentation_id,segmentation_line_id,partner_id,picking_ids,categ_id,res |
3873 | + res = {} |
3874 | + model_obj = self.pool.get('ir.model.data') |
3875 | + |
3876 | + user = self.pool.get('res.users').search(self.cr,self.uid,[('name','=','Administrator')]) |
3877 | + user_id = self.pool.get('res.users').browse(self.cr,self.uid,user)[0] |
3878 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
3879 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
3880 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9') |
3881 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
3882 | + categ = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_category_2') |
3883 | + categ_id = model_obj.browse(self.cr, self.uid,categ).res_id |
3884 | + |
3885 | + # Section |
3886 | + section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'My Section','code':'mysect', |
3887 | + 'sequence':0,}) |
3888 | + section_id_2 = self.crm_case_section.create(self.cr,self.uid,{'name':'My Client Section','code':'myclsect', |
3889 | + 'sequence':0,}) |
3890 | + # Case Category |
3891 | + case_category_id = self.crm_case_categ.create(self.cr,self.uid,{'section_id':section_id,'name':'Client Installation'}) |
3892 | + |
3893 | + # Case Rule |
3894 | + case_rule_id = self.crm_case_rule.create(self.cr,self.uid,{'name':'My Rule','trg_state_from':'draft', |
3895 | + 'trg_section_id':section_id, |
3896 | + 'trg_user_id':user_id.id, |
3897 | + 'act_state':'open','act_section_id':section_id_2}) |
3898 | + |
3899 | + # CRM Case |
3900 | + case_id = self.crm_case.create(self.cr,self.uid,{'name':'Client server problem','section_id':section_id, |
3901 | + 'partner_id':partner_id,'partner_address_id':partner_address_id, |
3902 | + 'user_id':user_id.id}) |
3903 | + |
3904 | + ## Segmentation |
3905 | + segmentation_id = self.crm_segmentation.create(self.cr,self.uid,{'name':'My Segmentation', |
3906 | + 'description':'Developing new segmentation for the client', |
3907 | + 'categ_id':categ_id}) |
3908 | + |
3909 | + segmentation_line_id = self.crm_segmentation_line.create(self.cr,self.uid,{'segmentation_id':segmentation_id, |
3910 | + 'name':'My segment line', |
3911 | + 'expr_name':'sale', |
3912 | + 'expr_operator':'>', |
3913 | + 'expr_value':500,'operator':'and'}) |
3914 | + |
3915 | + except osv.except_osv,e: |
3916 | + self.fail(e.name + e.value) |
3917 | + except Exception,e: |
3918 | + self.fail(e) |
3919 | + |
3920 | + |
3921 | + def test_2_CaseOpen(self): |
3922 | + try: |
3923 | + self.failUnless(case_id,"No Case Created !") |
3924 | + self.crm_case.case_open(self.cr,self.uid,[case_id]) |
3925 | + except osv.except_osv,e: |
3926 | + self.fail(e.name + e.value) |
3927 | + except Exception,e: |
3928 | + self.fail(e) |
3929 | + |
3930 | + def test_3_CasePending(self): |
3931 | + try: |
3932 | + self.failUnless(case_id,"No Case Created !") |
3933 | + self.crm_case.case_pending(self.cr,self.uid,[case_id]) |
3934 | + except osv.except_osv,e: |
3935 | + self.fail(e.name + e.value) |
3936 | + except Exception,e: |
3937 | + self.fail(e) |
3938 | + |
3939 | + def test_4_CaseClose(self): |
3940 | + try: |
3941 | + self.failUnless(case_id,"No Case Created !") |
3942 | + self.crm_case.case_close(self.cr,self.uid,[case_id]) |
3943 | + except osv.except_osv,e: |
3944 | + self.fail(e.name + e.value) |
3945 | + except Exception,e: |
3946 | + self.fail(e) |
3947 | + |
3948 | + def test_5_CaseReset(self): |
3949 | + try: |
3950 | + self.failUnless(case_id,"No Case Created !") |
3951 | + self.crm_case.case_reset(self.cr,self.uid,[case_id]) |
3952 | + except osv.except_osv,e: |
3953 | + self.fail(e.name + e.value) |
3954 | + except Exception,e: |
3955 | + self.fail(e) |
3956 | + |
3957 | + def test_6_SegmentationProcessStrat(self): |
3958 | + try: |
3959 | + self.failUnless(segmentation_id,"No Segmentation Created !") |
3960 | + self.crm_segmentation.process_start(self.cr,self.uid,[segmentation_id]) |
3961 | + except osv.except_osv,e: |
3962 | + self.fail(e.name + e.value) |
3963 | + except Exception,e: |
3964 | + self.fail(e) |
3965 | + |
3966 | + def test_7_RemoveCategory(self): |
3967 | + try: |
3968 | + self.failUnless(case_id,"No Case Created !") |
3969 | + self.cr.execute("delete from res_partner_category_rel where partner_id = %s and category_id = %s", (partner_id,categ_id)) |
3970 | + except osv.except_osv,e: |
3971 | + self.fail(e.name + e.value) |
3972 | + except Exception,e: |
3973 | + self.fail(e) |
3974 | + |
3975 | + def test_8_Unlink(self): |
3976 | + try: |
3977 | + self.failUnless(case_id,"No Case Created !") |
3978 | + self.crm_case.unlink(self.cr,self.uid,[case_id]) |
3979 | + self.crm_case_rule.unlink(self.cr,self.uid,[case_rule_id]) |
3980 | + self.crm_case_categ.unlink(self.cr,self.uid,[case_category_id]) |
3981 | + self.crm_case_section.unlink(self.cr,self.uid,[section_id_2]) |
3982 | + self.crm_case_section.unlink(self.cr,self.uid,[section_id]) |
3983 | + self.crm_segmentation_line.unlink(self.cr,self.uid,[segmentation_line_id]) |
3984 | + self.crm_segmentation.unlink(self.cr,self.uid,[segmentation_id]) |
3985 | + except osv.except_osv,e: |
3986 | + self.fail(e.name + e.value) |
3987 | + except Exception,e: |
3988 | + self.fail(e) |
3989 | + |
3990 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3991 | |
3992 | === added directory 'crm_configuration' |
3993 | === added directory 'crm_configuration/unit_test' |
3994 | === added file 'crm_configuration/unit_test/__init__.py' |
3995 | --- crm_configuration/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
3996 | +++ crm_configuration/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
3997 | @@ -0,0 +1,22 @@ |
3998 | +# -*- coding: utf-8 -*- |
3999 | +############################################################################## |
4000 | +# |
4001 | +# OpenERP, Open Source Management Solution |
4002 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4003 | +# |
4004 | +# This program is free software: you can redistribute it and/or modify |
4005 | +# it under the terms of the GNU Affero General Public License as |
4006 | +# published by the Free Software Foundation, either version 3 of the |
4007 | +# License, or (at your option) any later version. |
4008 | +# |
4009 | +# This program is distributed in the hope that it will be useful, |
4010 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4011 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4012 | +# GNU Affero General Public License for more details. |
4013 | +# |
4014 | +# You should have received a copy of the GNU Affero General Public License |
4015 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4016 | +# |
4017 | +############################################################################## |
4018 | + |
4019 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4020 | \ No newline at end of file |
4021 | |
4022 | === added file 'crm_configuration/unit_test/test.py' |
4023 | --- crm_configuration/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4024 | +++ crm_configuration/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4025 | @@ -0,0 +1,165 @@ |
4026 | +# -*- coding: utf-8 -*- |
4027 | +############################################################################## |
4028 | +# |
4029 | +# OpenERP, Open Source Management Solution |
4030 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4031 | +# |
4032 | +# This program is free software: you can redistribute it and/or modify |
4033 | +# it under the terms of the GNU Affero General Public License as |
4034 | +# published by the Free Software Foundation, either version 3 of the |
4035 | +# License, or (at your option) any later version. |
4036 | +# |
4037 | +# This program is distributed in the hope that it will be useful, |
4038 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4039 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4040 | +# GNU Affero General Public License for more details. |
4041 | +# |
4042 | +# You should have received a copy of the GNU Affero General Public License |
4043 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4044 | +# |
4045 | +############################################################################## |
4046 | + |
4047 | +import unittest |
4048 | +import pooler |
4049 | +import netsvc |
4050 | +from osv import osv |
4051 | +import time |
4052 | +import crm.unit_test.test as crm |
4053 | + |
4054 | + |
4055 | +meeting_stage_id = [] |
4056 | +oppor_stage_id = [] |
4057 | +meeting_section_id = None |
4058 | +opportunity_section_id = None |
4059 | + |
4060 | +class crm_configuration_test_case(unittest.TestCase): |
4061 | + |
4062 | + third_party_cases={crm.crm_test_case: ['test_1_Create']} |
4063 | + |
4064 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
4065 | + self.cr = cursor |
4066 | + self.uid = user |
4067 | + unittest.TestCase.__init__(self, methodName) |
4068 | + |
4069 | + def setUp(self): |
4070 | + try: |
4071 | + self.pool = pooler.get_pool(self.cr.dbname) |
4072 | + self.crm_case_stage = self.pool.get('crm.case.stage') |
4073 | + self.crm_case_section = self.pool.get('crm.case.section') |
4074 | + self.crm_case_categ = self.pool.get('crm.case.categ') |
4075 | + self.crm_case_rule = self.pool.get('crm.case.rule') |
4076 | + self.crm_case = self.pool.get('crm.case') |
4077 | + self.crm_segmentation = self.pool.get('crm.segmentation') |
4078 | + self.crm_segmentation_line = self.pool.get('crm.segmentation.line') |
4079 | + |
4080 | + except osv.except_osv,e: |
4081 | + self.fail(e.name + e.value) |
4082 | + except Exception,e: |
4083 | + self.fail(e) |
4084 | + |
4085 | + def tearDown(self): |
4086 | + try: |
4087 | + self.pool = None |
4088 | + self.crm_case_stage = None |
4089 | + self.crm_case = None |
4090 | + self.crm_case_section |
4091 | + self.crm_case_categ = None |
4092 | + self.crm_case_rule = None |
4093 | + self.crm_segmentation = None |
4094 | + self.crm_segmentation_line = None |
4095 | + except osv.except_osv,e: |
4096 | + self.fail(e.name + e.value) |
4097 | + except Exception,e: |
4098 | + self.fail(e) |
4099 | + |
4100 | + def test_1_create(self): |
4101 | + try: |
4102 | + global meeting_stage_id,meeting_section_id,opportunity_section_id,oppor_stage_id |
4103 | + meeting_stage_id = [] |
4104 | + oppor_stage_id = [] |
4105 | + |
4106 | + meeting_section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'Meeting','code':'Mtngs','sequence':0}) |
4107 | + opportunity_section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'Opportunity','code':'oppor','sequence':0}) |
4108 | + for name in ['Fixed','Not Fixed']: |
4109 | + meeting = self.crm_case_stage.create(self.cr,self.uid,{'name':name,'section_id':meeting_section_id}) |
4110 | + meeting_stage_id.append(meeting) |
4111 | + oppor = self.crm_case_stage.create(self.cr,self.uid,{'name':name,'section_id':opportunity_section_id}) |
4112 | + oppor_stage_id.append(oppor) |
4113 | + self.crm_case.write(self.cr,self.uid,[crm.case_id],vals = {'partner_name':'New Client '}) |
4114 | + except osv.except_osv,e: |
4115 | + self.fail(e.name + e.value) |
4116 | + except Exception,e: |
4117 | + self.fail(e) |
4118 | + |
4119 | + def test_2_createPartner(self): |
4120 | + try: |
4121 | + self.cr.commit() |
4122 | + self.failUnless(meeting_stage_id,"No Case Stage Created !") |
4123 | + wizard_service = netsvc.ExportService.getService("wizard") |
4124 | + wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.partner_create') |
4125 | + datas = {'form': {'close': 0}, 'ids': [crm.case_id],'id': crm.case_id } |
4126 | + state = 'confirm' |
4127 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4128 | + except osv.except_osv,e: |
4129 | + self.fail(e.name + e.value) |
4130 | + except Exception,e: |
4131 | + self.fail(e) |
4132 | + |
4133 | + def test_3_createMeeting(self): |
4134 | + try: |
4135 | + self.cr.commit() |
4136 | + self.failUnless(meeting_stage_id,"No Case Stage Created !") |
4137 | + wizard_service = netsvc.ExportService.getService("wizard") |
4138 | + wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.meeting') |
4139 | + datas = {'form': {'date': time.strftime('%Y-%m-%d %H:%M:%S'), 'duration': 2.0}, 'ids': [crm.case_id], 'report_type': 'pdf', 'model': 'crm.case', 'id': crm.case_id} |
4140 | + state = 'order' |
4141 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4142 | + except osv.except_osv,e: |
4143 | + self.fail(e.name + e.value) |
4144 | + except Exception,e: |
4145 | + self.fail(e) |
4146 | + |
4147 | + def test_4_createOpportunity(self): |
4148 | + try: |
4149 | + self.cr.commit() |
4150 | + self.failUnless(meeting_stage_id,"No Case Stage Created !") |
4151 | + wizard_service = netsvc.ExportService.getService("wizard") |
4152 | + wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.opportunity_set') |
4153 | + state='init' |
4154 | + datas={'form':{},'ids': [crm.case_id], 'report_type': 'pdf', 'model': 'crm.case', 'id':crm.case_id} |
4155 | + while state != 'end': |
4156 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4157 | + if 'datas' in res: |
4158 | + datas['form'].update( res['datas'].get('form',{}) ) |
4159 | + if res['type']=='form': |
4160 | + for field in res['fields'].keys(): |
4161 | + datas['form'][field] = res['datas'][field] |
4162 | + state = res['state'][-1][0] |
4163 | + elif res['type']=='action': |
4164 | + state = res['state'] |
4165 | + except osv.except_osv,e: |
4166 | + self.fail(e.name + e.value) |
4167 | + except Exception,e: |
4168 | + self.fail(e) |
4169 | + |
4170 | + def test_5_Unlink(self): |
4171 | + try: |
4172 | + self.failUnless(meeting_stage_id,"No Case Stage Created !") |
4173 | + self.crm_case.unlink(self.cr,self.uid,[crm.case_id]) |
4174 | + self.crm_case_rule.unlink(self.cr,self.uid,[crm.case_rule_id]) |
4175 | + self.crm_case_categ.unlink(self.cr,self.uid,[crm.case_category_id]) |
4176 | + self.crm_case_section.unlink(self.cr,self.uid,[crm.section_id_2] + [crm.section_id]) |
4177 | + self.crm_segmentation_line.unlink(self.cr,self.uid,[crm.segmentation_line_id]) |
4178 | + self.crm_segmentation.unlink(self.cr,self.uid,[crm.segmentation_id]) |
4179 | + self.crm_case_stage.unlink(self.cr,self.uid,meeting_stage_id) |
4180 | + self.crm_case_stage.unlink(self.cr,self.uid,oppor_stage_id) |
4181 | + sect = self.crm_case.search(self.cr,self.uid,[('section_id','in',[meeting_section_id,opportunity_section_id])]) |
4182 | + self.crm_case.unlink(self.cr,self.uid,sect) |
4183 | + self.crm_case_section.unlink(self.cr,self.uid,[meeting_section_id]+[opportunity_section_id]) |
4184 | + self.pool.get('res.partner').unlink(self.cr,self.uid,[res['action']['res_id']]) |
4185 | + except osv.except_osv,e: |
4186 | + self.fail(e.name + e.value) |
4187 | + except Exception,e: |
4188 | + self.fail(e) |
4189 | + |
4190 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4191 | |
4192 | === added directory 'crm_profiling/unit_test' |
4193 | === added file 'crm_profiling/unit_test/__init__.py' |
4194 | --- crm_profiling/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4195 | +++ crm_profiling/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
4196 | @@ -0,0 +1,22 @@ |
4197 | +# -*- coding: utf-8 -*- |
4198 | +############################################################################## |
4199 | +# |
4200 | +# OpenERP, Open Source Management Solution |
4201 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4202 | +# |
4203 | +# This program is free software: you can redistribute it and/or modify |
4204 | +# it under the terms of the GNU Affero General Public License as |
4205 | +# published by the Free Software Foundation, either version 3 of the |
4206 | +# License, or (at your option) any later version. |
4207 | +# |
4208 | +# This program is distributed in the hope that it will be useful, |
4209 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4210 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4211 | +# GNU Affero General Public License for more details. |
4212 | +# |
4213 | +# You should have received a copy of the GNU Affero General Public License |
4214 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4215 | +# |
4216 | +############################################################################## |
4217 | + |
4218 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4219 | |
4220 | === added file 'crm_profiling/unit_test/test.py' |
4221 | --- crm_profiling/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4222 | +++ crm_profiling/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4223 | @@ -0,0 +1,138 @@ |
4224 | +# -*- coding: utf-8 -*- |
4225 | +############################################################################## |
4226 | +# |
4227 | +# OpenERP, Open Source Management Solution |
4228 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4229 | +# |
4230 | +# This program is free software: you can redistribute it and/or modify |
4231 | +# it under the terms of the GNU Affero General Public License as |
4232 | +# published by the Free Software Foundation, either version 3 of the |
4233 | +# License, or (at your option) any later version. |
4234 | +# |
4235 | +# This program is distributed in the hope that it will be useful, |
4236 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4237 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4238 | +# GNU Affero General Public License for more details. |
4239 | +# |
4240 | +# You should have received a copy of the GNU Affero General Public License |
4241 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4242 | +# |
4243 | +############################################################################## |
4244 | + |
4245 | +import unittest |
4246 | +import pooler |
4247 | +import netsvc |
4248 | +from osv import osv |
4249 | + |
4250 | +questionnaire_id = None |
4251 | +question_1 = None |
4252 | +choice_ids = None |
4253 | + |
4254 | +class crm_profiling_test_case(unittest.TestCase): |
4255 | + |
4256 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
4257 | + self.cr = cursor |
4258 | + self.uid = user |
4259 | + unittest.TestCase.__init__(self, methodName) |
4260 | + |
4261 | + def setUp(self): |
4262 | + try: |
4263 | + self.pool = pooler.get_pool(self.cr.dbname) |
4264 | + self.crm_profiling_question = self.pool.get('crm_profiling.question') |
4265 | + self.crm_profiling_questionnaire = self.pool.get('crm_profiling.questionnaire') |
4266 | + self.crm_profiling_answer = self.pool.get('crm_profiling.answer') |
4267 | + self.crm_segmentation = self.pool.get('crm.segmentation') |
4268 | + self.crm_segmentation_line = self.pool.get('crm.segmentation.line') |
4269 | + except osv.except_osv,e: |
4270 | + self.fail(e.name + e.value) |
4271 | + except Exception,e: |
4272 | + self.fail(e) |
4273 | + |
4274 | + def tearDown(self): |
4275 | + try: |
4276 | + self.pool = None |
4277 | + self.crm_profiling_question = None |
4278 | + self.crm_profiling_questionnaire = None |
4279 | + self.crm_profiling_answer = None |
4280 | + self.crm_segmentation = None |
4281 | + self.crm_segmentation_line = None |
4282 | + except osv.except_osv,e: |
4283 | + self.fail(e.name + e.value) |
4284 | + except Exception,e: |
4285 | + self.fail(e) |
4286 | + |
4287 | + def test_1_create(self): |
4288 | + try: |
4289 | + global questionnaire_id,question_ids,choice_ids,segmentation_id,segmentation_line_id,partner_id,categ_id |
4290 | + question_ids = [] |
4291 | + choice_ids = [] |
4292 | + model_obj = self.pool.get('ir.model.data') |
4293 | + |
4294 | + categ = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_category_2') |
4295 | + categ_id = model_obj.browse(self.cr, self.uid,categ).res_id |
4296 | + parent = model_obj._get_id(self.cr, self.uid, 'crm_profiling', 'crm_segmentation6') |
4297 | + parent_id = model_obj.browse(self.cr, self.uid,parent).res_id |
4298 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
4299 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
4300 | + |
4301 | + # Questions |
4302 | + quest =['Which ERP has best Accounting module','Which ERP has higher marketing value'] |
4303 | + for question in quest: |
4304 | + question_1 = self.crm_profiling_question.create(self.cr,self.uid,{'name' :question}) |
4305 | + for choice in ['OpenERP','MSDY','MSDY']: |
4306 | + choice_1 = self.crm_profiling_answer.create(self.cr,self.uid,{'name':'MSDY','question_id':question_1}) |
4307 | + choice_ids.append(choice_1) |
4308 | + question_ids.append(question_1) |
4309 | + questionnaire_id = self.crm_profiling_questionnaire.create(self.cr,self.uid,{'name':'ERP Compare', |
4310 | + 'description':'ERP marketing questionnaire', |
4311 | + 'questions_ids':[(6,0,question_ids)]}) |
4312 | + |
4313 | + ## Segmentation |
4314 | + segmentation_id = self.crm_segmentation.create(self.cr,self.uid,{'name':'My Segmentation', |
4315 | + 'description':'Developing new segmentation for the client', |
4316 | + 'categ_id':categ_id, |
4317 | + 'parent_id':parent_id, |
4318 | + 'answer_yes':[(6,0,choice_ids[0:3])]}) |
4319 | + |
4320 | + segmentation_line_id = self.crm_segmentation_line.create(self.cr,self.uid,{'segmentation_id':segmentation_id, |
4321 | + 'name':'My segment line', |
4322 | + 'expr_name':'sale', |
4323 | + 'expr_operator':'>', |
4324 | + 'expr_value':500,'operator':'and'}) |
4325 | + except osv.except_osv,e: |
4326 | + self.fail(e.name + e.value) |
4327 | + except Exception,e: |
4328 | + self.fail(e) |
4329 | + |
4330 | + def test_2_SegmentationProcessStrat(self): |
4331 | + try: |
4332 | + self.failUnless(segmentation_id,"No Segmentation Created !") |
4333 | + self.crm_segmentation.process_start(self.cr,self.uid,[segmentation_id]) |
4334 | + except osv.except_osv,e: |
4335 | + self.fail(e.name + e.value) |
4336 | + except Exception,e: |
4337 | + self.fail(e) |
4338 | + |
4339 | + def test_3_RemoveCategory(self): |
4340 | + try: |
4341 | + self.failUnless(segmentation_id,"No Segmentation Created !") |
4342 | + self.cr.execute("delete from res_partner_category_rel where partner_id = %s and category_id = %s", (partner_id,categ_id)) |
4343 | + except osv.except_osv,e: |
4344 | + self.fail(e.name + e.value) |
4345 | + except Exception,e: |
4346 | + self.fail(e) |
4347 | + |
4348 | + def test_4_Unlink(self): |
4349 | + try: |
4350 | + self.failUnless(segmentation_id,"No Segmentation Created !") |
4351 | + self.crm_segmentation_line.unlink(self.cr,self.uid,[segmentation_line_id]) |
4352 | + self.crm_segmentation.unlink(self.cr,self.uid,[segmentation_id]) |
4353 | + self.crm_profiling_answer.unlink(self.cr,self.uid,choice_ids) |
4354 | + self.crm_profiling_question.unlink(self.cr,self.uid,question_ids) |
4355 | + self.crm_profiling_questionnaire.unlink(self.cr,self.uid,[questionnaire_id]) |
4356 | + except osv.except_osv,e: |
4357 | + self.fail(e.name + e.value) |
4358 | + except Exception,e: |
4359 | + self.fail(e) |
4360 | + |
4361 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4362 | |
4363 | === added directory 'delivery/unit_test' |
4364 | === added file 'delivery/unit_test/__init__.py' |
4365 | --- delivery/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4366 | +++ delivery/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
4367 | @@ -0,0 +1,22 @@ |
4368 | +# -*- coding: utf-8 -*- |
4369 | +############################################################################## |
4370 | +# |
4371 | +# OpenERP, Open Source Management Solution |
4372 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4373 | +# |
4374 | +# This program is free software: you can redistribute it and/or modify |
4375 | +# it under the terms of the GNU Affero General Public License as |
4376 | +# published by the Free Software Foundation, either version 3 of the |
4377 | +# License, or (at your option) any later version. |
4378 | +# |
4379 | +# This program is distributed in the hope that it will be useful, |
4380 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4381 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4382 | +# GNU Affero General Public License for more details. |
4383 | +# |
4384 | +# You should have received a copy of the GNU Affero General Public License |
4385 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4386 | +# |
4387 | +############################################################################## |
4388 | + |
4389 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4390 | \ No newline at end of file |
4391 | |
4392 | === added file 'delivery/unit_test/test.py' |
4393 | --- delivery/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4394 | +++ delivery/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4395 | @@ -0,0 +1,154 @@ |
4396 | +# -*- coding: utf-8 -*- |
4397 | +############################################################################## |
4398 | +# |
4399 | +# OpenERP, Open Source Management Solution |
4400 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4401 | +# |
4402 | +# This program is free software: you can redistribute it and/or modify |
4403 | +# it under the terms of the GNU Affero General Public License as |
4404 | +# published by the Free Software Foundation, either version 3 of the |
4405 | +# License, or (at your option) any later version. |
4406 | +# |
4407 | +# This program is distributed in the hope that it will be useful, |
4408 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4409 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4410 | +# GNU Affero General Public License for more details. |
4411 | +# |
4412 | +# You should have received a copy of the GNU Affero General Public License |
4413 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4414 | +# |
4415 | +############################################################################## |
4416 | +import unittest |
4417 | +import pooler |
4418 | +import netsvc |
4419 | +from osv import osv |
4420 | +import sale.unit_test.test as sale |
4421 | +import product.unit_test.test as prod |
4422 | + |
4423 | + |
4424 | +delivery_id = None |
4425 | + |
4426 | +class delivery_test_case(unittest.TestCase): |
4427 | + |
4428 | + third_party_cases={sale.sale_order_test_case: ['test_1_Create']} |
4429 | + |
4430 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
4431 | + self.cr = cursor |
4432 | + self.uid = user |
4433 | + unittest.TestCase.__init__(self, methodName) |
4434 | + |
4435 | + def setUp(self): |
4436 | + try: |
4437 | + self.pool = pooler.get_pool(self.cr.dbname) |
4438 | + self.sale_order = self.pool.get('sale.order') |
4439 | + self.delivery_carrier = self.pool.get('delivery.carrier') |
4440 | + self.delivery_grid = self.pool.get('delivery.grid') |
4441 | + self.delivery_grid_line = self.pool.get('delivery.grid.line') |
4442 | + self.stock_picking=self.pool.get('stock.picking') |
4443 | + self.stock_move=self.pool.get('stock.move') |
4444 | + except osv.except_osv,e: |
4445 | + self.fail(e.name + e.value) |
4446 | + except Exception,e: |
4447 | + self.fail(e) |
4448 | + |
4449 | + def tearDown(self): |
4450 | + try: |
4451 | + self.pool = None |
4452 | + self.sale_order = None |
4453 | + self.product_pricelist = None |
4454 | + self.delivery_carrier = None |
4455 | + self.delivery_grid = None |
4456 | + self.delivery_grid_line = None |
4457 | + self.stock_picking= None |
4458 | + self.stock_move= None |
4459 | + except osv.except_osv,e: |
4460 | + self.fail(e.name + e.value) |
4461 | + except Exception,e: |
4462 | + self.fail(e) |
4463 | + |
4464 | + def test_1_Create(self): |
4465 | + |
4466 | + try: |
4467 | + global order_id,delivery_id,sale_order_line_id,grid_line_id |
4468 | + model_obj = self.pool.get('ir.model.data') |
4469 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
4470 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
4471 | + pricelist_id = self.pool.get('res.partner').browse(self.cr, self.uid,partner_id).property_product_pricelist.id |
4472 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2') |
4473 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
4474 | + delivery_id = self.delivery_carrier.create(self.cr,self.uid,{'name':'Test','product_id':product_id, |
4475 | + 'partner_id':partner_id,}) |
4476 | + self.sale_order.write(self.cr,self.uid,sale.order_id,{'carrier_id':delivery_id}) |
4477 | + delivery_grid_id=self.delivery_grid.create(self.cr,self.uid,{'name':'Test-Pricelist','carrier_id':delivery_id,}) |
4478 | + grid_line_id=self.delivery_grid_line.create(self.cr,self.uid,{'name':'Test-grid-line', |
4479 | + 'grid_id':delivery_grid_id, |
4480 | + 'type':'price','operator':'=', |
4481 | + 'max_value':300.00, |
4482 | + 'price_type':'variable', |
4483 | + 'variable_factor':'weight', |
4484 | + 'list_price':100.00, |
4485 | + 'standard_price':20.00}) |
4486 | + |
4487 | + except osv.except_osv,e: |
4488 | + self.fail(e.name + e.value) |
4489 | + except Exception,e: |
4490 | + self.fail(e) |
4491 | + |
4492 | + def test_2_ConfirmOrder(self): |
4493 | + try: |
4494 | + self.failUnless(sale.order_id,"No Sale Order Created !") |
4495 | + wf_service = netsvc.LocalService("workflow") |
4496 | + res = wf_service.trg_validate(self.uid, 'sale.order',sale.order_id, 'order_confirm', self.cr) |
4497 | + except osv.except_osv,e: |
4498 | + self.fail(e.name + e.value) |
4499 | + except Exception,e: |
4500 | + self.fail(e) |
4501 | + |
4502 | + def test_3_check_avalibility_Order(self): |
4503 | + try: |
4504 | + global stock_pick_id |
4505 | + self.failUnless(sale.order_id,"No Sale Order Created !") |
4506 | + stock_pick = self.stock_picking.search(self.cr,self.uid,[('sale_id','=',sale.order_id)]) |
4507 | + stock_pick_id = self.stock_picking.browse(self.cr,self.uid,stock_pick)[0] |
4508 | + self.stock_picking.write(self.cr,self.uid,[stock_pick_id.id],{'type':'delivery'}) |
4509 | + self.stock_picking.force_assign(self.cr,self.uid,[stock_pick_id.id]) |
4510 | + except osv.except_osv,e: |
4511 | + self.fail(e.name + e.value) |
4512 | + except Exception,e: |
4513 | + self.fail(e) |
4514 | + |
4515 | + def test_4_wizard_test(self): |
4516 | + try: |
4517 | + self.cr.commit() |
4518 | + wizard_service = netsvc.ExportService.getService("wizard") |
4519 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'stock.partial_picking') |
4520 | + stock_mov = self.stock_move.search(self.cr,self.uid,[('picking_id','=',stock_pick_id.id)]) |
4521 | + stock_move_id=self.stock_move.browse(self.cr,self.uid,stock_mov)[0] |
4522 | + move_id = 'move'+ str(stock_move_id.id) |
4523 | + datas = {'form': {'moves': [stock_move_id.id], move_id: 6.0}, 'ids': [stock_pick_id.id], 'id':stock_pick_id.id} |
4524 | + state = 'split' |
4525 | + res = wizard_service.exp_execute(self.cr.dbname, self.uid,wizard_res , datas, state, {}) |
4526 | + except osv.except_osv,e: |
4527 | + self.fail(e.name + e.value) |
4528 | + except Exception,e: |
4529 | + self.fail(e) |
4530 | + |
4531 | + def test_5_Unlink(self): |
4532 | + try: |
4533 | + self.failUnless(sale.order_id,"No Sales Order Created !") |
4534 | + self.pool.get('stock.picking').unlink(self.cr, self.uid, [stock_pick_id.id]) |
4535 | + self.sale_order.action_cancel(self.cr, self.uid, [sale.order_id]) |
4536 | + self.sale_order.unlink(self.cr, self.uid, [sale.order_id]) |
4537 | + self.delivery_grid_line.unlink(self.cr,self.uid,grid_line_id) |
4538 | + self.delivery_carrier.unlink(self.cr,self.uid,delivery_id) |
4539 | + self.pool.get('product.product').unlink(self.cr,self.uid,[prod.product_id]) |
4540 | + self.pool.get('product.pricelist.item').unlink(self.cr, self.uid,[prod.product_pricelist_items_id]) |
4541 | + self.pool.get('product.pricelist.version').unlink(self.cr,self.uid,[prod.product_pricelist_version_id]) |
4542 | + self.pool.get('product.pricelist').unlink(self.cr,self.uid,[prod.product_pricelist_id]) |
4543 | + self.pool.get('product.pricelist.type').unlink(self.cr,self.uid,[prod.pricelist_type_id]) |
4544 | + except osv.except_osv,e: |
4545 | + self.fail(e.name + e.value) |
4546 | + except Exception,e: |
4547 | + self.fail(e) |
4548 | + |
4549 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4550 | |
4551 | === added directory 'event/unit_test' |
4552 | === added file 'event/unit_test/__init__.py' |
4553 | --- event/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4554 | +++ event/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
4555 | @@ -0,0 +1,22 @@ |
4556 | +# -*- coding: utf-8 -*- |
4557 | +############################################################################## |
4558 | +# |
4559 | +# OpenERP, Open Source Management Solution |
4560 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4561 | +# |
4562 | +# This program is free software: you can redistribute it and/or modify |
4563 | +# it under the terms of the GNU Affero General Public License as |
4564 | +# published by the Free Software Foundation, either version 3 of the |
4565 | +# License, or (at your option) any later version. |
4566 | +# |
4567 | +# This program is distributed in the hope that it will be useful, |
4568 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4569 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4570 | +# GNU Affero General Public License for more details. |
4571 | +# |
4572 | +# You should have received a copy of the GNU Affero General Public License |
4573 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4574 | +# |
4575 | +############################################################################## |
4576 | + |
4577 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4578 | \ No newline at end of file |
4579 | |
4580 | === added file 'event/unit_test/test.py' |
4581 | --- event/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4582 | +++ event/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4583 | @@ -0,0 +1,182 @@ |
4584 | +# -*- coding: utf-8 -*- |
4585 | +############################################################################## |
4586 | +# |
4587 | +# OpenERP, Open Source Management Solution |
4588 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4589 | +# |
4590 | +# This program is free software: you can redistribute it and/or modify |
4591 | +# it under the terms of the GNU Affero General Public License as |
4592 | +# published by the Free Software Foundation, either version 3 of the |
4593 | +# License, or (at your option) any later version. |
4594 | +# |
4595 | +# This program is distributed in the hope that it will be useful, |
4596 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4597 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4598 | +# GNU Affero General Public License for more details. |
4599 | +# |
4600 | +# You should have received a copy of the GNU Affero General Public License |
4601 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4602 | +# |
4603 | +############################################################################## |
4604 | + |
4605 | +import unittest |
4606 | +import pooler |
4607 | +import netsvc |
4608 | +from osv import osv |
4609 | +import datetime |
4610 | +import time |
4611 | + |
4612 | +event_id = None |
4613 | +registration_id = None |
4614 | + |
4615 | + |
4616 | +class event_test_case(unittest.TestCase): |
4617 | + |
4618 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
4619 | + self.cr = cursor |
4620 | + self.uid = user |
4621 | + unittest.TestCase.__init__(self, methodName) |
4622 | + |
4623 | + def setUp(self): |
4624 | + try: |
4625 | + self.pool = pooler.get_pool(self.cr.dbname) |
4626 | + self.event_event = self.pool.get('event.event') |
4627 | + self.event_registration = self.pool.get('event.registration') |
4628 | + except osv.except_osv,e: |
4629 | + self.fail(e.name + e.value) |
4630 | + except Exception,e: |
4631 | + self.fail(e) |
4632 | + |
4633 | + def tearDown(self): |
4634 | + try: |
4635 | + self.pool = None |
4636 | + self.event_event = None |
4637 | + self.event_registration = None |
4638 | + except osv.except_osv,e: |
4639 | + self.fail(e.name + e.value) |
4640 | + except Exception,e: |
4641 | + self.fail(e) |
4642 | + |
4643 | + def test_1_create(self): |
4644 | + try: |
4645 | + global event_id,registration_id |
4646 | + model_obj = self.pool.get('ir.model.data') |
4647 | + |
4648 | + product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2') |
4649 | + product_id = model_obj.browse(self.cr, self.uid, product).res_id |
4650 | + event_parent = model_obj._get_id(self.cr,self.uid, 'event', 'event_0') |
4651 | + event_parent_id = model_obj.browse(self.cr, self.uid, event_parent).res_id |
4652 | + partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9') |
4653 | + partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id |
4654 | + partner_address = model_obj._get_id(self.cr, self.uid, 'base_contact', 'res_partner_contact_simonis0') |
4655 | + partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id |
4656 | + |
4657 | + event_id = self.event_event.create(self.cr,self.uid,{'name':'My Event', |
4658 | + 'date_begin':time.strftime('%Y-%m-%d %H:%M:%S'), |
4659 | + 'date_end':datetime.date.today() + datetime.timedelta(days=2), |
4660 | + 'product_id':product_id, |
4661 | + 'register_max':500, |
4662 | + 'register_min':25, |
4663 | + 'parent_id':event_parent_id, |
4664 | + 'mail_auto_confirm':1,'reply_to':'vir@tinyerp.com'}) |
4665 | + |
4666 | + |
4667 | + registration_id = self.event_registration.create(self.cr,self.uid,{'event_id':event_id,'partner_id':partner_id, |
4668 | + 'contact_id':partner_address_id, |
4669 | + 'invoice_label':'Event Invoice', |
4670 | + 'partner_invoice_id':partner_id}) |
4671 | + self.cr.commit() |
4672 | + except osv.except_osv,e: |
4673 | + self.fail(e.name + e.value) |
4674 | + except Exception,e: |
4675 | + self.fail(e) |
4676 | + |
4677 | + def test_2_ConfirmRegistration(self): |
4678 | + try: |
4679 | + self.cr.commit() |
4680 | + self.failUnless(registration_id,"No registration Created !") |
4681 | + wizard_service = netsvc.ExportService.getService("wizard") |
4682 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.confirm_registration') |
4683 | + datas = {'model': 'event.registration', 'form': {}, 'id':registration_id ,'ids': [registration_id]} |
4684 | + state = 'init' |
4685 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4686 | + except osv.except_osv,e: |
4687 | + self.fail(e.name + e.value) |
4688 | + except Exception,e: |
4689 | + self.fail |
4690 | + |
4691 | + def test_3_RegistrationClose(self): |
4692 | + try: |
4693 | + self.cr.commit() |
4694 | + self.failUnless(registration_id,"No registration Created !") |
4695 | + self.event_registration.button_reg_close(self.cr,self.uid,[registration_id]) |
4696 | + except osv.except_osv,e: |
4697 | + self.fail(e.name + e.value) |
4698 | + except Exception,e: |
4699 | + self.fail |
4700 | + |
4701 | + def test_4_makeInvoice(self): |
4702 | + try: |
4703 | + global res2 |
4704 | + self.cr.commit() |
4705 | + self.failUnless(registration_id,"No registration Created !") |
4706 | + wizard_service = netsvc.ExportService.getService("wizard") |
4707 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.reg_make_invoice') |
4708 | + datas = {'model': 'event.registration', 'form': {}, 'id': registration_id, 'ids': [registration_id]} |
4709 | + state = 'init' |
4710 | + res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4711 | + except osv.except_osv,e: |
4712 | + self.fail(e.name + e.value) |
4713 | + except Exception,e: |
4714 | + self.fail |
4715 | + |
4716 | + def test_5_ListRegisteredPartner(self): |
4717 | + try: |
4718 | + self.cr.commit() |
4719 | + self.failUnless(event_id,"No Event Created !") |
4720 | + wizard_service = netsvc.ExportService.getService("wizard") |
4721 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, passwd, 'event.event_reg_partners') |
4722 | + datas = {'model': 'event.event', 'form': {}, 'id': event_id, 'ids': [event_id]} |
4723 | + state = 'init' |
4724 | + res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4725 | + except osv.except_osv,e: |
4726 | + self.fail(e.name + e.value) |
4727 | + except Exception,e: |
4728 | + self.fail |
4729 | + |
4730 | + def test_6_Registrations(self): |
4731 | + try: |
4732 | + self.cr.commit() |
4733 | + self.failUnless(event_id,"No Event Created !") |
4734 | + wizard_service = netsvc.ExportService.getService("wizard") |
4735 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard_event_registration') |
4736 | + datas = {'model': 'event.event', 'form': {}, 'id': event_id, 'ids': [event_id]} |
4737 | + state = 'init' |
4738 | + res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4739 | + except osv.except_osv,e: |
4740 | + self.fail(e.name + e.value) |
4741 | + except Exception,e: |
4742 | + self.fail |
4743 | + |
4744 | + def test_7_EventDone(self): |
4745 | + try: |
4746 | + self.cr.commit() |
4747 | + self.failUnless(event_id,"No Event Created !") |
4748 | + self.event_event.button_done(self.cr,self.uid,[event_id]) |
4749 | + except osv.except_osv,e: |
4750 | + self.fail(e.name + e.value) |
4751 | + except Exception,e: |
4752 | + self.fail(e) |
4753 | + |
4754 | + def test_8_Unlink(self): |
4755 | + try: |
4756 | + self.failUnless(event_id,"No Event Created !") |
4757 | + self.event_registration.unlink(self.cr,self.uid,[registration_id]) |
4758 | + self.event_event.unlink(self.cr,self.uid,[event_id]) |
4759 | + self.pool.get('account.invoice').unlink(self.cr,self.uid,res2['datas']['invoice_ids']) |
4760 | + except osv.except_osv,e: |
4761 | + self.fail(e.name + e.value) |
4762 | + except Exception,e: |
4763 | + self.fail(e) |
4764 | + |
4765 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4766 | |
4767 | === added directory 'event_project/unit_test' |
4768 | === added file 'event_project/unit_test/__init__.py' |
4769 | --- event_project/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4770 | +++ event_project/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
4771 | @@ -0,0 +1,22 @@ |
4772 | +# -*- coding: utf-8 -*- |
4773 | +############################################################################## |
4774 | +# |
4775 | +# OpenERP, Open Source Management Solution |
4776 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4777 | +# |
4778 | +# This program is free software: you can redistribute it and/or modify |
4779 | +# it under the terms of the GNU Affero General Public License as |
4780 | +# published by the Free Software Foundation, either version 3 of the |
4781 | +# License, or (at your option) any later version. |
4782 | +# |
4783 | +# This program is distributed in the hope that it will be useful, |
4784 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4785 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4786 | +# GNU Affero General Public License for more details. |
4787 | +# |
4788 | +# You should have received a copy of the GNU Affero General Public License |
4789 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4790 | +# |
4791 | +############################################################################## |
4792 | + |
4793 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4794 | \ No newline at end of file |
4795 | |
4796 | === added file 'event_project/unit_test/test.py' |
4797 | --- event_project/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4798 | +++ event_project/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4799 | @@ -0,0 +1,149 @@ |
4800 | +# -*- coding: utf-8 -*- |
4801 | +############################################################################## |
4802 | +# |
4803 | +# OpenERP, Open Source Management Solution |
4804 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4805 | +# |
4806 | +# This program is free software: you can redistribute it and/or modify |
4807 | +# it under the terms of the GNU Affero General Public License as |
4808 | +# published by the Free Software Foundation, either version 3 of the |
4809 | +# License, or (at your option) any later version. |
4810 | +# |
4811 | +# This program is distributed in the hope that it will be useful, |
4812 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4813 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4814 | +# GNU Affero General Public License for more details. |
4815 | +# |
4816 | +# You should have received a copy of the GNU Affero General Public License |
4817 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4818 | +# |
4819 | +############################################################################## |
4820 | +import unittest |
4821 | +import pooler |
4822 | +import netsvc |
4823 | +from osv import osv |
4824 | +import event.unit_test.test as event_proj |
4825 | + |
4826 | +class event_project_test_case(unittest.TestCase): |
4827 | + |
4828 | + third_party_cases={event_proj.event_test_case: ['test_1_create']} |
4829 | + |
4830 | + def __init__(self, cursor=False,user=False,methodName='runTest'): |
4831 | + self.cr = cursor |
4832 | + self.uid = user |
4833 | + unittest.TestCase.__init__(self, methodName) |
4834 | + |
4835 | + def setUp(self): |
4836 | + try: |
4837 | + self.pool = pooler.get_pool(self.cr.dbname) |
4838 | + self.event_event = self.pool.get('event.event') |
4839 | + self.event_registration = self.pool.get('event.registration') |
4840 | + except osv.except_osv,e: |
4841 | + self.fail(e.name + e.value) |
4842 | + except Exception,e: |
4843 | + self.fail(e) |
4844 | + |
4845 | + def tearDown(self): |
4846 | + try: |
4847 | + self.pool = None |
4848 | + self.event_event = None |
4849 | + self.event_registration = None |
4850 | + except osv.except_osv,e: |
4851 | + self.fail(e.name + e.value) |
4852 | + except Exception,e: |
4853 | + self.fail(e) |
4854 | + |
4855 | + def test_1_CreateRetroPlanning(self): |
4856 | + try: |
4857 | + self.cr.commit() |
4858 | + wizard_service = netsvc.ExportService.getService("wizard") |
4859 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.project') |
4860 | + datas = {'form': {'project_id': 3}, 'ids': [event_proj.event_id], 'id': event_proj.event_id} |
4861 | + state = 'done' |
4862 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4863 | + except osv.except_osv,e: |
4864 | + self.fail(e.name + e.value) |
4865 | + except Exception,e: |
4866 | + self.fail |
4867 | + |
4868 | + def test_2_ConfirmRegistration(self): |
4869 | + try: |
4870 | + self.cr.commit() |
4871 | + wizard_service = netsvc.ExportService.getService("wizard") |
4872 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.confirm_registration') |
4873 | + datas = {'model': 'event.registration', 'form': {}, 'id':event_proj.registration_id , 'ids': [event_proj.registration_id]} |
4874 | + state = 'init' |
4875 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4876 | + except osv.except_osv,e: |
4877 | + self.fail(e.name + e.value) |
4878 | + except Exception,e: |
4879 | + self.fail |
4880 | + |
4881 | + def test_3_RegistrationClose(self): |
4882 | + try: |
4883 | + self.failUnless(event_proj.event_id,"No Event Created !") |
4884 | + self.event_registration.button_reg_close(self.cr,self.uid,[event_proj.registration_id]) |
4885 | + except osv.except_osv,e: |
4886 | + self.fail(e.name + e.value) |
4887 | + except Exception,e: |
4888 | + self.fail |
4889 | + |
4890 | + def test_4_makeInvoice(self): |
4891 | + try: |
4892 | + self.cr.commit() |
4893 | + wizard_service = netsvc.ExportService.getService("wizard") |
4894 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.reg_make_invoice') |
4895 | + datas = {'model': 'event.registration', 'form': {}, 'id': event_proj.registration_id,'ids': [event_proj.registration_id]} |
4896 | + state = 'init' |
4897 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4898 | + except osv.except_osv,e: |
4899 | + self.fail(e.name + e.value) |
4900 | + except Exception,e: |
4901 | + self.fail |
4902 | + |
4903 | + def test_5_ListRegisteredPartner(self): |
4904 | + try: |
4905 | + self.cr.commit() |
4906 | + wizard_service = netsvc.ExportService.getService("wizard") |
4907 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.event_reg_partners') |
4908 | + datas = {'model': 'event.event', 'form': {}, 'id': event_proj.event_id, 'ids': [event_proj.event_id]} |
4909 | + state = 'init' |
4910 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4911 | + except osv.except_osv,e: |
4912 | + self.fail(e.name + e.value) |
4913 | + except Exception,e: |
4914 | + self.fail |
4915 | + |
4916 | + def test_6_Registrations(self): |
4917 | + try: |
4918 | + self.cr.commit() |
4919 | + wizard_service = netsvc.ExportService.getService("wizard") |
4920 | + wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard_event_registration') |
4921 | + datas = {'model': 'event.event', 'form': {}, 'id': event_proj.event_id, 'ids': [event_proj.event_id]} |
4922 | + state = 'init' |
4923 | + wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {}) |
4924 | + except osv.except_osv,e: |
4925 | + self.fail(e.name + e.value) |
4926 | + except Exception,e: |
4927 | + self.fail |
4928 | + |
4929 | + def test_7_EventDone(self): |
4930 | + try: |
4931 | + self.failUnless(event_proj.event_id,"No Event Created !") |
4932 | + self.event_event.button_done(self.cr,self.uid,[event_proj.event_id]) |
4933 | + except osv.except_osv,e: |
4934 | + self.fail(e.name + e.value) |
4935 | + except Exception,e: |
4936 | + self.fail(e) |
4937 | + |
4938 | + def test_8_Unlink(self): |
4939 | + try: |
4940 | + self.failUnless(event_proj.event_id,"No Event Created !") |
4941 | + self.event_registration.unlink(self.cr,self.uid,[event_proj.registration_id]) |
4942 | + self.event_event.unlink(self.cr,self.uid,[event_proj.event_id]) |
4943 | + except osv.except_osv,e: |
4944 | + self.fail(e.name + e.value) |
4945 | + except Exception,e: |
4946 | + self.fail(e) |
4947 | + |
4948 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4949 | |
4950 | === added directory 'hr/unit_test' |
4951 | === added file 'hr/unit_test/__init__.py' |
4952 | --- hr/unit_test/__init__.py 1970-01-01 00:00:00 +0000 |
4953 | +++ hr/unit_test/__init__.py 2010-03-08 07:28:31 +0000 |
4954 | @@ -0,0 +1,23 @@ |
4955 | +# -*- coding: utf-8 -*- |
4956 | +############################################################################## |
4957 | +# |
4958 | +# OpenERP, Open Source Management Solution |
4959 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4960 | +# |
4961 | +# This program is free software: you can redistribute it and/or modify |
4962 | +# it under the terms of the GNU Affero General Public License as |
4963 | +# published by the Free Software Foundation, either version 3 of the |
4964 | +# License, or (at your option) any later version. |
4965 | +# |
4966 | +# This program is distributed in the hope that it will be useful, |
4967 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4968 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4969 | +# GNU Affero General Public License for more details. |
4970 | +# |
4971 | +# You should have received a copy of the GNU Affero General Public License |
4972 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4973 | +# |
4974 | +############################################################################## |
4975 | + |
4976 | + |
4977 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4978 | |
4979 | === added file 'hr/unit_test/test.py' |
4980 | --- hr/unit_test/test.py 1970-01-01 00:00:00 +0000 |
4981 | +++ hr/unit_test/test.py 2010-03-08 07:28:31 +0000 |
4982 | @@ -0,0 +1,104 @@ |
4983 | +# -*- coding: utf-8 -*- |
4984 | +############################################################################## |
4985 | +# |
4986 | +# OpenERP, Open Source Management Solution |
4987 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4988 | +# |
4989 | +# This program is free software: you can redistribute it and/or modify |
4990 | +# it under the terms of the GNU Affero General Public License as |
4991 | +# published by the Free Software Foundation, either version 3 of the |
4992 | +# License, or (at your option) any later version. |
4993 | +# |
4994 | +# This program is distributed in the hope that it will be useful, |
4995 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4996 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4997 | +# GNU Affero General Public License for more details. |
4998 | +# |
4999 | +# You should have received a copy of the GNU Affero General Public License |
5000 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
The diff has been truncated for viewing.
Hello, module.
This branch consists unit test cases for the addons modules. which will be used to perform unit test in base_quality_
regards,
nch(OpenERP)