Merge lp:~openerp-commiter/openobject-addons/UnitTestCases into lp:openobject-addons

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
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+15732@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,
This branch consists unit test cases for the addons modules. which will be used to perform unit test in base_quality_module.

regards,
nch(OpenERP)

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
=== added directory 'account/unit_test'
=== added file 'account/unit_test/__init__.py'
--- account/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account/unit_test/test.py'
--- account/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,374 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23from osv import osv
24import netsvc
25import time
26import product.unit_test.test as prod
27
28invoice_invoice_ids=None
29invoice_line_ids=None
30period_id=None
31case_journal_id=None
32sale_journal_id=None
33purchase_journal_id=None
34account_account_id=None
35account_account_types=None
36partner_id=None
37account_tax_id=None
38account_payment_term_line_id=None
39account_payment_term_id=None
40
41class account(unittest.TestCase):
42 third_party_cases={prod.product_test_case: ['test_1_Create']}
43 def __init__(self, cursor=False,user=False,methodName='runTest'):
44 self.cr = cursor
45 self.uid = user
46 unittest.TestCase.__init__(self, methodName)
47
48 def setUp(self):
49 try:
50 self.pool = pooler.get_pool(self.cr.dbname)
51 self.account_account = self.pool.get('account.account')
52 self.account_invoice = self.pool.get('account.invoice')
53 self.account_move = self.pool.get('account.move')
54 self.account_move_line = self.pool.get('account.move.line')
55 self.account_invoice_line = self.pool.get('account.invoice.line')
56 self.wf_service = netsvc.LocalService("workflow")
57 self.wizard_service = netsvc.ExportService.getService("wizard")
58 except osv.except_osv,e:
59 self.fail(e.name + e.value)
60 except Exception,e:
61 self.fail(e)
62
63 def tearDown(self):
64 try:
65 self.pool = None
66 self.account_move = None
67 self.account_move_line = None
68 self.account_invoice = None
69 self.account_invoice_line = None
70 self.wf_service = None
71 self.wizard_service = None
72 self.passwd = None
73 except osv.except_osv,e:
74 self.fail(e.name + e.value)
75 except Exception,e:
76 self.fail(e)
77
78
79 def test_1_creat_payment_term(self):
80 try:
81 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
82 #Create Payment Term
83 account_payment_term_id = self.pool.get('account.payment.term').create(self.cr,self.uid,{'name':'Payment Term Unit test'})
84 account_payment_term_line_id = self.pool.get('account.payment.term.line').create(self.cr,self.uid,{
85 'name':'Payment term unit test by',
86 'sequence':1,
87 'value':'procent',
88 'value_amount':0.20,
89 'days': 20,
90 'days2':-1,
91 'payment_id':account_payment_term_id,
92 })
93
94 #Create Tax
95 account_tax_id = self.pool.get('account.tax').create(self.cr,self.uid,{'name':'VAT(Unit test)','amount':0.1200})
96
97 #Create Account Type
98 account_account_types=[]
99 types= ['expense','income','cash']
100 for type in types:
101 method = 'unreconciled'
102 if type == 'case':
103 method = 'balance'
104 account_type = self.pool.get('account.account.type').create(self.cr,self.uid,{
105 'name':'Test %s' % type.capitalize(),
106 'code':type,
107 'close_method':'unreconciled'})
108 account_account_types.append(account_type)
109
110 account_account_types.extend(account_account_types)
111 accounts = ['payable','receivable','other','other','other','other']
112 name = ['Test Main Payable','Test Main Receivable','Others','Test Product Purchase','Test Product Sale','Test Petty Cash']
113 code = ['x-10','x-20','x-30','x-40','x-50','x-60']
114 account_account_id = []
115 for seq in range(0,len(accounts)):
116 account_account = self.pool.get('account.account').create(self.cr,self.uid,{
117 'name':name[seq],
118 'code':code[seq],
119 'reconcile':True,
120 'type':accounts[seq],
121 'user_type':account_account_types[seq],
122 })
123 account_account_id.append(account_account)
124 model_obj = self.pool.get('ir.model.data')
125 sale_sequence = model_obj._get_id(self.cr,self.uid, 'account', 'sequence_sale_journal')
126 sale_sequence_id = model_obj.browse(self.cr, self.uid, sale_sequence).res_id
127
128 period = model_obj._get_id(self.cr,self.uid, 'account', 'period_11')
129 period_id = model_obj.browse(self.cr, self.uid, period).res_id
130
131 purchase_sequence = model_obj._get_id(self.cr,self.uid, 'account', 'sequence_purchase_journal')
132 purchase_sequence_id = model_obj.browse(self.cr, self.uid, purchase_sequence).res_id
133
134
135 case_sequence = model_obj._get_id(self.cr,self.uid,'account','sequence_journal')
136 case_sequence_id = model_obj.browse(self.cr,self.uid,case_sequence).res_id
137
138
139 view_id = self.pool.get('account.journal.view').search(self.cr,self.uid,[('name','=','Journal View')])[0]
140
141 #sale Journal
142 sale_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{
143 'name':'Sale Unit Test Journal',
144 'code':'STJ',
145 'view_id':view_id,
146 'sequence_id':sale_sequence_id,
147 'type':'sale',
148 'update_posted':True,
149 'default_credit_account_id':account_account_id[4],
150 'default_debit_account_id':account_account_id[4]})
151 #purchase journal
152 purchase_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{
153 'name':'Purchase Expense Unit Test Journal',
154 'code':'PTJ',
155 'view_id':view_id,
156 'sequence_id':purchase_sequence_id,
157 'type':'purchase',
158 'update_posted':True,
159 'default_credit_account_id':account_account_id[3],
160 'default_debit_account_id':account_account_id[3]})
161 view_case_id = self.pool.get('account.journal.view').search(self.cr,self.uid,[('name','=','Cash Journal View')])[0]
162 #case journal
163 case_journal_id = self.pool.get('account.journal').create(self.cr,self.uid,{
164 'name':'Case Unit Test Journal',
165 'code':'CTJ',
166 'view_id':view_case_id,
167 'sequence_id':case_sequence_id,
168 'type':'cash',
169 'update_posted':True,
170 'default_credit_account_id':account_account_id[5],
171 'default_debit_account_id':account_account_id[5]})
172 #Config Product
173 fields_sale_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','product.template'),('name','=','property_account_income')])
174 res_id = 'product.template,'+ str(prod.product_id)
175 sale_account_id = 'account.account,'+ str(account_account_id[4])
176 company_id = self.pool.get('res.company').search(self.cr,self.uid,[('name','=','Tiny sprl')])
177
178 property_sale_id = self.pool.get('ir.property').create(self.cr,self.uid,{
179 'fields_id':fields_sale_id[0],
180 'res_id':res_id,
181 'name':'property_account_income',
182 'value':sale_account_id,
183 'company_id':company_id[0]
184 })
185 fields_purchase_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','product.template'),('name','=','property_account_expense')])
186 purchase_account_id = 'account.account,'+ str(account_account_id[3])
187 property_purchase_id = self.pool.get('ir.property').create(self.cr,self.uid,{
188 'fields_id':fields_purchase_id[0],
189 'res_id':res_id,
190 'name':'property_account_expense',
191 'value':purchase_account_id,
192 'company_id':company_id[0]
193 })
194 #Config partner
195 partner_id = self.pool.get('res.partner').create(self.cr,self.uid,{
196 'name':'Unit test partner',
197 'supplier':True,
198 })
199 partner_address = self.pool.get('res.partner.address').create(self.cr,self.uid,{
200 'name':'Unit test Address',
201 'phone':'111-22222-33',
202 'type':'default',
203 'partner_id':partner_id
204 })
205 res_id = 'res.partner,'+ str(partner_id)
206 fields_partner_rece_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','res.partner'),('name','=','property_account_receivable')])
207 partner_rece_account_id = 'account.account,'+ str(account_account_id[1])
208 partner_rece_property_id = self.pool.get('ir.property').create(self.cr,self.uid,{
209 'fields_id':fields_partner_rece_id[0],
210 'res_id':res_id,
211 'name':'property_account_receivable',
212 'value':partner_rece_account_id,
213 'company_id':company_id[0]
214 })
215
216 fields_partner_pay_id = self.pool.get('ir.model.fields').search(self.cr,self.uid,[('model','=','res.partner'),('name','=','property_account_payable')])
217 partner_pay_account_id = 'account.account,'+ str(account_account_id[0])
218 partner_pay_property_id = self.pool.get('ir.property').create(self.cr,self.uid,{
219 'fields_id':fields_partner_pay_id[0],
220 'res_id':res_id,
221 'name':'property_account_payable',
222 'value':partner_pay_account_id,
223 'company_id':company_id[0]
224 })
225 #Create Customer Invoice
226 invoice_invoice_ids=[]
227 invoice_line_ids = []
228 types = {'out_invoice':sale_journal_id,'in_invoice':purchase_journal_id}
229 for key,val in types.items():
230 #Call Onchange Partner Id
231 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)
232 invoice_id = self.pool.get('account.invoice').create(self.cr,self.uid,{
233 'journal_id':val,
234 'address_invoice_id':res['value']['address_invoice_id'],
235 'partner_id':partner_id,
236 'type':key,
237 'address_contact_id':res['value']['address_contact_id'],
238 'account_id':res['value']['account_id'],
239 'payment_term':res['value']['payment_term']
240 })
241 invoice_invoice_ids.append(invoice_id)
242 uom = False
243 #Call Onchange Product Id
244 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)
245 if res1['value']['price_unit'] == False:
246 res1['value']['price_unit']=5000
247 invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid,{
248 'name':res1['value']['name'],
249 'uos_id':res1['value']['uos_id'],
250 'invoice_id':invoice_id,
251 'price_unit':res1['value']['price_unit'],
252 'account_id':res1['value']['account_id'],
253 'product_id':prod.product_id
254 })
255 invoice_line_ids.append(invoice_line_id)
256
257 except osv.except_osv,e:
258 self.fail(e.name + e.value)
259 except Exception,e:
260
261 self.fail(e)
262
263 def test_2_validate_customer_invoice(self):
264 try:
265 self.failUnless(len(invoice_invoice_ids),"No Customer Invoices Created !")
266 self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_invoice_ids[1],'invoice_open', self.cr)
267
268 except osv.except_osv,e:
0 self.fail(e.name + e.value)269 self.fail(e.name + e.value)
270 except Exception,e:
271 self.fail(e)
272
273 def test_3_validate_supplier_invoice(self):
274 try:
275 self.failUnless(len(invoice_invoice_ids),"No Supplier Invoices Created !")
276 self.account_invoice.button_compute(self.cr, self.uid,[invoice_invoice_ids[0]], context=None, set_total=True)
277 self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_invoice_ids[0],'invoice_open', self.cr)
278 except osv.except_osv,e:
1 self.fail(e.name + e.value)279 self.fail(e.name + e.value)
280 except Exception,e:
281 self.fail(e)
282
283 def test_4_pay_customer_invoice(self):
284 try:
285 self.cr.commit()
286 self.failUnless(len(invoice_invoice_ids),"No Supplier Invoices Created !")
287 invoice_rec = self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids[1])
288 wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.invoice.pay')
289 datas = {'form':{'name':'Unit Test Supplier Invoice Paid',
290 'amount': invoice_rec.residual,
291 'date': time.strftime('%Y-%m-%d'),
292 'period_id':period_id,'journal_id':case_journal_id},
293 'ids':[invoice_invoice_ids[1]],'id':invoice_invoice_ids[1]}
2 state = 'reconcile'294 state = 'reconcile'
295 self.wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
296 except osv.except_osv,e:
297 self.fail(e.name + e.value)
298 except Exception,e:
299 self.fail(e)
300
301
302 def test_5_pay_supplier_invoice(self):
303 try:
304 self.cr.commit()
305 self.failUnless(len(invoice_invoice_ids),"No Customer Invoices Created !")
306 invoice_rec = self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids[0])
307 wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.invoice.pay')
3 datas = {'form':308 datas = {'form':
309 {'name':'Unit Test Customer Invoice Paid',
310 'amount': invoice_rec.residual,
311 'date': time.strftime('%Y-%m-%d'),
312 'period_id':period_id,
313 'journal_id':case_journal_id },
314 'ids':[invoice_invoice_ids[0]],
315 'id':invoice_invoice_ids[0]}
4 state = 'reconcile'316 state = 'reconcile'
317 self.wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
318 except osv.except_osv,e:
319 self.fail(e.name + e.value)
320 except Exception,e:
321 self.fail(e)
322
323 def test_6_unreconcile_and_unlink_invoice(self):
5 try:324 try:
325 self.failUnless(len(invoice_invoice_ids),"No invoice Created !")
326 for invoice_rec in self.pool.get('account.invoice').browse(self.cr,self.uid,invoice_invoice_ids):
327 move = self.pool.get('account.move.line').browse(self.cr,self.uid,invoice_rec.payment_ids[0].id)
328 entries = self.pool.get('account.move.line').search(self.cr,self.uid,[('move_id','=',invoice_rec.move_id.id)])
329 entries.append(invoice_rec.payment_ids[0].id)
330 for entry in entries:
331 wizard_res = self.wizard_service.exp_create(self.cr.dbname, self.uid, 'account.move.line.unreconcile')
332 datas = {'form':{},'ids':[entry],'id':entry,'model':'account.move.line'}
333 state = 'unrec'
334 self.wizard_service.exp_execute(self.cr.dbname, self.uid,wizard_res , datas, state, {})
335 self.pool.get('account.move').unlink(self.cr,self.uid,[move.move_id.id])
336 self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_rec.id,'open_test', self.cr)
337 self.wf_service.trg_validate(self.uid, 'account.invoice',invoice_rec.id,'invoice_cancel',self.cr)
338 self.account_invoice.unlink(self.cr,self.uid,invoice_invoice_ids)
339 #unlink payment term
340 self.failUnless(account_payment_term_line_id,"No payment term line Created !")
341 self.pool.get('account.payment.term.line').unlink(self.cr,self.uid,[account_payment_term_line_id])
342
343 self.failUnless(account_payment_term_id,"No payment term Created !")
344 self.pool.get('account.payment.term').unlink(self.cr,self.uid,[account_payment_term_id])
345
346 #unlink accounts
347 self.failUnless(len(account_account_id),"No Account Created !")
348 self.account_account.unlink(self.cr,self.uid,account_account_id)
349
350 #unlink account types
351 self.failUnless(len(account_account_types),"No Account types Created !")
352 self.pool.get('account.account.type').unlink(self.cr,self.uid,account_account_types)
353
354 #unlink tax
355 self.failUnless(account_tax_id,"No Tax Created !")
356 self.pool.get('account.tax').unlink(self.cr,self.uid,[account_tax_id])
357
358 #unlink journal
359 self.pool.get('account.journal').unlink(self.cr,self.uid,[sale_journal_id,purchase_journal_id,case_journal_id])
360 #unlink product
361 self.failUnless(prod.product_id,"No Product Created !")
362 self.pool.get('product.product').unlink(self.cr,self.uid,[prod.product_id])
363 self.pool.get('product.pricelist.item').unlink(self.cr, self.uid,[prod.product_pricelist_items_id])
364 self.pool.get('product.pricelist.version').unlink(self.cr,self.uid,[prod.product_pricelist_version_id])
365 self.pool.get('product.pricelist').unlink(self.cr,self.uid,[prod.product_pricelist_id])
366 self.pool.get('product.pricelist.type').unlink(self.cr,self.uid,[prod.pricelist_type_id])
367 #unlink partner
368 self.pool.get('res.partner').unlink(self.cr,self.uid,[partner_id])
369 except osv.except_osv,e:
6 self.fail(e.name + e.value)370 self.fail(e.name + e.value)
371 except Exception,e:
372 self.fail(e)
373
374# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
375
376
377
378
379
380
381
7382
=== added directory 'account_analytic_analysis/unit_test'
=== added file 'account_analytic_analysis/unit_test/__init__.py'
--- account_analytic_analysis/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_analysis/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
024
=== added file 'account_analytic_analysis/unit_test/test.py'
--- account_analytic_analysis/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_analytic_analysis/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,123 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24from osv import osv
25import netsvc
26
27analytic_account_id =None
28
29class account_analytic_analysis(unittest.TestCase):
30 def __init__(self, cursor=False,user=False,methodName='runTest'):
31 self.cr = cursor
32 self.uid = user
33 unittest.TestCase.__init__(self, methodName)
34
35 def setUp(self):
36 try:
37 self.pool = pooler.get_pool(self.cr.dbname)
38 self.hr_anlalytic_timesheet = self.pool.get('hr.analytic.timesheet')
39 self.analytic_account = self.pool.get('account.analytic.account')
40 except osv.except_osv,e:
41 self.fail(e.name + e.value)
42 except Exception,e:
43 self.fail(e)
44
45 def tearDown(self):
46 try:
47 self.pool=None
48 self.hr_anlalytic_timesheet =None
49 self.analytic_account = None
50 except osv.except_osv,e:
51 self.fail(e.name + e.value)
52 except Exception,e:
53 self.fail(e)
54
55
56 def test_1_create_hr_analytic_timesheet(self):
57 try:
58 global analytic_account_id
59 model_obj = self.pool.get('ir.model.data')
60 analytic_account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_magasin_bml_1')
61 analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id
62 hr_timesheet_invoicing = model_obj._get_id(self.cr,self.uid,'hr_timesheet_invoice', 'timesheet_invoice_factor1')
63 product_pricelist = model_obj._get_id(self.cr,self.uid,'product','pricelist_type_sale')
64 product_pricelist_id = model_obj.browse(self.cr,self.uid,product_pricelist).res_id
65
66 hr_timesheet_invoicing_id =model_obj.browse(self.cr, self.uid, hr_timesheet_invoicing).res_id
67
68 hr_analytic_timesheet = self.hr_anlalytic_timesheet.create(self.cr,self.uid,{
69 'name':'Testing module',
70 'amount':50.00,
71 'account_id':analytic_account_id,
72 'unit_amount':5.00,
73 'to_invoice':hr_timesheet_invoicing_id
74 } )
75 self.analytic_account.write(self.cr,self.uid,[analytic_account_id],{
76 'pricelist_id':product_pricelist_id,
77 'quantity_max':500
78 })
79 self.cr.commit()
80 except osv.except_osv,e:
81 self.fail(e.name + e.value)
82 except Exception,e:
83 self.fail(e)
84
85 def test_2_timesheet_invoice(self):
86 try:
87 self.failUnless(analytic_account_id,"analytic account not found ")
88 wizard_service = netsvc.ExportService.getService("wizard")
89 wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid,'hr.timesheet.final.invoice.create')
90 datas = {'form': {'date': 1, 'price': 1, 'balance_product': 1, 'name': 1, 'time': 1}, 'ids': [analytic_account_id], 'id': analytic_account_id}
91 state = 'create'
92 res = wizard_service.exp_execute(self.cr.dbname,self.uid,wizard_res,datas,state,{})
93 except osv.except_osv,e:
94 self.fail(e.name + e.value)
95 except Exception,e:
96 self.fail(e)
97
98 def test_3_unlink_invoice(self):
99 try:
100 self.failUnless(analytic_account_id,"analytic account not found ")
101 analytic_line_id = self.pool.get("account.analytic.line").search(self.cr,self.uid,[('account_id','=',analytic_account_id)])
102 self.failUnless(analytic_line_id,"analytic account line not found !")
103 invoice_id = self.pool.get('account.analytic.line').browse(self.cr,self.uid,analytic_line_id)[0].invoice_id.id
104
105 self.failUnless(invoice_id,"invoice not created!")
106 self.pool.get('account.invoice').unlink(self.cr,self.uid,[invoice_id])
107
108 self.pool.get("account.analytic.line").unlink(self.cr,self.uid,analytic_line_id)
109 self.analytic_account.write(self.cr,self.uid,[analytic_account_id],{
110 'pricelist_id':False,
111 'quantity_max':False
112 })
113 except osv.except_osv,e:
114 self.fail(e.name + e.value)
115 except Exception,e:
116 self.fail(e)
117
118
119
120# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
121
122
123
0124
=== added directory 'account_analytic_default/unit_test'
=== added file 'account_analytic_default/unit_test/__init__.py'
--- account_analytic_default/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_default/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_analytic_default/unit_test/test.py'
--- account_analytic_default/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_analytic_default/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,162 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26import time
27
28account_analytic_default_id = None
29invoice_id = None
30sales_journal_id = None
31
32class account_analytic_default_test_case(unittest.TestCase):
33
34 def __init__(self, cursor=False,user=False,methodName='runTest'):
35 self.cr = cursor
36 self.uid = user
37 unittest.TestCase.__init__(self, methodName)
38
39 def setUp(self):
40 try:
41 self.pool = pooler.get_pool(self.cr.dbname)
42 self.account_analytic_default = self.pool.get('account.analytic.default')
43 self.account_invoice = self.pool.get('account.invoice')
44 except osv.except_osv,e:
45 self.fail(e.name + e.value)
46 except Exception,e:
47 self.fail(e)
48
49 def tearDown(self):
50 try:
51 self.account_analytic_default = None
52 self.account_invoice = None
53 except osv.except_osv,e:
54 self.fail(e.name + e.value)
55 except Exception,e:
56 self.fail(e)
57
58 def test_1_Create(self):
59 try:
60 global account_analytic_default_id,invoice_id,sales_journal_id
61 model_obj = self.pool.get('ir.model.data')
62 # Product
63 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1')
64 product_id = model_obj.browse(self.cr, self.uid, product).res_id
65 product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit')
66 product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id
67
68 # Analytic Account
69 account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1')
70 account_id = model_obj.browse(self.cr, self.uid, account).res_id
71
72 # Partner
73 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes')
74 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
75
76 # Company
77 company = model_obj._get_id(self.cr,self.uid, 'base', 'main_company')
78 company_id = model_obj.browse(self.cr, self.uid, company,).res_id
79
80 # Partners address
81 partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1')
82 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
83
84 # Account
85 receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv')
86 receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id
87 pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay')
88 pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id
89
90 # Analytic Journal
91 sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
92 sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id
93 analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale')
94 analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id
95
96 account_analytic_default_id = self.account_analytic_default.create(self.cr,self.uid,
97 {'sequence':1,
98 'analytic_id':account_id,
99 'product_id':product_id,
100 'partner_id':partner_id,
101 'user_id':self.uid,
102 'company_id':company_id,
103 'date_start':time.strftime('%Y-%m-%d'),
104 'date_stop':time.strftime('%Y-%m-%d')})
105 # Invoice
106 invoice_id = self.account_invoice.create(self.cr,self.uid,
107 {'name': 'Unit Test case Invoice',
108 'type': 'out_invoice',
109 'partner_id': partner_id,
110 'address_invoice_id': partner_address_id,
111 'address_contact_id': partner_address_id,
112 'account_id':receive_account_id,
113 })
114
115 result=self.pool.get('account.invoice.line').product_id_change(self.cr,self.uid, [], product_id,
116 product_uom_id, qty=2, name='Unit test case', type='out_invoice',
117 partner_id=partner_id, fposition=False, price_unit=False,
118 address_invoice_id=False, context={})
119
120 # Invoice line
121 invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid,
122 {'name' :'Unit Test Invoice Line',
123 'invoice_id':invoice_id,
124 'account_id':pay_account_id,
125 'product_id':product_id,
126 'price_unit':result['value']['price_unit'] ,
127 'quantity':4,
128 'account_analytic_id':result['value']['account_analytic_id'],
129 })
130 self.pool.get('account.journal').write(self.cr,self.uid,[sales_journal_id],{'analytic_journal_id':analytic_journal_id})
131 except osv.except_osv,e:
132 self.fail(e.name + e.value)
133 except Exception,e:
134 self.fail(e)
135
136 def test_2_CreateInvoice(self):
137 try:
138 self.failUnless(invoice_id,"No Invoice Created !")
139 wf_service = netsvc.LocalService("workflow")
140 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
141 except osv.except_osv,e:
142 self.fail(e.name + e.value)
143 except Exception,e:
144 self.fail(e)
145
146 def test_3_Unlink(self):
147 try:
148 self.failUnless(account_analytic_default_id,"No account_analytic Created !")
149 self.account_analytic_default.unlink(self.cr,self.uid,[account_analytic_default_id])
150 sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id)
151 wf_service = netsvc.LocalService("workflow")
152 if not sale_journal.update_posted:
153 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True})
154 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
155 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
156 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False})
157 except osv.except_osv,e:
158 self.fail(e.name + e.value)
159 except Exception,e:
160 self.fail(e)
161
162# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0163
=== added directory 'account_analytic_plans/unit_test'
=== added file 'account_analytic_plans/unit_test/__init__.py'
--- account_analytic_plans/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_analytic_plans/unit_test/test.py'
--- account_analytic_plans/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,178 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27analytic_plan_instance_id = None
28analytic_plan_id = None
29invoice_id = None
30
31class account_analytic_plans_test_case(unittest.TestCase):
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.account_analytic_plan_instance = self.pool.get('account.analytic.plan.instance')
42 self.account_analytic_plan_instance_line = self.pool.get('account.analytic.plan.instance.line')
43 self.account_analytic_plan = self.pool.get('account.analytic.plan')
44 self.account_analytic_plan_line = self.pool.get('account.analytic.plan.line')
45 self.account_invoice = self.pool.get('account.invoice')
46 self.account_invoice_line=self.pool.get('account.invoice.line')
47 except osv.except_osv,e:
48 self.fail(e.name + e.value)
49 except Exception,e:
50 self.fail(e)
51
52 def tearDown(self):
53 try:
54 self.account_analytic_plan_instance = None
55 self.account_analytic_plan_instance_line = None
56 self.account_analytic_plan = None
57 self.account_analytic_plan_line = None
58 self.account_invoice = None
59 self.account_invoice_line = None
60 except osv.except_osv,e:
61 self.fail(e.name + e.value)
62 except Exception,e:
63 self.fail(e)
64
65 def test_1_Create(self):
66 try:
67 global invoice_id,sales_journal_id,analytic_plan_instance_id,analytic_plan_id
68 model_obj = self.pool.get('ir.model.data')
69 # Product
70 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1')
71 product_id = model_obj.browse(self.cr, self.uid, product).res_id
72 product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit')
73 product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id
74
75 # Analytic Account
76 account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1')
77 account_id = model_obj.browse(self.cr, self.uid, account).res_id
78 account_2 = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_2')
79 account_id_2 = model_obj.browse(self.cr, self.uid, account_2).res_id
80 # Partner
81 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes')
82 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
83
84 # Partners address
85 partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1')
86 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
87
88 # Account
89 receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv')
90 receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id
91
92 pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay')
93 pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id
94
95 # Analytic Journal
96 analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale')
97 analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id
98
99 # Account Analytic Plan
100 analytic_plan_id = self.account_analytic_plan.create(self.cr,self.uid,
101 {'name':'Unit test analytic plan'})
102 # Analytic plan Instance
103 analytic_plan_instance_id = self.account_analytic_plan_instance.create(self.cr,self.uid,
104 {'name':'Unit test Analytic Distribution',
105 'code':'Unit test AD',
106 'journal_id':analytic_journal_id,
107 'plan_id':analytic_plan_id})
108
109 # Account Analytic Plan Lines
110 for acc,rate in [(account_id,10.00),(account_id_2,50.00)]:
111 self.account_analytic_plan_line.create(self.cr,self.uid,
112 {'plan_id':analytic_plan_id,
113 'name':'First',
114 'sequence':0,
115 'root_analytic_id':acc,
116 'min_required':rate,
117 'max_required':100.00})
118 # Analytic plan Instance Line
119 self.account_analytic_plan_instance_line.create(self.cr,self.uid,
120 {'plan_id':analytic_plan_instance_id,
121 'analytic_account_id':acc,
122 'rate':rate})
123 # Invoice
124 invoice_id = self.account_invoice.create(self.cr,self.uid,
125 {'name': 'Unit Test case Invoice',
126 'type': 'out_invoice',
127 'partner_id': partner_id,
128 'address_invoice_id': partner_address_id,
129 'address_contact_id': partner_address_id,
130 'account_id':receive_account_id,
131 })
132
133 # Invoice line
134 self.account_invoice_line.create(self.cr,self.uid,
135 {'name':'Unit Test Invoice Line',
136 'invoice_id':invoice_id,
137 'uos_id':product_uom_id,
138 'product_id':product_id,
139 'account_id':pay_account_id,
140 'price_unit':400,
141 'quantity':10,
142 'analytics_id':analytic_plan_instance_id})
143
144 except osv.except_osv,e:
145 self.fail(e.name + e.value)
146 except Exception,e:
147 self.fail(e)
148
149 def test_2_CreateInvoice(self):
150 try:
151 self.failUnless(invoice_id,"No Invoice Created !")
152 wf_service = netsvc.LocalService("workflow")
153 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
154 except osv.except_osv,e:
155 self.fail(e.name + e.value)
156 except Exception,e:
157 self.fail(e)
158
159 def test_3_Unlink(self):
160 try:
161 self.failUnless(invoice_id,"No Invoice Created !")
162 sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')])
163 self.failUnless(sale_journal,"No sale_journal Found !")
164 sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0]
165 wf_service = netsvc.LocalService("workflow")
166 if not sale_journal_id.update_posted:
167 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True})
168 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
169 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
170 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False})
171 self.account_analytic_plan_instance.unlink(self.cr,self.uid,[analytic_plan_instance_id])
172 self.account_analytic_plan.unlink(self.cr,self.uid,[analytic_plan_id])
173 except osv.except_osv,e:
174 self.fail(e.name + e.value)
175 except Exception,e:
176 self.fail(e)
177
178# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0179
=== added directory 'account_balance'
=== added directory 'account_balance/unit_test'
=== added file 'account_balance/unit_test/__init__.py'
--- account_balance/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_balance/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_balance/unit_test/test.py'
--- account_balance/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_balance/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,70 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27class account_balance_test_case(unittest.TestCase):
28
29 def __init__(self, cursor=False,user=False,methodName='runTest'):
30 self.cr = cursor
31 self.uid = user
32 unittest.TestCase.__init__(self, methodName)
33
34 def setUp(self):
35 try:
36 self.pool = pooler.get_pool(self.cr.dbname)
37 except osv.except_osv,e:
38 self.fail(e.name + e.value)
39 except Exception,e:
40 self.fail(e)
41
42
43 def tearDown(self):
44 try:
45 self.pool = None
46 except osv.except_osv,e:
47 self.fail(e.name + e.value)
48 except Exception,e:
49 self.fail(e)
50
51 def test_1_wizard_test(self):
52 try:
53 model_obj = self.pool.get('ir.model.data')
54 account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv')
55 account_id = model_obj.browse(self.cr, self.uid, account).res_id
56 sel_account=model_obj._get_id(self.cr, self.uid, 'account', 'a_pay')
57 sel_account_id=model_obj.browse(self.cr, self.uid, sel_account).res_id
58 fiscal_year_ids=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[])
59 period_ids=self.pool.get('account.period').search(self.cr,self.uid,[])
60 wizard_service = netsvc.ExportService.getService("wizard")
61 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.balance.account.balance.report')
62 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}
63 state = 'checkyear'
64 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
65 except osv.except_osv,e:
66 self.fail(e.name + e.value)
67 except Exception,e:
68 self.fail(e)
69
70# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
071
=== added directory 'account_budget/unit_test'
=== added file 'account_budget/unit_test/__init__.py'
--- account_budget/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_budget/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
023
=== added file 'account_budget/unit_test/test.py'
--- account_budget/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_budget/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,199 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25import time
26from osv import osv
27
28crossovered_budget_id = None
29budget_post_id = None
30analytic_account_id = None
31
32class account_budget_test_case(unittest.TestCase):
33
34 def __init__(self, cursor=False,user=False,methodName='runTest'):
35 self.cr = cursor
36 self.uid = user
37 unittest.TestCase.__init__(self, methodName)
38
39 def setUp(self):
40 try:
41 self.pool = pooler.get_pool(self.cr.dbname)
42 self.account_budget_post=self.pool.get('account.budget.post')
43 self.crossovered_budget=self.pool.get('crossovered.budget')
44 self.crossovered_budget_lines=self.pool.get('crossovered.budget.lines')
45 except osv.except_osv,e:
46 self.fail(e.name + e.value)
47 except Exception,e:
48 self.fail(e)
49
50 def tearDown(self):
51 try:
52 self.pool = None
53 self.account_budget_post=None
54 self.crossovered_budget=None
55 self.crossovered_budget_lines=None
56 except osv.except_osv,e:
57 self.fail(e.name + e.value)
58 except Exception,e:
59 self.fail(e)
60
61 def test_1_Create(self):
62
63 try:
64 global crossovered_budget_id,budget_post_id, analytic_account_id
65 model_obj = self.pool.get('ir.model.data')
66 analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1')
67 analytic_account_id = model_obj.browse(self.cr, self.uid,analytic_account).res_id
68 account_ids=self.pool.get('account.account').search(self.cr,self.uid,[])
69
70 budget_post_id = self.account_budget_post.create(self.cr,self.uid,
71 {'name':'Receive',
72 'code':'REC',
73 'account_ids':[(6,0,account_ids)],
74 })
75 crossovered_budget_id=self.crossovered_budget.create(self.cr,self.uid,
76 {'name':'BUDGET:2009',
77 'code':'+2009',
78 'creating_user_id':self.uid,
79 'validating_user_id':self.uid,
80 'date_from':time.strftime('2009-04-01'),
81 'date_to':time.strftime('2010-04-01'),
82 'state':'draft'})
83 crossovered_budget_lines_id=self.crossovered_budget_lines.create(self.cr,self.uid,
84 {'crossovered_budget_id':crossovered_budget_id,
85 'analytic_account_id':analytic_account_id,
86 'general_budget_id':budget_post_id,
87 'date_from':time.strftime('2009-04-01'),
88 'date_to':time.strftime('2010-04-01'),
89 'planned_amount':9000.00,
90 })
91 except osv.except_osv,e:
92 self.fail(e.name + e.value)
93 except Exception,e:
94 self.fail(e)
95
96 def test_2_ConfirmBudget(self):
97 try:
98 self.failUnless(crossovered_budget_id,"No Budget Created !")
99 wf_service = netsvc.LocalService("workflow")
100 res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'confirm', self.cr)
101 except osv.except_osv,e:
102 self.fail(e.name + e.value)
103 except Exception,e:
104 self.fail(e)
105
106 def test_3_ValidateBudget(self):
107 try:
108 self.failUnless(crossovered_budget_id,"No Budget Created !")
109 wf_service = netsvc.LocalService("workflow")
110 res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'validate', self.cr)
111 except osv.except_osv,e:
112 self.fail(e.name + e.value)
113 except Exception,e:
114 self.fail(e)
115
116 def test_4_DoneBudget(self):
117 try:
118 self.failUnless(crossovered_budget_id,"No Budget Created !")
119 wf_service = netsvc.LocalService("workflow")
120 res = wf_service.trg_validate(self.uid, 'crossovered.budget',crossovered_budget_id, 'done', self.cr)
121 except osv.except_osv,e:
122 self.fail(e.name + e.value)
123 except Exception,e:
124 self.fail(e)
125
126 def test_5_wizard_spread_test(self):
127 try:
128 self.cr.commit()
129 model_obj = self.pool.get('ir.model.data')
130 fiscal_year=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[])
131 fiscal_id = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,fiscal_year)[0]
132 wizard_service = netsvc.ExportService.getService("wizard")
133 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.budget.spread')
134 datas = {'form': {'fiscalyear':fiscal_id.id,'amount':3600}, 'ids': [budget_post_id],'id':budget_post_id}
135 state = 'spread'
136 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
137 except osv.except_osv,e:
138 self.fail(e.name + e.value)
139 except Exception,e:
140 self.fail(e)
141
142 def test_6_wizard_budget_report(self):
143 try:
144 self.cr.commit()
145 model_obj = self.pool.get('ir.model.data')
146 fiscal_year=self.pool.get('account.fiscalyear').search(self.cr,self.uid,[])
147 fiscal_id = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,fiscal_year)[0]
148 wizard_service = netsvc.ExportService.getService("wizard")
149 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.budget.report')
150 datas = {'form': {'date1':time.strftime('2009-04-01'),'date2':time.strftime('2009-31-01')},
151 'ids': [budget_post_id],'id':budget_post_id}
152 state = 'report'
153 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
154 except osv.except_osv,e:
155 self.fail(e.name + e.value)
156 except Exception,e:
157 self.fail(e)
158
159 def test_7_wizard_analytic_budget_report(self):
160 try:
161 self.cr.commit()
162 model_obj = self.pool.get('ir.model.data')
163 wizard_service = netsvc.ExportService.getService("wizard")
164 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.analytic.account.budget.report')
165 datas = {'form': {'date_from':time.strftime('2009-04-01'),'date_to':time.strftime('2009-31-01'),},'ids': [analytic_account_id],'id':analytic_account_id}
166 state = 'report'
167 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
168 except osv.except_osv,e:
169 self.fail(e.name + e.value)
170 except Exception,e:
171 self.fail(e)
172
173 def test_8_wizard_crossovered_budget_summary(self):
174 try:
175 self.cr.commit()
176 model_obj = self.pool.get('ir.model.data')
177 wizard_service = netsvc.ExportService.getService("wizard")
178 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.crossovered.budget.summary')
179 datas = {'form': {'date_from':time.strftime('2009-04-01'),'date_to':time.strftime('2009-31-01'),}, 'ids': [crossovered_budget_id],'id':crossovered_budget_id}
180 state = 'report'
181 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
182 except osv.except_osv,e:
183 self.fail(e.name + e.value)
184 except Exception,e:
185 self.fail(e)
186
187 def test_9_Unlink(self):
188 try:
189 self.failUnless(crossovered_budget_id,"No Budget Created !")
190 self.failUnless(budget_post_id,"No Account Budget post Created !")
191 self.crossovered_budget.unlink(self.cr, self.uid, [crossovered_budget_id])
192 self.account_budget_post.unlink(self.cr, self.uid, [budget_post_id ])
193 except osv.except_osv,e:
194 self.fail(e.name + e.value)
195 except Exception,e:
196 self.fail(e)
197
198
199# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0200
=== added directory 'account_date_check/unit_test'
=== added file 'account_date_check/unit_test/__init__.py'
--- account_date_check/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_date_check/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_date_check/unit_test/test.py'
--- account_date_check/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_date_check/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,123 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26import time
27
28invoice_id = None
29sale_journal_id = None
30
31class account_date_check_test_case(unittest.TestCase):
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.account_invoice=self.pool.get('account.invoice')
42 self.account_invoice_line=self.pool.get('account.invoice.line')
43 self.account_journal=self.pool.get('account.journal')
44 except osv.except_osv,e:
45 self.fail(e.name + e.value)
46 except Exception,e:
47 self.fail(e)
48
49 def tearDown(self):
50 try:
51 self.pool = None
52 self.account_invoice=None
53 self.account_invoice_line=None
54 self.account_journal=None
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60 def test_1_Create(self):
61 try:
62 global invoice_id,sale_journal_id
63
64 model_obj = self.pool.get('ir.model.data')
65 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2')
66 product_id = model_obj.browse(self.cr, self.uid, product).res_id
67 product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit')
68 product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id
69 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
70 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
71 partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9')
72 partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id
73 sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')])
74 sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0]
75 account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv')
76 account_id = model_obj.browse(self.cr, self.uid, account).res_id
77
78 invoice_id=self.account_invoice.create(self.cr,self.uid,{'name':'Unit Test case Invoice',
79 'type':'out_invoice',
80 'state':'draft',
81 'date_invoice':time.strftime('2008-11-01') ,
82 'partner_id': partner_id,
83 'journal_id': sale_journal_id.id,
84 'address_invoice_id':partner_invoice_id,
85 'account_id':account_id,
86 'address_contact_id':partner_invoice_id })
87 invoice_line_id=self.account_invoice_line.create(self.cr,self.uid,{'name':'Unit Test Invoice Line',
88 'invoice_id':invoice_id,
89 'uos_id':product_uom_id,
90 'product_id':product_id,
91 'account_id':account_id,
92 'price_unit':400,
93 'quantity':10,})
94 except osv.except_osv,e:
95 self.fail(e.name + e.value)
96 except Exception,e:
97 self.fail(e)
98
99 def test_2_CreateInvoice(self):
100 try:
101 self.failUnless(invoice_id,"No Invoice Created !")
102 wf_service = netsvc.LocalService("workflow")
103 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
104 except osv.except_osv,e:
105 self.fail(e.name + e.value)
106 except Exception,e:
107 self.fail(e)
108
109 def test_3_UnlinkInvoice(self):
110 try:
111 self.failUnless(invoice_id,"No Invoice Created !")
112 wf_service = netsvc.LocalService("workflow")
113 if not sale_journal_id.update_posted:
114 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True})
115 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
116 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
117 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False})
118 except osv.except_osv,e:
119 self.fail(e.name + e.value)
120 except Exception,e:
121 self.fail(e)
122
123# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0124
=== added directory 'account_followup/unit_test'
=== added file 'account_followup/unit_test/__init__.py'
--- account_followup/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_followup/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_followup/unit_test/test.py'
--- account_followup/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_followup/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,171 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26import time
27
28followup_id = None
29invoice_id = None
30partner_id = None
31sale_journal_id = None
32
33class account_followup_test_case(unittest.TestCase):
34
35 def __init__(self, cursor=False,user=False,methodName='runTest'):
36 self.cr = cursor
37 self.uid = user
38 unittest.TestCase.__init__(self, methodName)
39
40 def setUp(self):
41 try:
42 self.pool = pooler.get_pool(self.cr.dbname)
43 self.account_invoice=self.pool.get('account.invoice')
44 self.account_invoice_line=self.pool.get('account.invoice.line')
45 self.account_followup_followup=self.pool.get('account_followup.followup')
46 self.account_followup_followup_line=self.pool.get('account_followup.followup.line')
47 except osv.except_osv,e:
48 self.fail(e.name + e.value)
49 except Exception,e:
50 self.fail(e)
51
52
53 def tearDown(self):
54 try:
55 self.pool = None
56 self.account_invoice=None
57 self.account_invoice_line=None
58 self.account_followup_followup=None
59 self.account_followup_followup_line=None
60 except osv.except_osv,e:
61 self.fail(e.name + e.value)
62 except Exception,e:
63 self.fail(e)
64
65
66
67 def test_1_Create(self):
68 try:
69 global invoice_id,followup_id,partner_id,sale_journal_id
70
71 model_obj = self.pool.get('ir.model.data')
72 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2')
73 product_id = model_obj.browse(self.cr, self.uid, product).res_id
74 product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit')
75 product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id
76 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
77 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
78 partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9')
79 partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id
80 company = self.pool.get('res.company').search(self.cr,self.uid,[])
81 company_id = self.pool.get('res.company').browse(self.cr,self.uid,company)[0]
82 sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')])
83 sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0]
84 account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv')
85 account_id = model_obj.browse(self.cr, self.uid, account).res_id
86
87 invoice_id = self.account_invoice.create(self.cr,self.uid,
88 {'name':'Unit Test case Invoice',
89 'type':'out_invoice',
90 'state':'draft',
91 'partner_id': partner_id,
92 'journal_id': sale_journal_id.id,
93 'address_invoice_id':partner_invoice_id,
94 'account_id':account_id,
95 'address_contact_id':partner_invoice_id })
96
97 self.account_invoice_line.create(self.cr,self.uid,
98 {'name':'Unit Test Invoice Line',
99 'invoice_id':invoice_id,
100 'uos_id':product_uom_id,
101 'product_id':product_id,
102 'account_id':account_id,
103 'price_unit':400,
104 'quantity':10,})
105
106 followup_id = self.account_followup_followup.create(self.cr,self.uid,
107 {'name':'Follow-up 1',
108 'description':'This is Unit test followup',
109 'company_id':company_id.id,})
110 for i in range(0,2):
111 self.account_followup_followup_line.create(self.cr,self.uid,
112 {'name':'Level : follow-up-line %s'%(i+1),
113 'delay':15 * i+1,
114 'start':'days',
115 'followup_id':followup_id,
116 'description':'description %s'%(i+1),
117 'sequence':i})
118 except osv.except_osv,e:
119 self.fail(e.name + e.value)
120 except Exception,e:
121 self.fail(e)
122
123 def test_2_CreateInvoice(self):
124 try:
125 self.failUnless(invoice_id,"No Invoice Created !")
126 wf_service = netsvc.LocalService("workflow")
127 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
128 except osv.except_osv,e:
129 self.fail(e.name + e.value)
130 except Exception,e:
131 self.fail(e)
132
133 def test_3_SendFollowups(self):
134 try:
135 self.cr.commit()
136 self.failUnless(invoice_id,"No Invoice Created !")
137 wizard_service = netsvc.ExportService.getService("wizard")
138 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account_followup.followup.print.all')
139 datas = {'form': {}, 'ids': [followup_id],'id': followup_id}
140 state = 'init'
141 while state != 'end':
142 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
143 if 'datas' in res:
144 datas['form'].update(res['datas'])
145 if res['type']=='form':
146 for field in res['fields'].keys():
147 datas['form'][field] = datas['form'].get(field,False)
148 state = res['state'][-1][0]
149 elif res['type'] in ('state','print'):
150 state = res['state']
151 except osv.except_osv,e:
152 self.fail(e.name + e.value)
153 except Exception,e:
154 self.fail(e)
155
156 def test_4_Unlink(self):
157 try:
158 self.failUnless(followup_id,"No followup Created !")
159 self.account_followup_followup.unlink(self.cr,self.uid,[followup_id])
160 wf_service = netsvc.LocalService("workflow")
161 if not sale_journal_id.update_posted:
162 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True})
163 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
164 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
165 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False})
166 except osv.except_osv,e:
167 self.fail(e.name + e.value)
168 except Exception,e:
169 self.fail(e)
170
171# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0172
=== added directory 'account_invoice_layout/unit_test'
=== added file 'account_invoice_layout/unit_test/__init__.py'
--- account_invoice_layout/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_layout/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_invoice_layout/unit_test/test.py'
--- account_invoice_layout/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_invoice_layout/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,153 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27message_id = None
28invoice_id = None
29journal_id = None
30
31class account_invoice_layout_test_case(unittest.TestCase):
32
33
34 def __init__(self, cursor=False,user=False,methodName='runTest'):
35 self.cr = cursor
36 self.uid = user
37 unittest.TestCase.__init__(self, methodName)
38
39 def setUp(self):
40 try:
41 self.pool = pooler.get_pool(self.cr.dbname)
42 self.notify_message=self.pool.get('notify.message')
43 self.account_invoice=self.pool.get('account.invoice')
44 self.account_invoice_line=self.pool.get('account.invoice.line')
45 self.account_journal=self.pool.get('account.journal')
46 except osv.except_osv,e:
47 self.fail(e.name + e.value)
48 except Exception,e:
49 self.fail(e)
50
51
52 def tearDown(self):
53 try:
54 self.pool = None
55 self.notify_message=None
56 self.account_invoice=None
57 self.account_invoice_line=None
58 self.account_journal=None
59 except osv.except_osv,e:
60 self.fail(e.name + e.value)
61 except Exception,e:
62 self.fail(e)
63
64 def test_1_Create(self):
65 try:
66 global message_id,invoice_id,journal_id
67 model_obj = self.pool.get('ir.model.data')
68 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2')
69 product_id = model_obj.browse(self.cr, self.uid, product).res_id
70 product_uom = model_obj._get_id(self.cr, self.uid, 'product', 'product_uom_unit')
71 product_uom_id = model_obj.browse(self.cr, self.uid, product_uom).res_id
72 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
73 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
74 partner_invoice = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9')
75 partner_invoice_id = model_obj.browse(self.cr, self.uid, partner_invoice).res_id
76 journal = model_obj._get_id(self.cr,self.uid, 'account', 'sales_journal')
77 journal_id = model_obj.browse(self.cr, self.uid, journal).res_id
78 account = model_obj._get_id(self.cr, self.uid, 'account', 'a_recv')
79 account_id = model_obj.browse(self.cr, self.uid, account).res_id
80
81 invoice_id=self.account_invoice.create(self.cr,self.uid,{'name':'Unit Test case Invoice',
82 'type':'out_invoice',
83 'state':'draft',
84 'partner_id': partner_id,
85 'journal_id': journal_id,
86 'address_invoice_id':partner_invoice_id,
87 'account_id':account_id,
88 'address_contact_id':partner_invoice_id })
89
90
91 invoice_line_id=self.account_invoice_line.create(self.cr,self.uid,{'name':'Unit Test Invoice Line',
92 'invoice_id':invoice_id,
93 'uos_id':product_uom_id,
94 'product_id':product_id,
95 'account_id':account_id,
96 'price_unit':400,
97 'quantity':10,})
98 message_id= self.notify_message.create(self.cr,self.uid,{'name':'NEW MESSAGE','msg':'THIS IS A NEW MESSAGE'})
99 except osv.except_osv,e:
100 self.fail(e.name + e.value)
101 except Exception,e:
102 self.fail(e)
103
104 def test_2_CreateInvoice(self):
105 try:
106 self.failUnless(invoice_id,"No Invoice Created !")
107 wf_service = netsvc.LocalService("workflow")
108 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
109 except osv.except_osv,e:
110 self.fail(e.name + e.value)
111 except Exception,e:
112 self.fail(e)
113
114 def test_3_wizard_test(self):
115 try:
116 self.failUnless(message_id,"No Message Created !")
117 wizard_service = netsvc.ExportService.getService("wizard")
118 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard.notify_message')
119 datas = {'form': {'message':message_id}, 'ids': [invoice_id], 'id':invoice_id}
120 state = 'print'
121 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
122 except osv.except_osv,e:
123 self.fail(e.name + e.value)
124 except Exception,e:
125 self.fail(e)
126
127 def test_4_layout_report(self):
128 try:
129 self.failUnless(message_id,"No Message Created !")
130 report_service = netsvc.ExportService.getService('report')
131 report_service.exp_report(self.cr.dbname, self.uid, 'account.invoice', [invoice_id])
132 except osv.except_osv,e:
133 self.fail(e.name + e.value)
134 except Exception,e:
135 self.fail(e)
136
137 def test_5_Unlink_layout(self):
138 try:
139 self.failUnless(message_id,"No Message Created !")
140 self.failUnless(journal_id,"No Journal Created !")
141 self.notify_message.unlink(self.cr, self.uid, [message_id])
142 sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,journal_id)
143 wf_service = netsvc.LocalService("workflow")
144 if not sale_journal.update_posted:
145 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True})
146 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
147 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
148 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':False})
149 except osv.except_osv,e:
150 self.fail(e.name + e.value)
151 except Exception,e:
152 self.fail(e)
153# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0154
=== added directory 'account_payment/unit_test'
=== added file 'account_payment/unit_test/__init__.py'
--- account_payment/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_payment/unit_test/test.py'
--- account_payment/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_payment/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,227 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import time
26
27bank_id = None
28bank_type_id = None
29payment_type_id = None
30payment_mode_id = None
31partner_bank_id = None
32invoice_id = None
33invoice_line_id = None
34payment_order_id = None
35
36class account_payment_test_case(unittest.TestCase):
37
38 def __init__(self, cursor=False,user=False,methodName='runTest'):
39 self.cr = cursor
40 self.uid = user
41 unittest.TestCase.__init__(self, methodName)
42
43 def setUp(self):
44 try:
45 self.pool = pooler.get_pool(self.cr.dbname)
46 self.payment_type = self.pool.get('payment.type')
47 self.payment_order = self.pool.get('payment.order')
48 self.res_partner_bank_type_fields = self.pool.get('res.partner.bank.type.field')
49 self.res_partner_bank_type = self.pool.get('res.partner.bank.type')
50 self.payment_mode = self.pool.get('payment.mode')
51 self.res_partner_bank = self.pool.get('res.partner.bank')
52 self.res_bank = self.pool.get('res.bank')
53 self.account_invoice = self.pool.get('account.invoice')
54 self.account_invoice_line = self.pool.get('account.invoice.line')
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60 def tearDown(self):
61 try:
62 self.payment_type = None
63 self.res_partner_bank_type_fields = None
64 self.res_partner_bank_type = None
65 self.payment_mode = None
66 self.res_partner_bank = None
67 self.res_bank = None
68 self.account_invoice = None
69 self.account_invoice_line = None
70 except osv.except_osv,e:
71 self.fail(e.name + e.value)
72 except Exception,e:
73 self.fail(e)
74
75 def test_1_create(self):
76 try:
77 global bank_type_id,payment_type_id,payment_mode_id,bank_id,invoice_id,invoice_line_id,payment_order_id,res
78
79 model_obj = self.pool.get('ir.model.data')
80 journal = model_obj._get_id(self.cr, self.uid, 'account', 'bank_journal')
81 journal_id = model_obj.browse(self.cr, self.uid,journal).res_id
82
83 # Partner
84 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
85 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
86
87 # Partners address
88 partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1')
89 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
90
91 # Account
92 receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv')
93 receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id
94 account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay')
95 account_id = model_obj.browse(self.cr, self.uid, account).res_id
96 # Product
97 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1')
98 product_id = model_obj.browse(self.cr, self.uid, product).res_id
99
100 # Bank
101 bank_id = self.res_bank.create(self.cr,self.uid,{'name':'IDBI Bank'})
102 bank_type_id = self.res_partner_bank_type.create(self.cr,self.uid,{'name':'Industrial Bank','code':'industry'})
103
104 partner_bank_id = self.res_partner_bank.create(self.cr,self.uid,{'name':'HSBC Bank','acc_number':'78453621254',
105 'state':'industry','partner_id':partner_id,
106 'bank':bank_id})
107 # Payment Type
108 payment_type_id = self.payment_type.create(self.cr,self.uid,{'name':'My payment mode',
109 'code':'mypayment',
110 'suitable_bank_types':[(6,0,[bank_type_id])]})
111 # Payment Mode
112 payment_mode_id = self.payment_mode.create(self.cr,self.uid,{'name':'My Payment Mode','bank_id':partner_bank_id,
113 'journal':journal_id,'type':payment_type_id})
114 # Invoice
115 invoice_id = self.account_invoice.create(self.cr,self.uid,
116 {'name': 'Unit Test case Invoice',
117 'type': 'out_invoice',
118 'partner_id': partner_id,
119 'address_invoice_id': partner_address_id,
120 'address_contact_id': partner_address_id,
121 'account_id':receive_account_id,
122 })
123 # Invoice line
124 invoice_line_id = self.account_invoice_line.create(self.cr,self.uid,
125 {'name' :'Unit Test Invoice Line',
126 'invoice_id':invoice_id,
127 'account_id':account_id,
128 'product_id':product_id,
129 'price_unit':500 ,
130 'quantity':5
131 })
132 except osv.except_osv,e:
133 self.fail(e.name + e.value)
134 except Exception,e:
135 self.fail(e)
136
137 def test_2_InvoiceCreate(self):
138 try:
139 self.failUnless(invoice_id,"No Invoice Created !")
140 wf_service = netsvc.LocalService("workflow")
141 res = wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_open', self.cr)
142 except osv.except_osv,e:
143 self.fail(e.name + e.value)
144 except Exception,e:
145 self.fail(e)
146
147 def test_3_CreatePaymentOrder(self):
148 try:
149 global payment_order_id
150 payment_order_id = self.payment_order.create(self.cr,self.uid,{'mode':payment_type_id})
151 line = self.pool.get('account.move.line').search(self.cr,self.uid,[('name','=','Unit Test Invoice Line')])
152 self.cr.commit()
153 self.failUnless(payment_order_id,"No Case Stage Created !")
154 wizard_service = netsvc.ExportService.getService("wizard")
155 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'populate_payment')
156 datas = {'form': {'duedate': time.strftime('%Y-%m-%d'), 'entries': [[6, 0, line]]}, 'ids': [payment_order_id], 'id': payment_order_id}
157 state = 'create'
158 res3 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
159 except osv.except_osv,e:
160 self.fail(e.name + e.value)
161 except Exception,e:
162 self.fail(e)
163
164 def test_4_ConfirmPayment(self):
165 try:
166 self.failUnless(payment_order_id,"No Payment Order Created !")
167 wf_service = netsvc.LocalService("workflow")
168 res = wf_service.trg_validate(self.uid, 'payment.order',payment_order_id, 'open', self.cr)
169 except osv.except_osv,e:
170 self.fail(e.name + e.value)
171 except Exception,e:
172 self.fail(e)
173
174 def test_5_MakePayment(self):
175 try:
176 self.cr.commit()
177 self.failUnless(payment_order_id,"No Payment Order Created !")
178 wizard_service = netsvc.ExportService.getService("wizard")
179 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'pay_payment')
180 datas = {'model': 'payment.order', 'form': {}, 'id': payment_order_id, 'ids': [payment_order_id]}
181 state = 'init'
182 res3 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
183 except osv.except_osv,e:
184 self.fail(e.name + e.value)
185 except Exception,e:
186 self.fail(e)
187
188 def test_6_PrintOrder(self):
189 try:
190 self.failUnless(payment_order_id,"No Payment Order Created !")
191 report_service = netsvc.ExportService.getService('report')
192 report_service.exp_report(self.cr.dbname, self.uid, 'payment.order', [payment_order_id])
193 except osv.except_osv,e:
194 self.fail(e.name + e.value)
195 except Exception,e:
196 self.fail(e)
197
198 def test_7_UnlinkPaymentOrder(self):
199 try:
200 self.failUnless(payment_order_id,"No Payment Order Created !")
201 self.payment_order.unlink(self.cr,self.uid,[payment_order_id])
202 self.payment_mode.unlink(self.cr,self.uid,[payment_mode_id])
203 self.payment_type.unlink(self.cr,self.uid,[payment_type_id])
204 self.res_partner_bank.unlink(self.cr,self.uid,[partner_bank_id])
205 self.res_partner_bank_type.unlink(self.cr,self.uid,[bank_type_id])
206 self.res_bank.unlink(self.cr,self.uid,[bank_id])
207 except osv.except_osv,e:
208 self.fail(e.name + e.value)
209 except Exception,e:
210 self.fail(e)
211
212 def test_8_UnlinkInvoice(self):
213 try:
214 sale_journal = self.pool.get('account.journal').search(self.cr,self.uid,[('name','=','x Sales Journal')])
215 sale_journal_id = self.pool.get('account.journal').browse(self.cr,self.uid,sale_journal)[0]
216 wf_service = netsvc.LocalService("workflow")
217 if not sale_journal_id.update_posted:
218 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':True})
219 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
220 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
221 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal_id.id],{'update_posted':False})
222 except osv.except_osv,e:
223 self.fail(e.name + e.value)
224 except Exception,e:
225 self.fail(e)
226
227# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0228
=== added directory 'account_report/unit_test'
=== added file 'account_report/unit_test/__init__.py'
--- account_report/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_report/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_report/unit_test/test.py'
--- account_report/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_report/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,89 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23from osv import osv
24import netsvc
25
26account_report_report_id = None
27
28class account(unittest.TestCase):
29 def __init__(self, cursor=False,user=False,methodName='runTest'):
30 self.cr = cursor
31 self.uid = user
32 unittest.TestCase.__init__(self, methodName)
33
34 def setUp(self):
35 try:
36 self.pool = pooler.get_pool(self.cr.dbname)
37 self.account_account_report = self.pool.get('account.report.report')
38 except osv.except_osv,e:
39 self.fail(e.name + e.value)
40 except Exception,e:
41 self.fail(e)
42
43 def tearDown(self):
44 try:
45 self.pool = None
46 self.account_account_report = None
47 except osv.except_osv,e:
48 self.fail(e.name + e.value)
49 except Exception,e:
50 self.fail(e)
51
52 def test_1_creat_custom_report(self):
53 try:
54 global account_report_report_id
55 account_report_report_id = self.account_account_report.create(self.cr,self.uid,{
56 'name':'Unit test of account report',
57 'code':'TEST',
58 'goodness_limit':-100,
59 'badness_limit':-100,
60 'expression':'credit([\'x 40000\'],Fiscal Year 2009)',
61 'disp_tree':True,
62 'disp_graph':True
63 })
64 except osv.except_osv,e:
65 self.fail(e.name + e.value)
66 except Exception,e:
67 self.fail(e)
68
69 def test_2_print_report(self):
70 try:
71 self.cr.commit()
72 self.failUnless(account_report_report_id,"No custom report created !")
73 report_service = netsvc.ExportService.getService('report')
74 report_service.exp_report(self.cr.dbname, self.uid, "accounting.report", [account_report_report_id])
75 except osv.except_osv,e:
76 self.fail(e.name + e.value)
77 except Exception,e:
78 self.fail(e)
79
80 def test_2_unlink_custom_report(self):
81 try:
82 self.failUnless(account_report_report_id,"No custome report created !")
83 self.account_account_report.unlink(self.cr,self.uid,[account_report_report_id])
84 except osv.except_osv,e:
85 self.fail(e.name + e.value)
86 except Exception,e:
87 self.fail(e)
88
89# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
090
=== added directory 'account_reporting/unit_test'
=== added file 'account_reporting/unit_test/__init__.py'
--- account_reporting/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_reporting/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_reporting/unit_test/test.py'
--- account_reporting/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_reporting/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,99 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27report_bs_id = None
28period_id = None
29
30class account_reporting_test_case(unittest.TestCase):
31
32 def __init__(self, cursor=False,user=False,methodName='runTest'):
33 self.cr = cursor
34 self.uid = user
35 unittest.TestCase.__init__(self, methodName)
36
37 def setUp(self):
38 try:
39 self.pool = pooler.get_pool(self.cr.dbname)
40 self.account_report_bs = self.pool.get('account.report.bs')
41 except osv.except_osv,e:
42 self.fail(e.name + e.value)
43 except Exception,e:
44 self.fail(e)
45
46 def tearDown(self):
47 try:
48 self.pool = None
49 self.account_report_bs = None
50 except osv.except_osv,e:
51 self.fail(e.name + e.value)
52 except Exception,e:
53 self.fail(e)
54
55 def test_1_Create(self):
56 try:
57 global report_bs_id,period_id
58
59 model_obj = self.pool.get('ir.model.data')
60 self.cr.execute("select id from account_account limit 5")
61 acc_id = map(lambda x: x[0], self.cr.fetchall())
62
63 self.cr.execute("select id from account_period")
64 period_id = map(lambda x: x[0], self.cr.fetchall())
65
66 report_bs_id = self.account_report_bs.create(self.cr,self.uid,{'name':'Unit test balance sheet report',
67 'code':'Unit BS',
68 'account_id':[(6,0,acc_id)],
69 'font_style':'Courier',
70 'report_type':'acc_with_child'})
71 except osv.except_osv,e:
72 self.fail(e.name + e.value)
73 except Exception,e:
74 self.fail(e)
75
76 def test_2_Report(self):
77 try:
78 self.failUnless(report_bs_id,"No Report Balance Sheet record Created !")
79 self.cr.commit()
80 wizard_service = netsvc.ExportService.getService("wizard")
81 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'account.account.balancesheet.report')
82 datas = {'id': report_bs_id, 'model': 'account.report.bs', 'form': {'periods': [[6, 0, period_id]], 'report_type': 'only_obj', 'fiscalyear': 1},}
83 state = 'report'
84 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
85 except osv.except_osv,e:
86 self.fail(e.name + e.value)
87 except Exception,e:
88 self.fail(e)
89
90 def test_3_UnlinkInvoice(self):
91 try:
92 self.failUnless(report_bs_id,"No Report Balance Sheet record Created !")
93 self.account_report_bs.unlink(self.cr,self.uid,[report_bs_id])
94 except osv.except_osv,e:
95 self.fail(e.name + e.value)
96 except Exception,e:
97 self.fail(e)
98
99# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0100
=== added directory 'account_tax_include/unit_test'
=== added file 'account_tax_include/unit_test/__init__.py'
--- account_tax_include/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_tax_include/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_tax_include/unit_test/test.py'
--- account_tax_include/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_tax_include/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,135 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27invoice_id = None
28invoice_line_id = None
29tax_id = None
30
31class account_tax_include_test_case(unittest.TestCase):
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.account_invoice = self.pool.get('account.invoice')
42 self.account_invoice_line = self.pool.get('account.invoice.line')
43 self.account_tax = self.pool.get('account.tax')
44 except osv.except_osv,e:
45 self.fail(e.name + e.value)
46 except Exception,e:
47 self.fail(e)
48
49 def tearDown(self):
50 try:
51 self.account_invoice = None
52 self.account_invoice_line = None
53 self.account_tax = None
54 except osv.except_osv,e:
55 self.fail(e.name + e.value)
56 except Exception,e:
57 self.fail(e)
58
59 def test_1_Create(self):
60 try:
61 global invoice_id,invoice_line_id,tax_id,sales_journal_id
62 model_obj = self.pool.get('ir.model.data')
63 # Product
64 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1')
65 product_id = model_obj.browse(self.cr, self.uid, product).res_id
66 # Partner
67 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_desertic_hispafuentes')
68 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
69
70 # Partners address
71 partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_1')
72 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
73
74 # Account
75 receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv')
76 receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id
77 pay_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_pay')
78 pay_account_id = model_obj.browse(self.cr, self.uid, pay_account).res_id
79
80 # Journal
81 sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
82 sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id
83
84 tax_id = self.account_tax.create(self.cr,self.uid,{'name':'Unit test case tax',
85 'amount':0.10})
86 invoice_id = self.account_invoice.create(self.cr,self.uid,
87 {'name': 'Unit Test Account tax include case Invoice',
88 'type': 'out_invoice',
89 'partner_id': partner_id,
90 'address_invoice_id': partner_address_id,
91 'address_contact_id': partner_address_id,
92 'account_id':receive_account_id,
93 })
94
95 invoice_line_id = self.pool.get('account.invoice.line').create(self.cr,self.uid,
96 {'name' :'Unit Test Invoice Line',
97 'invoice_id':invoice_id,
98 'account_id':pay_account_id,
99 'product_id':product_id,
100 'price_unit':450 ,
101 'quantity':4,
102 'invoice_line_tax_id':[(6,0,[tax_id])],
103 })
104 except osv.except_osv,e:
105 self.fail(e.name + e.value)
106 except Exception,e:
107 self.fail(e)
108
109 def test_2_CreateInvoice(self):
110 try:
111 self.failUnless(invoice_id,"No Invoice Created !")
112 wf_service = netsvc.LocalService("workflow")
113 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id, 'invoice_open', self.cr)
114 except osv.except_osv,e:
115 self.fail(e.name + e.value)
116 except Exception,e:
117 self.fail(e)
118
119 def test_3_Unlink(self):
120 try:
121 self.failUnless(invoice_id,"No Invoice Created !")
122 sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id)
123 wf_service = netsvc.LocalService("workflow")
124 if not sale_journal.update_posted:
125 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True})
126 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id,'invoice_cancel', self.cr)
127 self.account_invoice.unlink(self.cr,self.uid,[invoice_id])
128 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':False})
129 self.account_tax.unlink(self.cr,self.uid,[tax_id])
130 except osv.except_osv,e:
131 self.fail(e.name + e.value)
132 except Exception,e:
133 self.fail(e)
134
135# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0136
=== added directory 'account_voucher/unit_test'
=== added file 'account_voucher/unit_test/__init__.py'
--- account_voucher/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ account_voucher/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'account_voucher/unit_test/test.py'
--- account_voucher/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ account_voucher/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,144 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25
26voucher_id = None
27voucher_line_id = None
28account_id = None
29
30class account_voucher_test_case(unittest.TestCase):
31
32 def __init__(self, cursor=False,user=False,methodName='runTest'):
33 self.cr = cursor
34 self.uid = user
35 unittest.TestCase.__init__(self, methodName)
36
37 def setUp(self):
38 try:
39 self.pool = pooler.get_pool(self.cr.dbname)
40 self.account_invoice = self.pool.get('account.invoice')
41 self.account_invoice_line = self.pool.get('account.invoice.line')
42 self.account_voucher = self.pool.get('account.voucher')
43 self.account_voucher_line = self.pool.get('account.voucher.line')
44 except osv.except_osv,e:
45 self.fail(e.name + e.value)
46 except Exception,e:
47 self.fail(e)
48
49 def tearDown(self):
50 try:
51 self.account_invoice = None
52 self.account_invoice_line = None
53 self.account_voucher = None
54 self.account_voucher_line = None
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60 def test_1_CreateVoucher(self):
61 try:
62 global voucher_id,voucher_line_id,receive_account_id,account_id,analytic_journal_id,journal
63
64 model_obj = self.pool.get('ir.model.data')
65
66 account = model_obj._get_id(self.cr,self.uid, 'account', 'cash')
67 account_id = model_obj.browse(self.cr, self.uid, account).res_id
68 receive_account = model_obj._get_id(self.cr,self.uid, 'account', 'a_recv')
69 receive_account_id = model_obj.browse(self.cr, self.uid, receive_account).res_id
70 # Analytic Account
71 analytic_account = model_obj._get_id(self.cr,self.uid, 'account', 'analytic_project_1')
72 analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id
73 # Partner
74 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_asus')
75 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
76
77 sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
78 sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id
79 analytic_journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale')
80 analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal).res_id
81
82 voucher_id = self.account_voucher.create(self.cr,self.uid,{'name':'Unit test case voucher',
83 'narration':'Ref: Unit test case',
84 'account_id':account_id})
85
86 voucher_line_id = self.account_voucher_line.create(self.cr,self.uid,{'voucher_id':voucher_id,
87 'name':'Unit test voucher line',
88 'account_analytic_id':analytic_account_id,
89 'account_id':receive_account_id,
90 'partner_id':partner_id,
91 'type':'cr',
92 'amount':1000.00})
93
94 except osv.except_osv,e:
95 self.fail(e.name + e.value)
96 except Exception,e:
97 self.fail(e)
98
99 def test_2_open_voucher(self):
100 try:
101 self.failUnless(voucher_id,"No Voucher Created !")
102 self.account_voucher.open_voucher(self.cr,self.uid,[voucher_id])
103 except osv.except_osv,e:
104 self.fail(e.name + e.value)
105 except Exception,e:
106 self.fail(e)
107
108 def test_3_proforma_voucher(self):
109 try:
110 self.failUnless(voucher_id,"No Voucher Created !")
111 global journal
112 journal = self.account_voucher.browse(self.cr,self.uid,voucher_id)
113 if not journal.journal_id.analytic_journal_id.id:
114 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':analytic_journal_id})
115 self.account_voucher.proforma_voucher(self.cr,self.uid,[voucher_id])
116 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False})
117 except osv.except_osv,e:
118 self.fail(e.name + e.value)
119 except Exception,e:
120 self.fail(e)
121
122 def test_4_CancelVoucher(self):
123 try:
124 bank_journal = self.pool.get('account.journal').browse(self.cr,self.uid,journal.journal_id.id)
125 if not bank_journal.update_posted:
126 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'update_posted':True})
127 self.account_voucher.cancel_voucher(self.cr,self.uid,[voucher_id])
128 self.account_voucher.action_cancel_draft(self.cr,self.uid,[voucher_id])
129 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False,'update_posted':False})
130 except osv.except_osv,e:
131 self.fail(e.name + e.value)
132 except Exception,e:
133 self.fail(e)
134
135 def test_5_Unlink(self):
136 try:
137 self.failUnless(voucher_id,"No Voucher Created !")
138 self.account_voucher.unlink(self.cr,self.uid,[voucher_id])
139 except osv.except_osv,e:
140 self.fail(e.name + e.value)
141 except Exception,e:
142 self.fail(e)
143
144# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0145
=== added directory 'analytic_journal_billing_rate/unit_test'
=== added file 'analytic_journal_billing_rate/unit_test/__init__.py'
--- analytic_journal_billing_rate/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ analytic_journal_billing_rate/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
024
=== added file 'analytic_journal_billing_rate/unit_test/test.py'
--- analytic_journal_billing_rate/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ analytic_journal_billing_rate/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,161 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import hr_timesheet.unit_test.test as ht
26
27journal_rate_id = None
28
29class analytic_journal_billing_rate_test_case(unittest.TestCase):
30
31 third_party_cases={ht.hr_timesheet_test_case: ['test_1_Create']}
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.account_invoice = self.pool.get('account.invoice')
42 self.account_invoice_line = self.pool.get('account.invoice.line')
43 self.analytic_journal_rate_grid = self.pool.get('analytic_journal_rate_grid')
44 self.hr_analytic_timesheet = self.pool.get('hr.analytic.timesheet')
45 except osv.except_osv,e:
46 self.fail(e.name + e.value)
47 except Exception,e:
48 self.fail(e)
49
50 def tearDown(self):
51 try:
52 self.account_invoice = None
53 self.account_invoice_line = None
54 self.analytic_journal_rate_grid = None
55 self.hr_analytic_timesheet = None
56 except osv.except_osv,e:
57 self.fail(e.name + e.value)
58 except Exception,e:
59 self.fail(e)
60
61 def test_1_Create(self):
62 try:
63 global journal_rate_id,analytic_account_id,product_id,journal_id,invoice_id,sales_journal_id,flag
64 model_obj = self.pool.get('ir.model.data')
65
66 product = model_obj._get_id(self.cr,self.uid, 'hr_timesheet', 'product_consultant')
67 product_id = model_obj.browse(self.cr, self.uid, product).res_id
68 analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1')
69 analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id
70 journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale')
71 journal_id = model_obj.browse(self.cr, self.uid, journal).res_id
72 rate = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2')
73 rate_id = model_obj.browse(self.cr, self.uid, rate).res_id
74 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
75 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
76 pricelist = model_obj._get_id(self.cr, self.uid, 'product', 'list0')
77 pricelist_id = model_obj.browse(self.cr, self.uid, pricelist).res_id
78 invoice_discount = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2')
79 invoice_discount_id = model_obj.browse(self.cr, self.uid, invoice_discount).res_id
80 sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
81 sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id
82
83 journal_rate_id = self.analytic_journal_rate_grid.create(self.cr,self.uid,{'account_id':analytic_account_id,
84 'journal_id':journal_id,
85 'rate_id':rate_id})
86
87 analytic_id = self.pool.get('account.analytic.account').browse(self.cr,self.uid,[analytic_account_id])[0]
88 if not (analytic_id.pricelist_id and analytic_id.partner_id):
89 self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{
90 'pricelist_id':pricelist_id,
91 'partner_id':partner_id
92 })
93 self.hr_analytic_timesheet.write(self.cr,self.uid,[ht.timesheet_id],{'to_invoice':invoice_discount_id})
94 except osv.except_osv,e:
95 self.fail(e.name + e.value)
96 except Exception,e:
97 self.fail(e)
98
99 def test_2_wizard_case(self):
100 try:
101 self.failUnless(analytic_account_id,"No analytic_account Created !")
102 self.cr.commit()
103 wizard_service = netsvc.ExportService.getService("wizard")
104 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'hr.timesheet.invoice.create')
105 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}
106 state = 'create'
107 global res
108 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
109 except osv.except_osv,e:
110 self.fail(e.name + e.value)
111 except Exception,e:
112 self.fail(e)
113
114 def test_3_CreateInvoice(self):
115 try:
116 global invoice_id
117 invoice_id = res['action']['domain'][0][2]
118 self.failUnless(invoice_id,"No invoices Created !")
119 journal = self.account_invoice.browse(self.cr,self.uid,invoice_id)[0]
120 wf_service = netsvc.LocalService("workflow")
121 if not journal.journal_id.analytic_journal_id:
122 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':journal_id})
123 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0], 'invoice_open', self.cr)
124 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False})
125 except osv.except_osv,e:
126 self.fail(e.name + e.value)
127 except Exception,e:
128 self.fail(e)
129
130 def test_4_CancelInvoice(self):
131 try:
132 self.failUnless(invoice_id,"No invoices Created !")
133 sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id)
134 wf_service = netsvc.LocalService("workflow")
135 if not sale_journal.update_posted:
136 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True})
137 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0],'invoice_cancel', self.cr)
138 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False})
139 self.account_invoice.unlink(self.cr,self.uid,invoice_id)
140 except osv.except_osv,e:
141 self.fail(e.name + e.value)
142 except Exception,e:
143 self.fail(e)
144
145 def test_5_Unlink(self):
146 try:
147 self.failUnless(ht.timesheet_id,"No timesheet Created !")
148 self.failUnless(journal_rate_id,"No journal_rate Created !")
149 self.failUnless(analytic_account_id,"No analytic_account Created !")
150 self.hr_analytic_timesheet.unlink(self.cr,self.uid,[ht.timesheet_id])
151 self.analytic_journal_rate_grid.unlink(self.cr,self.uid,[journal_rate_id])
152 self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{
153 'pricelist_id':False,
154 'partner_id':False
155 })
156 except osv.except_osv,e:
157 self.fail(e.name + e.value)
158 except Exception,e:
159 self.fail(e)
160
161# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0162
=== added directory 'analytic_user_function/unit_test'
=== added file 'analytic_user_function/unit_test/__init__.py'
--- analytic_user_function/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ analytic_user_function/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
024
=== added file 'analytic_user_function/unit_test/test.py'
--- analytic_user_function/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ analytic_user_function/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,161 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import hr_timesheet.unit_test.test as ht
26
27user_function_id = None
28
29class analytic_user_function_test_case(unittest.TestCase):
30
31 third_party_cases={ht.hr_timesheet_test_case: ['test_1_Create']}
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.account_invoice = self.pool.get('account.invoice')
42 self.account_invoice_line = self.pool.get('account.invoice.line')
43 self.analytic_user_funct_grid = self.pool.get('analytic_user_funct_grid')
44 self.hr_analytic_timesheet = self.pool.get('hr.analytic.timesheet')
45 except osv.except_osv,e:
46 self.fail(e.name + e.value)
47 except Exception,e:
48 self.fail(e)
49
50 def tearDown(self):
51 try:
52 self.account_invoice = None
53 self.account_invoice_line = None
54 self.analytic_user_funct_grid = None
55 self.hr_analytic_timesheet = None
56 except osv.except_osv,e:
57 self.fail(e.name + e.value)
58 except Exception,e:
59 self.fail(e)
60
61 def test_1_Create(self):
62 try:
63 global journal_rate_id,analytic_account_id,product_id,journal_id,invoice_id,sales_journal_id,flag
64 model_obj = self.pool.get('ir.model.data')
65
66 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc1')
67 product_id = model_obj.browse(self.cr, self.uid, product).res_id
68 analytic_account = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_project_1')
69 analytic_account_id = model_obj.browse(self.cr, self.uid, analytic_account).res_id
70 journal = model_obj._get_id(self.cr, self.uid, 'account', 'cose_journal_sale')
71 journal_id = model_obj.browse(self.cr, self.uid, journal).res_id
72 rate = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2')
73 rate_id = model_obj.browse(self.cr, self.uid, rate).res_id
74 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
75 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
76 pricelist = model_obj._get_id(self.cr, self.uid, 'product', 'list0')
77 pricelist_id = model_obj.browse(self.cr, self.uid, pricelist).res_id
78 invoice_discount = model_obj._get_id(self.cr, self.uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor2')
79 invoice_discount_id = model_obj.browse(self.cr, self.uid, invoice_discount).res_id
80 sales_journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
81 sales_journal_id = model_obj.browse(self.cr, self.uid, sales_journal).res_id
82
83 user_function_id = self.analytic_user_funct_grid.create(self.cr,self.uid,{'account_id':analytic_account_id,
84 'user_id':self.uid,
85 'product_id':product_id})
86
87 analytic_id = self.pool.get('account.analytic.account').browse(self.cr,self.uid,[analytic_account_id])[0]
88 if not (analytic_id.pricelist_id and analytic_id.partner_id):
89 self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{
90 'pricelist_id':pricelist_id,
91 'partner_id':partner_id
92 })
93 self.hr_analytic_timesheet.write(self.cr,self.uid,[ht.timesheet_id],{'to_invoice':invoice_discount_id})
94 except osv.except_osv,e:
95 self.fail(e.name + e.value)
96 except Exception,e:
97 self.fail(e)
98
99 def test_2_wizard_case(self):
100 try:
101 self.cr.commit()
102 self.failUnless(analytic_account_id,"No analytic_account Created !")
103 wizard_service = netsvc.ExportService.getService("wizard")
104 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'hr.timesheet.invoice.create')
105 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}
106 state = 'create'
107 global res
108 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
109 except osv.except_osv,e:
110 self.fail(e.name + e.value)
111 except Exception,e:
112 self.fail(e)
113
114 def test_3_CreateInvoice(self):
115 try:
116 global invoice_id
117 invoice_id = res['action']['domain'][0][2]
118 self.failUnless(invoice_id,"No invoices Created !")
119 journal = self.account_invoice.browse(self.cr,self.uid,invoice_id)[0]
120 wf_service = netsvc.LocalService("workflow")
121 if not journal.journal_id.analytic_journal_id:
122 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':journal_id})
123 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0], 'invoice_open', self.cr)
124 self.pool.get('account.journal').write(self.cr,self.uid,[journal.journal_id.id],{'analytic_journal_id':False})
125 except osv.except_osv,e:
126 self.fail(e.name + e.value)
127 except Exception,e:
128 self.fail(e)
129
130 def test_4_CancelInvoice(self):
131 try:
132 self.failUnless(invoice_id,"No invoices Created !")
133 sale_journal = self.pool.get('account.journal').browse(self.cr,self.uid,sales_journal_id)
134 wf_service = netsvc.LocalService("workflow")
135 if not sale_journal.update_posted:
136 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'update_posted':True})
137 wf_service.trg_validate(self.uid, 'account.invoice',invoice_id[0],'invoice_cancel', self.cr)
138 self.pool.get('account.journal').write(self.cr,self.uid,[sale_journal.id],{'analytic_journal_id':False,'update_posted':False})
139 self.account_invoice.unlink(self.cr,self.uid,invoice_id)
140 except osv.except_osv,e:
141 self.fail(e.name + e.value)
142 except Exception,e:
143 self.fail(e)
144
145 def test_5_Unlink(self):
146 try:
147 self.failUnless(ht.timesheet_id,"No timesheet Created !")
148 self.failUnless(user_function_id,"No user_function Created !")
149 self.failUnless(analytic_account_id,"No analytic_account Created !")
150 self.hr_analytic_timesheet.unlink(self.cr,self.uid,[ht.timesheet_id])
151 self.analytic_user_funct_grid.unlink(self.cr,self.uid,[user_function_id])
152 self.pool.get('account.analytic.account').write(self.cr,self.uid,[analytic_account_id],{
153 'pricelist_id':False,
154 'partner_id':False
155 })
156 except osv.except_osv,e:
157 self.fail(e.name + e.value)
158 except Exception,e:
159 self.fail(e)
160
161# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0162
=== added directory 'auction/unit_test'
=== added file 'auction/unit_test/__init__.py'
--- auction/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ auction/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file24\ No newline at end of file
125
=== added file 'auction/unit_test/test.py'
--- auction/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ auction/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,184 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import time
26
27auction_lots_id = None
28auction_date_id = None
29auction_deposit_id = None
30
31class auction_test_case(unittest.TestCase):
32 def __init__(self, cursor=False,user=False,methodName='runTest'):
33 self.cr = cursor
34 self.uid = user
35 unittest.TestCase.__init__(self, methodName)
36
37 def setUp(self):
38 try:
39 self.pool = pooler.get_pool(self.cr.dbname)
40 self.auction_lots = self.pool.get('auction.lots')
41 self.auction_dates = self.pool.get('auction.dates')
42 self.auction_deposit = self.pool.get('auction.deposit')
43 except osv.except_osv,e:
44 self.fail(e.name + e.value)
45 except Exception,e:
46 self.fail(e)
47
48
49 def tearDown(self):
50 try:
51 self.pool = None
52 self.auction_lots = None
53 self.auction_dates = None
54 self.auction_deposit = None
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60
61 def test_1_Create(self):
62
63 try:
64 global auction_lots_id,auction_date_id,auction_deposit_id
65 vals = {}
66 model_obj = self.pool.get('ir.model.data')
67
68 buyer_costs = self.pool.get('account.tax').search(self.cr,self.uid,[('name','=','Buyer Costs')])
69 buyer_costs_id = self.pool.get('account.tax').browse(self.cr,self.uid,buyer_costs)[0]
70 seller_costs = self.pool.get('account.tax').search(self.cr,self.uid,[('name','=','Seller Costs')])
71 seller_costs_id = self.pool.get('account.tax').browse(self.cr,self.uid,buyer_costs)[0]
72
73 acc_income = model_obj._get_id(self.cr, self.uid, 'account', 'a_sale')
74 acc_income_id = model_obj.browse(self.cr, self.uid,acc_income).res_id
75 acc_expense = model_obj._get_id(self.cr, self.uid, 'account', 'a_expense')
76 acc_expense_id = model_obj.browse(self.cr, self.uid,acc_expense).res_id
77 journal = model_obj._get_id(self.cr, self.uid, 'account', 'sales_journal')
78 journal_id = model_obj.browse(self.cr, self.uid,journal).res_id
79 journal_seller = model_obj._get_id(self.cr, self.uid, 'account', 'expenses_journal')
80 journal_seller_id = model_obj.browse(self.cr, self.uid,journal_seller).res_id
81 account_analytic = model_obj._get_id(self.cr, self.uid, 'account', 'analytic_absences')
82 account_analytic_id = model_obj.browse(self.cr, self.uid,account_analytic).res_id
83 product = model_obj._get_id(self.cr, self.uid, 'auction', 'monproduit')
84 product_id = model_obj.browse(self.cr, self.uid,product).res_id
85 auction_tax = model_obj._get_id(self.cr, self.uid, 'auction', 'auction_tax')
86 auction_tax_id = model_obj.browse(self.cr, self.uid,auction_tax).res_id
87 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
88 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
89 analytic_journal = model_obj._get_id(self.cr,self.uid, 'account', 'cose_journal_sale')
90 analytic_journal_id = model_obj.browse(self.cr, self.uid, analytic_journal,).res_id
91
92
93 auction_date_id = self.auction_dates.create(self.cr,self.uid,{'name':'Furniture Exhibition',
94 'expo1':time.strftime('%Y-%m-01'),'expo2':time.strftime('%Y-%m-20'),
95 'auction1':time.strftime('%Y-%m-21'),'auction2':time.strftime('%Y-%m-29'),
96 'buyer_costs':[(6,0,[buyer_costs_id.id])],
97 'seller_costs':[(6,0,[seller_costs_id.id])],
98 'acc_income':acc_income_id,
99 'acc_expense':acc_expense_id,
100 'journal_id':journal_id,
101 'journal_seller_id':journal_seller_id,
102 'account_analytic_id':account_analytic_id})
103
104 auction_deposit_id = self.auction_deposit.create(self.cr,self.uid,{'date_dep':time.strftime('%Y-4-20'),
105 'partner_id':partner_id,
106 'method':'keep',})
107
108 auction_lots_id = self.auction_lots.create(self.cr,self.uid,{'name':'Golden sofa',
109 'auction_id':auction_date_id,
110 'lot_num':1,'lot_est1':10000,'lot_est2':20000,
111 'obj_desc':'Coverd by gold sheet','obj_ret':9000,
112 'obj_num':21,'obj_price':9500,'bord_vnd_id':auction_deposit_id,
113 'product_id':product_id,'author_right':auction_tax_id,
114 'ach_login':'admin',
115 'ach_uid':partner_id})
116
117 self.pool.get('account.journal').write(self.cr,self.uid,[analytic_journal_id],
118 {'analytic_journal_id' :analytic_journal_id})
119 except osv.except_osv,e:
120 self.fail(e.name + e.value)
121 except Exception,e:
122 self.fail(e)
123
124 def test_2_SoldObject(self):
125 try:
126 self.failUnless(auction_lots_id,"No auction lots Created !")
127 self.auction_lots.button_bought(self.cr,self.uid,auction_lots_id)
128 except osv.except_osv,e:
129 self.fail(e.name + e.value)
130 except Exception,e:
131 self.fail(e)
132
133 def test_3_NotSoldObject(self):
134 try:
135 self.failUnless(auction_lots_id,"No auction lots Created !")
136 self.auction_lots.button_not_bought(self.cr,self.uid,auction_lots_id)
137 except osv.except_osv,e:
138 self.fail(e.name + e.value)
139 except Exception,e:
140 self.fail(e)
141
142 def test_4_SetToDraftObject(self):
143 try:
144 self.failUnless(auction_lots_id,"No auction lots Created !")
145 self.auction_lots.button_draft(self.cr,self.uid,auction_lots_id)
146 except osv.except_osv,e:
147 self.fail(e.name + e.value)
148 except Exception,e:
149 self.fail(e)
150
151 def test_5_TakenAwayObject(self):
152 try:
153 self.failUnless(auction_lots_id,"No auction lots Created !")
154 self.auction_lots.button_taken_away(self.cr,self.uid,auction_lots_id)
155 except osv.except_osv,e:
156 self.fail(e.name + e.value)
157 except Exception,e:
158 self.fail(e)
159
160 def test_6_PrintOrder(self):
161 try:
162 self.failUnless(auction_lots_id,"No auction lots Created !")
163 self.cr.commit()
164 report_service = netsvc.ExportService.getService('report')
165 report_service.exp_report(self.cr.dbname, self.uid, 'report.auction.ach_bordereau', [auction_lots_id])
166 except osv.except_osv,e:
167 self.fail(e.name + e.value)
168 except Exception,e:
169 self.fail(e)
170
171 def test_7_Unlink(self):
172 try:
173 self.failUnless(auction_lots_id,"No auction lots Created !")
174 self.failUnless(auction_deposit_id,"No auction deposit Created !")
175 self.failUnless(auction_date_id,"No auction date Created !")
176 self.auction_lots.unlink(self.cr,self.uid,[auction_lots_id])
177 self.auction_deposit.unlink(self.cr,self.uid,[auction_deposit_id])
178 self.auction_dates.unlink(self.cr,self.uid,[auction_date_id])
179 except osv.except_osv,e:
180 self.fail(e.name + e.value)
181 except Exception,e:
182 self.fail(e)
183
184# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0185
=== added directory 'audittrail/unit_test'
=== added file 'audittrail/unit_test/__init__.py'
--- audittrail/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ audittrail/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'audittrail/unit_test/test.py'
--- audittrail/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ audittrail/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,103 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25
26class audittrail_test_case(unittest.TestCase):
27
28 def __init__(self, cursor=False,user=False,methodName='runTest'):
29 self.cr = cursor
30 self.uid = user
31 unittest.TestCase.__init__(self, methodName)
32
33 def setUp(self):
34 try:
35 self.pool = pooler.get_pool(self.cr.dbname)
36 self.audittrail_rule = self.pool.get('audittrail.rule')
37 self.audittrail_log=self.pool.get('audittrail.log')
38 self.audittrail_log_line=self.pool.get('audittrail.log.line')
39 except osv.except_osv,e:
40 self.fail(e.name + e.value)
41 except Exception,e:
42 self.fail(e)
43
44 def tearDown(self):
45 try:
46 self.pool = None
47 self.audittrail_rule = None
48 self.audittrail_log = None
49 self.audittrail_log_line= None
50 except osv.except_osv,e:
51 self.fail(e.name + e.value)
52 except Exception,e:
53 self.fail(e)
54
55 def test_1_Create(self):
56
57 try:
58 global rule_id
59 objects = self.pool.get('ir.model').search(self.cr,self.uid,[('name','=','Fields')])
60 objects_id = self.pool.get('ir.model').browse(self.cr,self.uid, objects)[0]
61 user_ids=self.pool.get('res.users').search(self.cr,self.uid,[])
62 rule_id=self.audittrail_rule.create(self.cr,self.uid,{'name':'New Log',
63 'object_id':objects_id.id,
64 'user_id':[(6,0,user_ids)],
65 'log_read':True,
66 'log_write':True,
67 'log_unlink':True,
68 'log_create':True,
69 'state':'draft'})
70
71 except osv.except_osv,e:
72 self.fail(e.name + e.value)
73 except Exception,e:
74 self.fail(e)
75
76 def test_2_Subscribe(self):
77 try:
78 self.failUnless(rule_id,"No rule Created !")
79 self.audittrail_rule.subscribe(self.cr,self.uid,[rule_id])
80 except osv.except_osv,e:
81 self.fail(e.name + e.value)
82 except Exception,e:
83 self.fail(e)
84
85 def test_3_Unsubscribe(self):
86 try:
87 self.failUnless(rule_id,"No rule Created !")
88 self.audittrail_rule.unsubscribe(self.cr,self.uid,[rule_id])
89 except osv.except_osv,e:
90 self.fail(e.name + e.value)
91 except Exception,e:
92 self.fail(e)
93
94 def test_4_Unlink(self):
95 try:
96 self.failUnless(rule_id,"No rule Created !")
97 self.audittrail_rule.unlink(self.cr,self.uid,[rule_id])
98 except osv.except_osv,e:
99 self.fail(e.name + e.value)
100 except Exception,e:
101 self.fail(e)
102
103# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0104
=== modified file 'base_module_quality/unit_test/__init__.py'
--- base_module_quality/unit_test/__init__.py 2010-01-12 09:18:39 +0000
+++ base_module_quality/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -2,23 +2,25 @@
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution4# OpenERP, Open Source Management Solution
5<<<<<<< TREE
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved6# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$7# $Id$
8=======
9# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
10>>>>>>> MERGE-SOURCE
7#11#
8# This program is free software: you can redistribute it and/or modify12# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by13# it under the terms of the GNU Affero General Public License as
10# the Free Software Foundation, either version 3 of the License, or14# published by the Free Software Foundation, either version 3 of the
11# (at your option) any later version.15# License, or (at your option) any later version.
12#16#
13# This program is distributed in the hope that it will be useful,17# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of18# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.20# GNU Affero General Public License for more details.
17#21#
18# You should have received a copy of the GNU General Public License22# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#24#
21##############################################################################25##############################################################################
22
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2527
=== modified file 'base_module_quality/unit_test/unit_test.py'
--- base_module_quality/unit_test/unit_test.py 2010-02-24 10:55:29 +0000
+++ base_module_quality/unit_test/unit_test.py 2010-03-08 07:28:31 +0000
@@ -1,6 +1,7 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4<<<<<<< TREE
4# OpenERP, Open Source Management Solution5# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved6# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$7# $Id$
@@ -17,98 +18,160 @@
17#18#
18# You should have received a copy of the GNU General Public License19# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21=======
22# OpenERP, Open Source Management Solution
23# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
24#
25# This program is free software: you can redistribute it and/or modify
26# it under the terms of the GNU Affero General Public License as
27# published by the Free Software Foundation, either version 3 of the
28# License, or (at your option) any later version.
29#
30# This program is distributed in the hope that it will be useful,
31# but WITHOUT ANY WARRANTY; without even the implied warranty of
32# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33# GNU Affero General Public License for more details.
34#
35# You should have received a copy of the GNU Affero General Public License
36# along with this program. If not, see <http://www.gnu.org/licenses/>.
37>>>>>>> MERGE-SOURCE
20#38#
21##############################################################################39##############################################################################
22import os40import os
2341import unittest
24from osv import fields, osv42from osv import fields, osv
25from tools.translate import _43from tools.translate import _
26import pooler44import pooler
27from tools import config45from tools import config
46from cStringIO import StringIO
28from base_module_quality import base_module_quality47from base_module_quality import base_module_quality
48import types
49
50class OpenERPTestLoader(unittest.TestLoader):
51
52 def loadTestsFromTestCase(self, testCaseClass,cursor=False,user=False):
53 """Return a suite of all tests cases contained in testCaseClass"""
54 if issubclass(testCaseClass, unittest.TestSuite):
55 raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?")
56 testCaseNames = self.getTestCaseNames(testCaseClass)
57 if not testCaseNames and hasattr(testCaseClass, 'runTest'):
58 testCaseNames = ['runTest']
59 return self.suiteClass(map(testCaseClass, [cursor]*len(testCaseNames),[user]*len(testCaseNames),testCaseNames))
60
61
2962
30class quality_test(base_module_quality.abstract_quality_check):63class quality_test(base_module_quality.abstract_quality_check):
3164
32 def __init__(self):65 def __init__(self):
33 super(quality_test, self).__init__()66 super(quality_test, self).__init__()
34 self.bool_installed_only = True67 self.bool_installed_only = True
35 self.name = _("Unit Test")68 self.name = _("Unit Test")
36 self.note = _("""69 self.note = _("""
37This test checks the Unit Test(PyUnit) Cases of the module. Note that 'unit_test/test.py' is needed in module.70This test checks the Unit Test(PyUnit) Cases of the module. Note that 'unit_test/test.py' is needed in module.
3871
39""")72""")
40 self.min_score = 0
41 self.message = 'This test does not calculate score'
42 self.bool_count_score = False
43 return None
44
45 def run_test(self, cr, uid, module_path):
46 pool = pooler.get_pool(cr.dbname)
47 module_name = module_path.split('/')[-1]
48 test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py'
49 if not os.path.isfile(test_file):
50 self.result += _("Module does not have 'unit_test/test.py' file")
51 return None
52 module_obj = pool.get('ir.module.module')
53 module_ids = module_obj.search(cr, uid, [('name', '=', module_name)])
54 module = module_obj.browse(cr, uid, module_ids)
55 if not len(module):
56 self.result += _("Error! Module is not properly loaded/installed")
57 return None
58 module = module[0]
59 test = module.name + '.' + 'unit_test.test'
60 test_module = __import__(test)
61 test_file = getattr(test_module, 'unit_test')
62 test_obj = getattr(test_file, 'test')
63
64 test_result = test_obj.runTest(cr,uid)
65 self.result = self.get_result(test_result)
66 self.result_details += self.get_result_details(test_result)
67 return None
68
69 def get_result(self, data_list):
70 header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-40s \n', [_('Summary'), _('Status')])
71 result_unit = {}
72 res_list = []
73 if data_list[0]:
74 res = data_list[1].split('\n')
75 res_list.append(res[-4:][0])
76 res_list.append(res[-4:][2])
77 result_unit['unit_test'] = res_list
78 return self.format_table(header, data_list=result_unit)
79 return "Unit Test Fail"
80
81 def get_result_details(self, data_list):
82 detail = '''<html><head>%s</head><body><table class="tablestyle">
83 <tr><th class="tdatastyle">Test Cases</th ><th class="tdatastyle">Result</th>'''%(self.get_style())
84 html = ''
85
86 if data_list[0] == True:
87 data = data_list[1].split('... ok')
88 for case in map(lambda x:x[0].replace('\n',''),map(lambda x: x.split(' ('),data)):
89 if case.find('Ran') != -1:
90 case = case[case.index('Ran'):-2]
91 html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">OK</th></tr>'%(case)
92 else:
93 html += '<tr><td class="tdatastyle">%s</td><td class="tdatastyle">OK</td></tr>'%(case)
94 res = detail + html + '</table></body></html>'
95 return res
96 else:
97 detail_dict = {}
98 detail += '''<th class="tdatastyle">Details</th></tr>'''
99 data = data_list[1].split("======================================================================")
100 test = data[0].split('\n')
101 for err in (data_list[0].failures,data_list[0].errors):
102 for value in err:
103 detail_dict[value[0]._testMethodName] = value[1]
104 for case in map(lambda x:x.split('...'), test):
105 if len(case[0]) < 2:
106 continue
107 test_name = case[0].split(' (')[0]
108 if not detail_dict.has_key(test_name):
109 detail_dict[test_name] = ''
110 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])
111 return detail + html +'</tr></table></body></html>'
112 return ''
113
114# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
115\ No newline at end of file73\ No newline at end of file
74 self.min_score = 0
75 self.message = 'This test does not calculate score'
76 self.bool_count_score = False
77 self.test_suite = []
78 return None
79
80 def run_test(self, cr, uid, module_path):
81 pool = pooler.get_pool(cr.dbname)
82 module_name = module_path.split('/')[-1]
83 test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py'
84 if not os.path.isfile(test_file):
85 self.result += _("Module does not have 'unit_test/test.py' file")
86 return None
87 module_obj = pool.get('ir.module.module')
88 module_ids = module_obj.search(cr, uid, [('name', '=', module_name)])
89 module = module_obj.browse(cr, uid, module_ids)
90 if not len(module):
91 self.result += _("Error! Module is not properly loaded/installed")
92 return None
93 module = module[0]
94 test = module.name + '.' + 'unit_test.test'
95 test_module = __import__(test)
96 test_file = getattr(test_module, 'unit_test')
97 test_obj = getattr(test_file, 'test')
98
99 out = StringIO()
100 for name in dir(test_obj):
101 obj = getattr(test_obj, name)
102 if isinstance(obj, (type, types.ClassType)):
103 testcase = obj
104 if not issubclass(testcase, unittest.TestCase):
105 self.result += _("Test cases should be derived from unittest.TestCase")
106 return None
107
108 self.get_suites(cr,uid,testcase)
109 suite = OpenERPTestLoader().loadTestsFromTestCase(testcase,cr,uid)
110 self.test_suite.append(suite)
111 finalsuite = unittest.TestSuite()
112 for suite in self.test_suite:
113 finalsuite.addTest(suite)
114 res = unittest.TextTestRunner(stream=out,verbosity=2).run(finalsuite)
115 if res.wasSuccessful():
116 test_result = (True,out.getvalue())
117 else:
118 test_result = (res,out.getvalue())
119 self.result = self.get_result(test_result)
120 self.result_details += self.get_result_details(test_result)
121 return None
122
123 def get_suites(self,cr,uid,object):
124 if 'third_party_cases' in dir(object):
125 for testclass,case in object.third_party_cases.items():
126 self.get_suites(cr,uid,testclass)
127 third_party_suite = unittest.TestSuite()
128 for test in case:
129 third_party_suite.addTest(testclass(cr,uid,test))
130 self.test_suite.append(third_party_suite)
131 return True
132
133 def get_result(self, data_list):
134 header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-40s \n', [_('Summary'), _('Status')])
135 result_unit = {}
136 res_list = []
137 if data_list[0]:
138 res = data_list[1].split('\n')
139 res_list.append(res[-4:][0])
140 res_list.append(res[-4:][2])
141 result_unit['unit_test'] = res_list
142 return self.format_table(header, data_list=result_unit)
143 return "Unit Test Fail"
144
145 def get_result_details(self, data_list):
146 detail = '''<html><head>%s</head><body><table class="tablestyle">
147 <tr><th class="tdatastyle">Test Cases</th ><th class="tdatastyle">Result</th>'''%(self.get_style())
148 html = ''
149
150 if data_list[0] == True:
151 data = data_list[1].split('... ok')
152 for case in map(lambda x:x[0].replace('\n',''),map(lambda x: x.split(' ('),data)):
153 if case.find('Ran') != -1:
154 case = case[case.index('Ran'):-2]
155 html += '<tr><th class="tdatastyle">%s</th><th class="tdatastyle">OK</th></tr>'%(case)
156 else:
157 html += '<tr><td class="tdatastyle">%s</td><td class="tdatastyle">OK</td></tr>'%(case)
158 res = detail + html + '</table></body></html>'
159 return res
160 else:
161 detail_dict = {}
162 detail += '''<th class="tdatastyle">Details</th></tr>'''
163 data = data_list[1].split("======================================================================")
164 test = data[0].split('\n')
165 for err in (data_list[0].failures,data_list[0].errors):
166 for value in err:
167 detail_dict[value[0]._testMethodName] = value[1]
168 for case in map(lambda x:x.split('...'), test):
169 if len(case[0]) < 2:
170 continue
171 test_name = case[0].split(' (')[0]
172 if not detail_dict.has_key(test_name):
173 detail_dict[test_name] = ''
174 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])
175 return detail + html +'</tr></table></body></html>'
176 return ''
177
178# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
116179
=== added directory 'crm/unit_test'
=== added file 'crm/unit_test/__init__.py'
--- crm/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ crm/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'crm/unit_test/test.py'
--- crm/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ crm/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,189 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25
26section_id = None
27case_category_id = None
28case_rule_id = None
29section_id_2 = None
30case_id = None
31segmentation_id = None
32segmentation_line_id = None
33
34class crm_test_case(unittest.TestCase):
35
36 def __init__(self, cursor=False,user=False,methodName='runTest'):
37 self.cr = cursor
38 self.uid = user
39 unittest.TestCase.__init__(self, methodName)
40
41 def setUp(self):
42 try:
43 self.pool = pooler.get_pool(self.cr.dbname)
44 self.crm_case_section = self.pool.get('crm.case.section')
45 self.crm_case_categ = self.pool.get('crm.case.categ')
46 self.crm_case_rule = self.pool.get('crm.case.rule')
47 self.crm_case = self.pool.get('crm.case')
48 self.crm_segmentation = self.pool.get('crm.segmentation')
49 self.crm_segmentation_line = self.pool.get('crm.segmentation.line')
50 except osv.except_osv,e:
51 self.fail(e.name + e.value)
52 except Exception,e:
53 self.fail(e)
54
55 def tearDown(self):
56 try:
57 self.pool = None
58 self.crm_case_section = None
59 self.crm_case_categ = None
60 self.crm_case_rule = None
61 self.crm_case = None
62 self.crm_segmentation = None
63 self.crm_segmentation_line = None
64 except osv.except_osv,e:
65 self.fail(e.name + e.value)
66 except Exception,e:
67 self.fail(e)
68
69 def test_1_Create(self):
70 try:
71 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
72 res = {}
73 model_obj = self.pool.get('ir.model.data')
74
75 user = self.pool.get('res.users').search(self.cr,self.uid,[('name','=','Administrator')])
76 user_id = self.pool.get('res.users').browse(self.cr,self.uid,user)[0]
77 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
78 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
79 partner_address = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_address_9')
80 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
81 categ = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_category_2')
82 categ_id = model_obj.browse(self.cr, self.uid,categ).res_id
83
84 # Section
85 section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'My Section','code':'mysect',
86 'sequence':0,})
87 section_id_2 = self.crm_case_section.create(self.cr,self.uid,{'name':'My Client Section','code':'myclsect',
88 'sequence':0,})
89 # Case Category
90 case_category_id = self.crm_case_categ.create(self.cr,self.uid,{'section_id':section_id,'name':'Client Installation'})
91
92 # Case Rule
93 case_rule_id = self.crm_case_rule.create(self.cr,self.uid,{'name':'My Rule','trg_state_from':'draft',
94 'trg_section_id':section_id,
95 'trg_user_id':user_id.id,
96 'act_state':'open','act_section_id':section_id_2})
97
98 # CRM Case
99 case_id = self.crm_case.create(self.cr,self.uid,{'name':'Client server problem','section_id':section_id,
100 'partner_id':partner_id,'partner_address_id':partner_address_id,
101 'user_id':user_id.id})
102
103 ## Segmentation
104 segmentation_id = self.crm_segmentation.create(self.cr,self.uid,{'name':'My Segmentation',
105 'description':'Developing new segmentation for the client',
106 'categ_id':categ_id})
107
108 segmentation_line_id = self.crm_segmentation_line.create(self.cr,self.uid,{'segmentation_id':segmentation_id,
109 'name':'My segment line',
110 'expr_name':'sale',
111 'expr_operator':'>',
112 'expr_value':500,'operator':'and'})
113
114 except osv.except_osv,e:
115 self.fail(e.name + e.value)
116 except Exception,e:
117 self.fail(e)
118
119
120 def test_2_CaseOpen(self):
121 try:
122 self.failUnless(case_id,"No Case Created !")
123 self.crm_case.case_open(self.cr,self.uid,[case_id])
124 except osv.except_osv,e:
125 self.fail(e.name + e.value)
126 except Exception,e:
127 self.fail(e)
128
129 def test_3_CasePending(self):
130 try:
131 self.failUnless(case_id,"No Case Created !")
132 self.crm_case.case_pending(self.cr,self.uid,[case_id])
133 except osv.except_osv,e:
134 self.fail(e.name + e.value)
135 except Exception,e:
136 self.fail(e)
137
138 def test_4_CaseClose(self):
139 try:
140 self.failUnless(case_id,"No Case Created !")
141 self.crm_case.case_close(self.cr,self.uid,[case_id])
142 except osv.except_osv,e:
143 self.fail(e.name + e.value)
144 except Exception,e:
145 self.fail(e)
146
147 def test_5_CaseReset(self):
148 try:
149 self.failUnless(case_id,"No Case Created !")
150 self.crm_case.case_reset(self.cr,self.uid,[case_id])
151 except osv.except_osv,e:
152 self.fail(e.name + e.value)
153 except Exception,e:
154 self.fail(e)
155
156 def test_6_SegmentationProcessStrat(self):
157 try:
158 self.failUnless(segmentation_id,"No Segmentation Created !")
159 self.crm_segmentation.process_start(self.cr,self.uid,[segmentation_id])
160 except osv.except_osv,e:
161 self.fail(e.name + e.value)
162 except Exception,e:
163 self.fail(e)
164
165 def test_7_RemoveCategory(self):
166 try:
167 self.failUnless(case_id,"No Case Created !")
168 self.cr.execute("delete from res_partner_category_rel where partner_id = %s and category_id = %s", (partner_id,categ_id))
169 except osv.except_osv,e:
170 self.fail(e.name + e.value)
171 except Exception,e:
172 self.fail(e)
173
174 def test_8_Unlink(self):
175 try:
176 self.failUnless(case_id,"No Case Created !")
177 self.crm_case.unlink(self.cr,self.uid,[case_id])
178 self.crm_case_rule.unlink(self.cr,self.uid,[case_rule_id])
179 self.crm_case_categ.unlink(self.cr,self.uid,[case_category_id])
180 self.crm_case_section.unlink(self.cr,self.uid,[section_id_2])
181 self.crm_case_section.unlink(self.cr,self.uid,[section_id])
182 self.crm_segmentation_line.unlink(self.cr,self.uid,[segmentation_line_id])
183 self.crm_segmentation.unlink(self.cr,self.uid,[segmentation_id])
184 except osv.except_osv,e:
185 self.fail(e.name + e.value)
186 except Exception,e:
187 self.fail(e)
188
189# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0190
=== added directory 'crm_configuration'
=== added directory 'crm_configuration/unit_test'
=== added file 'crm_configuration/unit_test/__init__.py'
--- crm_configuration/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ crm_configuration/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'crm_configuration/unit_test/test.py'
--- crm_configuration/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ crm_configuration/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,165 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26import time
27import crm.unit_test.test as crm
28
29
30meeting_stage_id = []
31oppor_stage_id = []
32meeting_section_id = None
33opportunity_section_id = None
34
35class crm_configuration_test_case(unittest.TestCase):
36
37 third_party_cases={crm.crm_test_case: ['test_1_Create']}
38
39 def __init__(self, cursor=False,user=False,methodName='runTest'):
40 self.cr = cursor
41 self.uid = user
42 unittest.TestCase.__init__(self, methodName)
43
44 def setUp(self):
45 try:
46 self.pool = pooler.get_pool(self.cr.dbname)
47 self.crm_case_stage = self.pool.get('crm.case.stage')
48 self.crm_case_section = self.pool.get('crm.case.section')
49 self.crm_case_categ = self.pool.get('crm.case.categ')
50 self.crm_case_rule = self.pool.get('crm.case.rule')
51 self.crm_case = self.pool.get('crm.case')
52 self.crm_segmentation = self.pool.get('crm.segmentation')
53 self.crm_segmentation_line = self.pool.get('crm.segmentation.line')
54
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60 def tearDown(self):
61 try:
62 self.pool = None
63 self.crm_case_stage = None
64 self.crm_case = None
65 self.crm_case_section
66 self.crm_case_categ = None
67 self.crm_case_rule = None
68 self.crm_segmentation = None
69 self.crm_segmentation_line = None
70 except osv.except_osv,e:
71 self.fail(e.name + e.value)
72 except Exception,e:
73 self.fail(e)
74
75 def test_1_create(self):
76 try:
77 global meeting_stage_id,meeting_section_id,opportunity_section_id,oppor_stage_id
78 meeting_stage_id = []
79 oppor_stage_id = []
80
81 meeting_section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'Meeting','code':'Mtngs','sequence':0})
82 opportunity_section_id = self.crm_case_section.create(self.cr,self.uid,{'name':'Opportunity','code':'oppor','sequence':0})
83 for name in ['Fixed','Not Fixed']:
84 meeting = self.crm_case_stage.create(self.cr,self.uid,{'name':name,'section_id':meeting_section_id})
85 meeting_stage_id.append(meeting)
86 oppor = self.crm_case_stage.create(self.cr,self.uid,{'name':name,'section_id':opportunity_section_id})
87 oppor_stage_id.append(oppor)
88 self.crm_case.write(self.cr,self.uid,[crm.case_id],vals = {'partner_name':'New Client '})
89 except osv.except_osv,e:
90 self.fail(e.name + e.value)
91 except Exception,e:
92 self.fail(e)
93
94 def test_2_createPartner(self):
95 try:
96 self.cr.commit()
97 self.failUnless(meeting_stage_id,"No Case Stage Created !")
98 wizard_service = netsvc.ExportService.getService("wizard")
99 wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.partner_create')
100 datas = {'form': {'close': 0}, 'ids': [crm.case_id],'id': crm.case_id }
101 state = 'confirm'
102 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
103 except osv.except_osv,e:
104 self.fail(e.name + e.value)
105 except Exception,e:
106 self.fail(e)
107
108 def test_3_createMeeting(self):
109 try:
110 self.cr.commit()
111 self.failUnless(meeting_stage_id,"No Case Stage Created !")
112 wizard_service = netsvc.ExportService.getService("wizard")
113 wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.meeting')
114 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}
115 state = 'order'
116 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
117 except osv.except_osv,e:
118 self.fail(e.name + e.value)
119 except Exception,e:
120 self.fail(e)
121
122 def test_4_createOpportunity(self):
123 try:
124 self.cr.commit()
125 self.failUnless(meeting_stage_id,"No Case Stage Created !")
126 wizard_service = netsvc.ExportService.getService("wizard")
127 wizard_res = wizard_service.exp_create(self.cr.dbname,self.uid, 'crm.case.opportunity_set')
128 state='init'
129 datas={'form':{},'ids': [crm.case_id], 'report_type': 'pdf', 'model': 'crm.case', 'id':crm.case_id}
130 while state != 'end':
131 res = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
132 if 'datas' in res:
133 datas['form'].update( res['datas'].get('form',{}) )
134 if res['type']=='form':
135 for field in res['fields'].keys():
136 datas['form'][field] = res['datas'][field]
137 state = res['state'][-1][0]
138 elif res['type']=='action':
139 state = res['state']
140 except osv.except_osv,e:
141 self.fail(e.name + e.value)
142 except Exception,e:
143 self.fail(e)
144
145 def test_5_Unlink(self):
146 try:
147 self.failUnless(meeting_stage_id,"No Case Stage Created !")
148 self.crm_case.unlink(self.cr,self.uid,[crm.case_id])
149 self.crm_case_rule.unlink(self.cr,self.uid,[crm.case_rule_id])
150 self.crm_case_categ.unlink(self.cr,self.uid,[crm.case_category_id])
151 self.crm_case_section.unlink(self.cr,self.uid,[crm.section_id_2] + [crm.section_id])
152 self.crm_segmentation_line.unlink(self.cr,self.uid,[crm.segmentation_line_id])
153 self.crm_segmentation.unlink(self.cr,self.uid,[crm.segmentation_id])
154 self.crm_case_stage.unlink(self.cr,self.uid,meeting_stage_id)
155 self.crm_case_stage.unlink(self.cr,self.uid,oppor_stage_id)
156 sect = self.crm_case.search(self.cr,self.uid,[('section_id','in',[meeting_section_id,opportunity_section_id])])
157 self.crm_case.unlink(self.cr,self.uid,sect)
158 self.crm_case_section.unlink(self.cr,self.uid,[meeting_section_id]+[opportunity_section_id])
159 self.pool.get('res.partner').unlink(self.cr,self.uid,[res['action']['res_id']])
160 except osv.except_osv,e:
161 self.fail(e.name + e.value)
162 except Exception,e:
163 self.fail(e)
164
165# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0166
=== added directory 'crm_profiling/unit_test'
=== added file 'crm_profiling/unit_test/__init__.py'
--- crm_profiling/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ crm_profiling/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
023
=== added file 'crm_profiling/unit_test/test.py'
--- crm_profiling/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ crm_profiling/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,138 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26
27questionnaire_id = None
28question_1 = None
29choice_ids = None
30
31class crm_profiling_test_case(unittest.TestCase):
32
33 def __init__(self, cursor=False,user=False,methodName='runTest'):
34 self.cr = cursor
35 self.uid = user
36 unittest.TestCase.__init__(self, methodName)
37
38 def setUp(self):
39 try:
40 self.pool = pooler.get_pool(self.cr.dbname)
41 self.crm_profiling_question = self.pool.get('crm_profiling.question')
42 self.crm_profiling_questionnaire = self.pool.get('crm_profiling.questionnaire')
43 self.crm_profiling_answer = self.pool.get('crm_profiling.answer')
44 self.crm_segmentation = self.pool.get('crm.segmentation')
45 self.crm_segmentation_line = self.pool.get('crm.segmentation.line')
46 except osv.except_osv,e:
47 self.fail(e.name + e.value)
48 except Exception,e:
49 self.fail(e)
50
51 def tearDown(self):
52 try:
53 self.pool = None
54 self.crm_profiling_question = None
55 self.crm_profiling_questionnaire = None
56 self.crm_profiling_answer = None
57 self.crm_segmentation = None
58 self.crm_segmentation_line = None
59 except osv.except_osv,e:
60 self.fail(e.name + e.value)
61 except Exception,e:
62 self.fail(e)
63
64 def test_1_create(self):
65 try:
66 global questionnaire_id,question_ids,choice_ids,segmentation_id,segmentation_line_id,partner_id,categ_id
67 question_ids = []
68 choice_ids = []
69 model_obj = self.pool.get('ir.model.data')
70
71 categ = model_obj._get_id(self.cr, self.uid, 'base', 'res_partner_category_2')
72 categ_id = model_obj.browse(self.cr, self.uid,categ).res_id
73 parent = model_obj._get_id(self.cr, self.uid, 'crm_profiling', 'crm_segmentation6')
74 parent_id = model_obj.browse(self.cr, self.uid,parent).res_id
75 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
76 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
77
78 # Questions
79 quest =['Which ERP has best Accounting module','Which ERP has higher marketing value']
80 for question in quest:
81 question_1 = self.crm_profiling_question.create(self.cr,self.uid,{'name' :question})
82 for choice in ['OpenERP','MSDY','MSDY']:
83 choice_1 = self.crm_profiling_answer.create(self.cr,self.uid,{'name':'MSDY','question_id':question_1})
84 choice_ids.append(choice_1)
85 question_ids.append(question_1)
86 questionnaire_id = self.crm_profiling_questionnaire.create(self.cr,self.uid,{'name':'ERP Compare',
87 'description':'ERP marketing questionnaire',
88 'questions_ids':[(6,0,question_ids)]})
89
90 ## Segmentation
91 segmentation_id = self.crm_segmentation.create(self.cr,self.uid,{'name':'My Segmentation',
92 'description':'Developing new segmentation for the client',
93 'categ_id':categ_id,
94 'parent_id':parent_id,
95 'answer_yes':[(6,0,choice_ids[0:3])]})
96
97 segmentation_line_id = self.crm_segmentation_line.create(self.cr,self.uid,{'segmentation_id':segmentation_id,
98 'name':'My segment line',
99 'expr_name':'sale',
100 'expr_operator':'>',
101 'expr_value':500,'operator':'and'})
102 except osv.except_osv,e:
103 self.fail(e.name + e.value)
104 except Exception,e:
105 self.fail(e)
106
107 def test_2_SegmentationProcessStrat(self):
108 try:
109 self.failUnless(segmentation_id,"No Segmentation Created !")
110 self.crm_segmentation.process_start(self.cr,self.uid,[segmentation_id])
111 except osv.except_osv,e:
112 self.fail(e.name + e.value)
113 except Exception,e:
114 self.fail(e)
115
116 def test_3_RemoveCategory(self):
117 try:
118 self.failUnless(segmentation_id,"No Segmentation Created !")
119 self.cr.execute("delete from res_partner_category_rel where partner_id = %s and category_id = %s", (partner_id,categ_id))
120 except osv.except_osv,e:
121 self.fail(e.name + e.value)
122 except Exception,e:
123 self.fail(e)
124
125 def test_4_Unlink(self):
126 try:
127 self.failUnless(segmentation_id,"No Segmentation Created !")
128 self.crm_segmentation_line.unlink(self.cr,self.uid,[segmentation_line_id])
129 self.crm_segmentation.unlink(self.cr,self.uid,[segmentation_id])
130 self.crm_profiling_answer.unlink(self.cr,self.uid,choice_ids)
131 self.crm_profiling_question.unlink(self.cr,self.uid,question_ids)
132 self.crm_profiling_questionnaire.unlink(self.cr,self.uid,[questionnaire_id])
133 except osv.except_osv,e:
134 self.fail(e.name + e.value)
135 except Exception,e:
136 self.fail(e)
137
138# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0139
=== added directory 'delivery/unit_test'
=== added file 'delivery/unit_test/__init__.py'
--- delivery/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'delivery/unit_test/test.py'
--- delivery/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ delivery/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,154 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import sale.unit_test.test as sale
26import product.unit_test.test as prod
27
28
29delivery_id = None
30
31class delivery_test_case(unittest.TestCase):
32
33 third_party_cases={sale.sale_order_test_case: ['test_1_Create']}
34
35 def __init__(self, cursor=False,user=False,methodName='runTest'):
36 self.cr = cursor
37 self.uid = user
38 unittest.TestCase.__init__(self, methodName)
39
40 def setUp(self):
41 try:
42 self.pool = pooler.get_pool(self.cr.dbname)
43 self.sale_order = self.pool.get('sale.order')
44 self.delivery_carrier = self.pool.get('delivery.carrier')
45 self.delivery_grid = self.pool.get('delivery.grid')
46 self.delivery_grid_line = self.pool.get('delivery.grid.line')
47 self.stock_picking=self.pool.get('stock.picking')
48 self.stock_move=self.pool.get('stock.move')
49 except osv.except_osv,e:
50 self.fail(e.name + e.value)
51 except Exception,e:
52 self.fail(e)
53
54 def tearDown(self):
55 try:
56 self.pool = None
57 self.sale_order = None
58 self.product_pricelist = None
59 self.delivery_carrier = None
60 self.delivery_grid = None
61 self.delivery_grid_line = None
62 self.stock_picking= None
63 self.stock_move= None
64 except osv.except_osv,e:
65 self.fail(e.name + e.value)
66 except Exception,e:
67 self.fail(e)
68
69 def test_1_Create(self):
70
71 try:
72 global order_id,delivery_id,sale_order_line_id,grid_line_id
73 model_obj = self.pool.get('ir.model.data')
74 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
75 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
76 pricelist_id = self.pool.get('res.partner').browse(self.cr, self.uid,partner_id).property_product_pricelist.id
77 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2')
78 product_id = model_obj.browse(self.cr, self.uid, product).res_id
79 delivery_id = self.delivery_carrier.create(self.cr,self.uid,{'name':'Test','product_id':product_id,
80 'partner_id':partner_id,})
81 self.sale_order.write(self.cr,self.uid,sale.order_id,{'carrier_id':delivery_id})
82 delivery_grid_id=self.delivery_grid.create(self.cr,self.uid,{'name':'Test-Pricelist','carrier_id':delivery_id,})
83 grid_line_id=self.delivery_grid_line.create(self.cr,self.uid,{'name':'Test-grid-line',
84 'grid_id':delivery_grid_id,
85 'type':'price','operator':'=',
86 'max_value':300.00,
87 'price_type':'variable',
88 'variable_factor':'weight',
89 'list_price':100.00,
90 'standard_price':20.00})
91
92 except osv.except_osv,e:
93 self.fail(e.name + e.value)
94 except Exception,e:
95 self.fail(e)
96
97 def test_2_ConfirmOrder(self):
98 try:
99 self.failUnless(sale.order_id,"No Sale Order Created !")
100 wf_service = netsvc.LocalService("workflow")
101 res = wf_service.trg_validate(self.uid, 'sale.order',sale.order_id, 'order_confirm', self.cr)
102 except osv.except_osv,e:
103 self.fail(e.name + e.value)
104 except Exception,e:
105 self.fail(e)
106
107 def test_3_check_avalibility_Order(self):
108 try:
109 global stock_pick_id
110 self.failUnless(sale.order_id,"No Sale Order Created !")
111 stock_pick = self.stock_picking.search(self.cr,self.uid,[('sale_id','=',sale.order_id)])
112 stock_pick_id = self.stock_picking.browse(self.cr,self.uid,stock_pick)[0]
113 self.stock_picking.write(self.cr,self.uid,[stock_pick_id.id],{'type':'delivery'})
114 self.stock_picking.force_assign(self.cr,self.uid,[stock_pick_id.id])
115 except osv.except_osv,e:
116 self.fail(e.name + e.value)
117 except Exception,e:
118 self.fail(e)
119
120 def test_4_wizard_test(self):
121 try:
122 self.cr.commit()
123 wizard_service = netsvc.ExportService.getService("wizard")
124 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'stock.partial_picking')
125 stock_mov = self.stock_move.search(self.cr,self.uid,[('picking_id','=',stock_pick_id.id)])
126 stock_move_id=self.stock_move.browse(self.cr,self.uid,stock_mov)[0]
127 move_id = 'move'+ str(stock_move_id.id)
128 datas = {'form': {'moves': [stock_move_id.id], move_id: 6.0}, 'ids': [stock_pick_id.id], 'id':stock_pick_id.id}
129 state = 'split'
130 res = wizard_service.exp_execute(self.cr.dbname, self.uid,wizard_res , datas, state, {})
131 except osv.except_osv,e:
132 self.fail(e.name + e.value)
133 except Exception,e:
134 self.fail(e)
135
136 def test_5_Unlink(self):
137 try:
138 self.failUnless(sale.order_id,"No Sales Order Created !")
139 self.pool.get('stock.picking').unlink(self.cr, self.uid, [stock_pick_id.id])
140 self.sale_order.action_cancel(self.cr, self.uid, [sale.order_id])
141 self.sale_order.unlink(self.cr, self.uid, [sale.order_id])
142 self.delivery_grid_line.unlink(self.cr,self.uid,grid_line_id)
143 self.delivery_carrier.unlink(self.cr,self.uid,delivery_id)
144 self.pool.get('product.product').unlink(self.cr,self.uid,[prod.product_id])
145 self.pool.get('product.pricelist.item').unlink(self.cr, self.uid,[prod.product_pricelist_items_id])
146 self.pool.get('product.pricelist.version').unlink(self.cr,self.uid,[prod.product_pricelist_version_id])
147 self.pool.get('product.pricelist').unlink(self.cr,self.uid,[prod.product_pricelist_id])
148 self.pool.get('product.pricelist.type').unlink(self.cr,self.uid,[prod.pricelist_type_id])
149 except osv.except_osv,e:
150 self.fail(e.name + e.value)
151 except Exception,e:
152 self.fail(e)
153
154# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0155
=== added directory 'event/unit_test'
=== added file 'event/unit_test/__init__.py'
--- event/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ event/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'event/unit_test/test.py'
--- event/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ event/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,182 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import unittest
23import pooler
24import netsvc
25from osv import osv
26import datetime
27import time
28
29event_id = None
30registration_id = None
31
32
33class event_test_case(unittest.TestCase):
34
35 def __init__(self, cursor=False,user=False,methodName='runTest'):
36 self.cr = cursor
37 self.uid = user
38 unittest.TestCase.__init__(self, methodName)
39
40 def setUp(self):
41 try:
42 self.pool = pooler.get_pool(self.cr.dbname)
43 self.event_event = self.pool.get('event.event')
44 self.event_registration = self.pool.get('event.registration')
45 except osv.except_osv,e:
46 self.fail(e.name + e.value)
47 except Exception,e:
48 self.fail(e)
49
50 def tearDown(self):
51 try:
52 self.pool = None
53 self.event_event = None
54 self.event_registration = None
55 except osv.except_osv,e:
56 self.fail(e.name + e.value)
57 except Exception,e:
58 self.fail(e)
59
60 def test_1_create(self):
61 try:
62 global event_id,registration_id
63 model_obj = self.pool.get('ir.model.data')
64
65 product = model_obj._get_id(self.cr,self.uid, 'product', 'product_product_pc2')
66 product_id = model_obj.browse(self.cr, self.uid, product).res_id
67 event_parent = model_obj._get_id(self.cr,self.uid, 'event', 'event_0')
68 event_parent_id = model_obj.browse(self.cr, self.uid, event_parent).res_id
69 partner = model_obj._get_id(self.cr,self.uid, 'base', 'res_partner_9')
70 partner_id = model_obj.browse(self.cr, self.uid, partner,).res_id
71 partner_address = model_obj._get_id(self.cr, self.uid, 'base_contact', 'res_partner_contact_simonis0')
72 partner_address_id = model_obj.browse(self.cr, self.uid, partner_address).res_id
73
74 event_id = self.event_event.create(self.cr,self.uid,{'name':'My Event',
75 'date_begin':time.strftime('%Y-%m-%d %H:%M:%S'),
76 'date_end':datetime.date.today() + datetime.timedelta(days=2),
77 'product_id':product_id,
78 'register_max':500,
79 'register_min':25,
80 'parent_id':event_parent_id,
81 'mail_auto_confirm':1,'reply_to':'vir@tinyerp.com'})
82
83
84 registration_id = self.event_registration.create(self.cr,self.uid,{'event_id':event_id,'partner_id':partner_id,
85 'contact_id':partner_address_id,
86 'invoice_label':'Event Invoice',
87 'partner_invoice_id':partner_id})
88 self.cr.commit()
89 except osv.except_osv,e:
90 self.fail(e.name + e.value)
91 except Exception,e:
92 self.fail(e)
93
94 def test_2_ConfirmRegistration(self):
95 try:
96 self.cr.commit()
97 self.failUnless(registration_id,"No registration Created !")
98 wizard_service = netsvc.ExportService.getService("wizard")
99 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.confirm_registration')
100 datas = {'model': 'event.registration', 'form': {}, 'id':registration_id ,'ids': [registration_id]}
101 state = 'init'
102 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
103 except osv.except_osv,e:
104 self.fail(e.name + e.value)
105 except Exception,e:
106 self.fail
107
108 def test_3_RegistrationClose(self):
109 try:
110 self.cr.commit()
111 self.failUnless(registration_id,"No registration Created !")
112 self.event_registration.button_reg_close(self.cr,self.uid,[registration_id])
113 except osv.except_osv,e:
114 self.fail(e.name + e.value)
115 except Exception,e:
116 self.fail
117
118 def test_4_makeInvoice(self):
119 try:
120 global res2
121 self.cr.commit()
122 self.failUnless(registration_id,"No registration Created !")
123 wizard_service = netsvc.ExportService.getService("wizard")
124 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.reg_make_invoice')
125 datas = {'model': 'event.registration', 'form': {}, 'id': registration_id, 'ids': [registration_id]}
126 state = 'init'
127 res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
128 except osv.except_osv,e:
129 self.fail(e.name + e.value)
130 except Exception,e:
131 self.fail
132
133 def test_5_ListRegisteredPartner(self):
134 try:
135 self.cr.commit()
136 self.failUnless(event_id,"No Event Created !")
137 wizard_service = netsvc.ExportService.getService("wizard")
138 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, passwd, 'event.event_reg_partners')
139 datas = {'model': 'event.event', 'form': {}, 'id': event_id, 'ids': [event_id]}
140 state = 'init'
141 res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
142 except osv.except_osv,e:
143 self.fail(e.name + e.value)
144 except Exception,e:
145 self.fail
146
147 def test_6_Registrations(self):
148 try:
149 self.cr.commit()
150 self.failUnless(event_id,"No Event Created !")
151 wizard_service = netsvc.ExportService.getService("wizard")
152 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard_event_registration')
153 datas = {'model': 'event.event', 'form': {}, 'id': event_id, 'ids': [event_id]}
154 state = 'init'
155 res2 = wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
156 except osv.except_osv,e:
157 self.fail(e.name + e.value)
158 except Exception,e:
159 self.fail
160
161 def test_7_EventDone(self):
162 try:
163 self.cr.commit()
164 self.failUnless(event_id,"No Event Created !")
165 self.event_event.button_done(self.cr,self.uid,[event_id])
166 except osv.except_osv,e:
167 self.fail(e.name + e.value)
168 except Exception,e:
169 self.fail(e)
170
171 def test_8_Unlink(self):
172 try:
173 self.failUnless(event_id,"No Event Created !")
174 self.event_registration.unlink(self.cr,self.uid,[registration_id])
175 self.event_event.unlink(self.cr,self.uid,[event_id])
176 self.pool.get('account.invoice').unlink(self.cr,self.uid,res2['datas']['invoice_ids'])
177 except osv.except_osv,e:
178 self.fail(e.name + e.value)
179 except Exception,e:
180 self.fail(e)
181
182# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0183
=== added directory 'event_project/unit_test'
=== added file 'event_project/unit_test/__init__.py'
--- event_project/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ event_project/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file23\ No newline at end of file
124
=== added file 'event_project/unit_test/test.py'
--- event_project/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ event_project/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,149 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import unittest
22import pooler
23import netsvc
24from osv import osv
25import event.unit_test.test as event_proj
26
27class event_project_test_case(unittest.TestCase):
28
29 third_party_cases={event_proj.event_test_case: ['test_1_create']}
30
31 def __init__(self, cursor=False,user=False,methodName='runTest'):
32 self.cr = cursor
33 self.uid = user
34 unittest.TestCase.__init__(self, methodName)
35
36 def setUp(self):
37 try:
38 self.pool = pooler.get_pool(self.cr.dbname)
39 self.event_event = self.pool.get('event.event')
40 self.event_registration = self.pool.get('event.registration')
41 except osv.except_osv,e:
42 self.fail(e.name + e.value)
43 except Exception,e:
44 self.fail(e)
45
46 def tearDown(self):
47 try:
48 self.pool = None
49 self.event_event = None
50 self.event_registration = None
51 except osv.except_osv,e:
52 self.fail(e.name + e.value)
53 except Exception,e:
54 self.fail(e)
55
56 def test_1_CreateRetroPlanning(self):
57 try:
58 self.cr.commit()
59 wizard_service = netsvc.ExportService.getService("wizard")
60 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.project')
61 datas = {'form': {'project_id': 3}, 'ids': [event_proj.event_id], 'id': event_proj.event_id}
62 state = 'done'
63 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
64 except osv.except_osv,e:
65 self.fail(e.name + e.value)
66 except Exception,e:
67 self.fail
68
69 def test_2_ConfirmRegistration(self):
70 try:
71 self.cr.commit()
72 wizard_service = netsvc.ExportService.getService("wizard")
73 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.confirm_registration')
74 datas = {'model': 'event.registration', 'form': {}, 'id':event_proj.registration_id , 'ids': [event_proj.registration_id]}
75 state = 'init'
76 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
77 except osv.except_osv,e:
78 self.fail(e.name + e.value)
79 except Exception,e:
80 self.fail
81
82 def test_3_RegistrationClose(self):
83 try:
84 self.failUnless(event_proj.event_id,"No Event Created !")
85 self.event_registration.button_reg_close(self.cr,self.uid,[event_proj.registration_id])
86 except osv.except_osv,e:
87 self.fail(e.name + e.value)
88 except Exception,e:
89 self.fail
90
91 def test_4_makeInvoice(self):
92 try:
93 self.cr.commit()
94 wizard_service = netsvc.ExportService.getService("wizard")
95 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.reg_make_invoice')
96 datas = {'model': 'event.registration', 'form': {}, 'id': event_proj.registration_id,'ids': [event_proj.registration_id]}
97 state = 'init'
98 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
99 except osv.except_osv,e:
100 self.fail(e.name + e.value)
101 except Exception,e:
102 self.fail
103
104 def test_5_ListRegisteredPartner(self):
105 try:
106 self.cr.commit()
107 wizard_service = netsvc.ExportService.getService("wizard")
108 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'event.event_reg_partners')
109 datas = {'model': 'event.event', 'form': {}, 'id': event_proj.event_id, 'ids': [event_proj.event_id]}
110 state = 'init'
111 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
112 except osv.except_osv,e:
113 self.fail(e.name + e.value)
114 except Exception,e:
115 self.fail
116
117 def test_6_Registrations(self):
118 try:
119 self.cr.commit()
120 wizard_service = netsvc.ExportService.getService("wizard")
121 wizard_res = wizard_service.exp_create(self.cr.dbname, self.uid, 'wizard_event_registration')
122 datas = {'model': 'event.event', 'form': {}, 'id': event_proj.event_id, 'ids': [event_proj.event_id]}
123 state = 'init'
124 wizard_service.exp_execute(self.cr.dbname, self.uid, wizard_res , datas, state, {})
125 except osv.except_osv,e:
126 self.fail(e.name + e.value)
127 except Exception,e:
128 self.fail
129
130 def test_7_EventDone(self):
131 try:
132 self.failUnless(event_proj.event_id,"No Event Created !")
133 self.event_event.button_done(self.cr,self.uid,[event_proj.event_id])
134 except osv.except_osv,e:
135 self.fail(e.name + e.value)
136 except Exception,e:
137 self.fail(e)
138
139 def test_8_Unlink(self):
140 try:
141 self.failUnless(event_proj.event_id,"No Event Created !")
142 self.event_registration.unlink(self.cr,self.uid,[event_proj.registration_id])
143 self.event_event.unlink(self.cr,self.uid,[event_proj.event_id])
144 except osv.except_osv,e:
145 self.fail(e.name + e.value)
146 except Exception,e:
147 self.fail(e)
148
149# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0150
=== added directory 'hr/unit_test'
=== added file 'hr/unit_test/__init__.py'
--- hr/unit_test/__init__.py 1970-01-01 00:00:00 +0000
+++ hr/unit_test/__init__.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
024
=== added file 'hr/unit_test/test.py'
--- hr/unit_test/test.py 1970-01-01 00:00:00 +0000
+++ hr/unit_test/test.py 2010-03-08 07:28:31 +0000
@@ -0,0 +1,104 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: