Merge lp:~vauxoo/addons-vauxoo/jose-terms-conditions-contract-log into lp:addons-vauxoo/7.0

Status: Merged
Merged at revision: 1061
Proposed branch: lp:~vauxoo/addons-vauxoo/jose-terms-conditions-contract-log
Merge into: lp:addons-vauxoo/7.0
Diff against target: 177 lines (+138/-0)
6 files modified
contract_log_term_condition/__init__.py (+1/-0)
contract_log_term_condition/__openerp__.py (+53/-0)
contract_log_term_condition/model/__init__.py (+1/-0)
contract_log_term_condition/model/analytic.py (+32/-0)
contract_log_term_condition/tests/__init__.py (+5/-0)
contract_log_term_condition/tests/test_contract.py (+46/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/jose-terms-conditions-contract-log

Description of the change

Added new module to create a log with all changes in the Terms and conditions fields of the contract

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'contract_log_term_condition'
2=== added file 'contract_log_term_condition/__init__.py'
3--- contract_log_term_condition/__init__.py 1970-01-01 00:00:00 +0000
4+++ contract_log_term_condition/__init__.py 2014-06-25 01:56:45 +0000
5@@ -0,0 +1,1 @@
6+import model
7
8=== added file 'contract_log_term_condition/__openerp__.py'
9--- contract_log_term_condition/__openerp__.py 1970-01-01 00:00:00 +0000
10+++ contract_log_term_condition/__openerp__.py 2014-06-25 01:56:45 +0000
11@@ -0,0 +1,53 @@
12+# -*- coding: utf-8 -*-
13+##############################################################################
14+#
15+# OpenERP, Open Source Management Solution
16+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
17+#
18+# This program is free software: you can redistribute it and/or modify
19+# it under the terms of the GNU Affero General Public License as
20+# published by the Free Software Foundation, either version 3 of the
21+# License, or (at your option) any later version.
22+#
23+# This program is distributed in the hope that it will be useful,
24+# but WITHOUT ANY WARRANTY; without even the implied warranty of
25+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+# GNU Affero General Public License for more details.
27+#
28+# You should have received a copy of the GNU Affero General Public License
29+# along with this program. If not, see <http://www.gnu.org/licenses/>.
30+#
31+##############################################################################
32+{
33+ 'name' : 'Log of Terms and Conditions',
34+ 'version' : '0.1',
35+ 'author' : 'Vauxoo',
36+ 'category' : '',
37+ 'description' : """
38+Terms and Conditions Log
39+========================
40+- This module creates a log of all change in the Terms and Conditions fields
41+ in the Contract
42+ """,
43+ 'website': 'http://www.vauxoo.com',
44+ 'images' : [],
45+ 'depends' : [
46+ 'account_analytic_analysis',
47+ ],
48+ 'data': [
49+ ],
50+ 'js': [
51+ ],
52+ 'qweb' : [
53+ ],
54+ 'css':[
55+ ],
56+ 'demo': [
57+ ],
58+ 'test': [
59+ ],
60+ 'installable': True,
61+ 'auto_install': False,
62+}
63+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
64+
65
66=== added directory 'contract_log_term_condition/data'
67=== added directory 'contract_log_term_condition/demo'
68=== added directory 'contract_log_term_condition/i18n'
69=== added directory 'contract_log_term_condition/model'
70=== added file 'contract_log_term_condition/model/__init__.py'
71--- contract_log_term_condition/model/__init__.py 1970-01-01 00:00:00 +0000
72+++ contract_log_term_condition/model/__init__.py 2014-06-25 01:56:45 +0000
73@@ -0,0 +1,1 @@
74+import analytic
75
76=== added file 'contract_log_term_condition/model/analytic.py'
77--- contract_log_term_condition/model/analytic.py 1970-01-01 00:00:00 +0000
78+++ contract_log_term_condition/model/analytic.py 2014-06-25 01:56:45 +0000
79@@ -0,0 +1,32 @@
80+#!/usr/bin/python
81+# -*- encoding: utf-8 -*-
82+###############################################################################
83+# Module Writen to OpenERP, Open Source Management Solution
84+# Copyright (C) Vauxoo (<http://vauxoo.com>).
85+# All Rights Reserved
86+############### Credits ######################################################
87+# Coded by: Luis Escobar <luis@vauxoo.com>
88+# Audited by: Nhomar Hernandez <nhomar@vauxoo.com>
89+###############################################################################
90+# This program is free software: you can redistribute it and/or modify
91+# it under the terms of the GNU Affero General Public License as published
92+# by the Free Software Foundation, either version 3 of the License, or
93+# (at your option) any later version.
94+#
95+# This program is distributed in the hope that it will be useful,
96+# but WITHOUT ANY WARRANTY; without even the implied warranty of
97+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98+# GNU Affero General Public License for more details.
99+#
100+# You should have received a copy of the GNU Affero General Public License
101+# along with this program. If not, see <http://www.gnu.org/licenses/>.
102+###############################################################################
103+
104+from openerp.osv import osv, fields
105+import openerp.tools
106+
107+class account_analytic_account(osv.Model):
108+ _inherit = 'account.analytic.account'
109+ _columns = {
110+ 'description': fields.text('Description', track_visibility='onchange'),
111+ }
112
113=== added directory 'contract_log_term_condition/tests'
114=== added file 'contract_log_term_condition/tests/__init__.py'
115--- contract_log_term_condition/tests/__init__.py 1970-01-01 00:00:00 +0000
116+++ contract_log_term_condition/tests/__init__.py 2014-06-25 01:56:45 +0000
117@@ -0,0 +1,5 @@
118+from . import test_contract
119+
120+fast_suite = [
121+ test_contract
122+]
123
124=== added file 'contract_log_term_condition/tests/test_contract.py'
125--- contract_log_term_condition/tests/test_contract.py 1970-01-01 00:00:00 +0000
126+++ contract_log_term_condition/tests/test_contract.py 2014-06-25 01:56:45 +0000
127@@ -0,0 +1,46 @@
128+from openerp.tests.common import TransactionCase
129+from openerp.exceptions import AccessError
130+from openerp.osv.orm import except_orm
131+from openerp import SUPERUSER_ID
132+
133+class TestAnalytic(TransactionCase):
134+
135+ def setUp(self):
136+ super(TestAnalytic, self).setUp()
137+ self.analytic = self.registry('account.analytic.account')
138+ self.message = self.registry('mail.message')
139+ self.user = self.registry('res.users')
140+
141+
142+ def test_log_terms_conditions(self):
143+ '''
144+ Check if the log about terms and conditions field was created
145+ '''
146+ cr, uid = self.cr, self.uid
147+ user_brw = self.user.browse(cr, uid, uid)
148+ partner_brw = user_brw.partner_id
149+ analytic_id = self.analytic.create(cr, uid, {
150+ 'name': 'Test Terms and Conditions Log',
151+ 'code': 'TERMANDCONDITIONS',
152+ 'description': 'Firs Condition',
153+ })
154+ message_ids = self.message.search(cr, uid,
155+ [('res_id', '=', analytic_id),
156+ ('model', '=', 'account.analytic.account'),
157+ ('body', 'ilike', '%'+'Firs Condition'+'%')])
158+
159+ self.assertGreaterEqual(len(message_ids),
160+ 1,
161+ "The log was not created")
162+ self.analytic.write(cr, uid, [analytic_id], {
163+ 'description': 'Term Changed'
164+ })
165+
166+ message_ids = self.message.search(cr, uid,
167+ [('res_id', '=', analytic_id),
168+ ('model', '=', 'account.analytic.account'),
169+ ('body', 'ilike', '%'+'Term Changed'+'%')])
170+
171+ self.assertGreaterEqual(len(message_ids),
172+ 1,
173+ "The log was not created")
174
175=== added directory 'contract_log_term_condition/view'
176=== added directory 'contract_log_term_condition/wizard'
177=== added directory 'contract_log_term_condition/workflow'