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
=== added directory 'contract_log_term_condition'
=== added file 'contract_log_term_condition/__init__.py'
--- contract_log_term_condition/__init__.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/__init__.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,1 @@
1import model
02
=== added file 'contract_log_term_condition/__openerp__.py'
--- contract_log_term_condition/__openerp__.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/__openerp__.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,53 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 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 'name' : 'Log of Terms and Conditions',
23 'version' : '0.1',
24 'author' : 'Vauxoo',
25 'category' : '',
26 'description' : """
27Terms and Conditions Log
28========================
29- This module creates a log of all change in the Terms and Conditions fields
30 in the Contract
31 """,
32 'website': 'http://www.vauxoo.com',
33 'images' : [],
34 'depends' : [
35 'account_analytic_analysis',
36 ],
37 'data': [
38 ],
39 'js': [
40 ],
41 'qweb' : [
42 ],
43 'css':[
44 ],
45 'demo': [
46 ],
47 'test': [
48 ],
49 'installable': True,
50 'auto_install': False,
51}
52# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
53
054
=== added directory 'contract_log_term_condition/data'
=== added directory 'contract_log_term_condition/demo'
=== added directory 'contract_log_term_condition/i18n'
=== added directory 'contract_log_term_condition/model'
=== added file 'contract_log_term_condition/model/__init__.py'
--- contract_log_term_condition/model/__init__.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/model/__init__.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,1 @@
1import analytic
02
=== added file 'contract_log_term_condition/model/analytic.py'
--- contract_log_term_condition/model/analytic.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/model/analytic.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,32 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###############################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) Vauxoo (<http://vauxoo.com>).
6# All Rights Reserved
7############### Credits ######################################################
8# Coded by: Luis Escobar <luis@vauxoo.com>
9# Audited by: Nhomar Hernandez <nhomar@vauxoo.com>
10###############################################################################
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Affero General Public License as published
13# by the Free Software Foundation, either version 3 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU Affero General Public License for more details.
20#
21# You should have received a copy of the GNU Affero General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
23###############################################################################
24
25from openerp.osv import osv, fields
26import openerp.tools
27
28class account_analytic_account(osv.Model):
29 _inherit = 'account.analytic.account'
30 _columns = {
31 'description': fields.text('Description', track_visibility='onchange'),
32 }
033
=== added directory 'contract_log_term_condition/tests'
=== added file 'contract_log_term_condition/tests/__init__.py'
--- contract_log_term_condition/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/tests/__init__.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,5 @@
1from . import test_contract
2
3fast_suite = [
4 test_contract
5]
06
=== added file 'contract_log_term_condition/tests/test_contract.py'
--- contract_log_term_condition/tests/test_contract.py 1970-01-01 00:00:00 +0000
+++ contract_log_term_condition/tests/test_contract.py 2014-06-25 01:56:45 +0000
@@ -0,0 +1,46 @@
1from openerp.tests.common import TransactionCase
2from openerp.exceptions import AccessError
3from openerp.osv.orm import except_orm
4from openerp import SUPERUSER_ID
5
6class TestAnalytic(TransactionCase):
7
8 def setUp(self):
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')
13
14
15 def test_log_terms_conditions(self):
16 '''
17 Check if the log about terms and conditions field was created
18 '''
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',
26 })
27 message_ids = self.message.search(cr, uid,
28 [('res_id', '=', analytic_id),
29 ('model', '=', 'account.analytic.account'),
30 ('body', 'ilike', '%'+'Firs Condition'+'%')])
31
32 self.assertGreaterEqual(len(message_ids),
33 1,
34 "The log was not created")
35 self.analytic.write(cr, uid, [analytic_id], {
36 'description': 'Term Changed'
37 })
38
39 message_ids = self.message.search(cr, uid,
40 [('res_id', '=', analytic_id),
41 ('model', '=', 'account.analytic.account'),
42 ('body', 'ilike', '%'+'Term Changed'+'%')])
43
44 self.assertGreaterEqual(len(message_ids),
45 1,
46 "The log was not created")
047
=== added directory 'contract_log_term_condition/view'
=== added directory 'contract_log_term_condition/wizard'
=== added directory 'contract_log_term_condition/workflow'