1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8 # 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 by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # 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/>.
21 ##############################################################################
24 from osv import fields, osv
27 def _test_pylint(self, url):
28 list_files = os.listdir(url)
30 for file in list_files:
31 if file.split('.')[-1] == 'py':
32 save_file = file.split('.')[0]+".txt"
33 file_path = os.path.join(url, file)
34 a1 = os.system('pylint '+file_path+'>> '+save_file+' ')
35 a2 = os.system('cat '+save_file+' | tail -4 >> temp.txt')
36 fp = open('temp.txt','r')
42 str_result = str_result + line
44 fp = open('temp.txt','w')
47 if str_result.startswith('Global'):
48 dict_files[file] = str_result
51 #class res_partner_contact(osv.osv):
52 # _name = "res.partner.contact"
53 # _description = "res.partner.contact"
55 # def _title_get(self,cr, user, context={}):
56 # obj = self.pool.get('res.partner.title')
57 # ids = obj.search(cr, user, [])
58 # res = obj.read(cr, user, ids, ['shortcut', 'name','domain'], context)
59 # res = [(r['shortcut'], r['name']) for r in res if r['domain']=='contact']
63 # 'name': fields.char('Last Name', size=30,required=True),
64 # 'first_name': fields.char('First Name', size=30),
65 # 'mobile':fields.char('Mobile',size=30),
66 # 'title': fields.selection(_title_get, 'Title'),
67 # 'website':fields.char('Website',size=120),
68 # 'lang_id':fields.many2one('res.lang','Language'),
69 # 'job_ids':fields.one2many('res.partner.job','contact_id','Functions and Addresses'),
70 # 'country_id':fields.many2one('res.country','Nationality'),
71 # 'birthdate':fields.date('Birth Date'),
72 # 'active' : fields.boolean('Active'),
73 # 'partner_id':fields.related('job_ids','address_id','partner_id',type='many2one', relation='res.partner', string='Main Employer'),
74 # 'function_id':fields.related('job_ids','function_id',type='many2one', relation='res.partner.function', string='Main Job'),
77 # 'active' : lambda *a: True,
79 # def name_get(self, cr, user, ids, context={}):
80 # #will return name and first_name.......
84 # for r in self.read(cr, user, ids, ['name','first_name','title']):
85 # addr = r['title'] and str(r['title'])+" " or ''
86 # addr +=str(r['name'] or '')
87 # if r['name'] and r['first_name']:
89 # addr += str(r['first_name'] or '')
90 # res.append((r['id'], addr))
92 #res_partner_contact()
94 #class res_partner_address(osv.osv):
96 # #overriding of the name_get defined in base in order to remove the old contact name
97 # def name_get(self, cr, user, ids, context={}):
101 # for r in self.read(cr, user, ids, ['zip','city','partner_id', 'street']):
102 # if context.get('contact_display', 'contact')=='partner':
103 # res.append((r['id'], r['partner_id'][1]))
106 # addr += str(r['street'] or '') + ' ' + str(r['zip'] or '') + ' ' + str(r['city'] or '')
107 # res.append((r['id'], addr.strip() or '/'))
110 # _name = 'res.partner.address'
111 # _inherit='res.partner.address'
112 # _description ='Partner Address'
114 # 'job_ids':fields.one2many('res.partner.job', 'address_id', 'Contacts'),
116 #res_partner_address()
118 #class res_partner_job(osv.osv):
120 # def name_get(self, cr, uid, ids, context={}):
124 # for r in self.browse(cr, uid, ids):
125 # res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] +", "+ r.function_id.name))
128 # def search(self, cr, user, args, offset=0, limit=None, order=None,
129 # context=None, count=False):
131 # if arg[0]=='address_id':
132 # self._order = 'sequence_partner'
133 # if arg[0]=='contact_id':
134 # self._order = 'sequence_contact'
135 # return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
137 # _name = 'res.partner.job'
138 # _description ='Contact Job Title'
139 # _order = 'sequence_contact'
141 # 'name': fields.related('address_id','partner_id', type='many2one', relation='res.partner', string='Partner'),
142 # 'address_id':fields.many2one('res.partner.address','Address'),
143 # 'contact_id':fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'),
144 # 'function_id': fields.many2one('res.partner.function','Job Title'),
145 # 'sequence_contact':fields.integer('Sequence',help='Order of importance of this address in the list of addresses of the linked contact'),
146 # 'sequence_partner':fields.integer('Sequence',help='Order of importance of this job title in the list of job title of the linked partner'),
147 # 'email': fields.char('E-Mail', size=240),
148 # 'phone': fields.char('Phone', size=64),
149 # 'date_start' : fields.date('Date Start'),
150 # 'date_stop' : fields.date('Date Stop'),
151 # 'state' : fields.selection([('past', 'Past'),('current', 'Current')], 'State', required=True),
155 # 'sequence_contact' : lambda *a: 0,
156 # 'state' : lambda *a: 'current',
161 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: