1
from openerp.tests.common import TransactionCase
2
from openerp.exceptions import AccessError
3
from openerp.osv.orm import except_orm
4
from openerp import SUPERUSER_ID
6
class TestAnalytic(TransactionCase):
9
super(TestAnalytic, self).setUp()
10
self.analytic = self.registry('account.analytic.account')
11
self.message = self.registry('mail.message')
12
self.user = self.registry('res.users')
15
def test_log_terms_conditions(self):
17
Check if the log about terms and conditions field was created
19
cr, uid = self.cr, self.uid
20
user_brw = self.user.browse(cr, uid, uid)
21
partner_brw = user_brw.partner_id
22
analytic_id = self.analytic.create(cr, uid, {
23
'name': 'Test Terms and Conditions Log',
24
'code': 'TERMANDCONDITIONS',
25
'description': 'Firs Condition',
27
message_ids = self.message.search(cr, uid,
28
[('res_id', '=', analytic_id),
29
('model', '=', 'account.analytic.account'),
30
('body', 'ilike', '%'+'Firs Condition'+'%')])
32
self.assertGreaterEqual(len(message_ids),
34
"The log was not created")
35
self.analytic.write(cr, uid, [analytic_id], {
36
'description': 'Term Changed'
39
message_ids = self.message.search(cr, uid,
40
[('res_id', '=', analytic_id),
41
('model', '=', 'account.analytic.account'),
42
('body', 'ilike', '%'+'Term Changed'+'%')])
44
self.assertGreaterEqual(len(message_ids),
46
"The log was not created")