Merge lp:~openerp-dev/openobject-server/niv-dev-server into lp:openobject-server

Proposed by Nicolas Vanhoren (OpenERP)
Status: Merged
Merged at revision: 3081
Proposed branch: lp:~openerp-dev/openobject-server/niv-dev-server
Merge into: lp:openobject-server
Diff against target: 1327 lines (+649/-457)
20 files modified
.bzrignore (+3/-0)
bin/addons/base/__init__.py (+1/-1)
bin/addons/base/__openerp__.py (+2/-1)
bin/addons/base/ir/__init__.py (+1/-0)
bin/addons/base/ir/ir_config_parameter.py (+101/-0)
bin/addons/base/ir/ir_cron.py (+2/-1)
bin/addons/base/maintenance/__init__.py (+0/-25)
bin/addons/base/maintenance/maintenance.py (+0/-206)
bin/addons/base/maintenance/maintenance_security.xml (+0/-6)
bin/addons/base/maintenance/maintenance_view.xml (+0/-131)
bin/addons/base/publisher_warranty/__init__.py (+25/-0)
bin/addons/base/publisher_warranty/publisher_warranty.py (+320/-0)
bin/addons/base/publisher_warranty/publisher_warranty_data.xml (+20/-0)
bin/addons/base/publisher_warranty/publisher_warranty_view.xml (+146/-0)
bin/addons/base/res/res_log.py (+6/-7)
bin/addons/base/res/res_log_view.xml (+2/-0)
bin/addons/base/security/ir.model.access.csv (+3/-2)
bin/netsvc.py (+1/-0)
bin/tools/config.py (+16/-8)
bin/tools/maintenance.py (+0/-69)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/niv-dev-server
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+41563@code.launchpad.net

Description of the change

Complete refactoring of the old maintenance sub-module in base

To post a comment you must log in.
3034. By Olivier Dony (Odoo)

[IMP] ir.model.data,res.log: allow marking res.log entries as read upon creation via context + do it during module install to avoid useless log spam

3035. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3036. By OpenERP GTK R&D Team

[MERGE] read_group: now returns count information for the groups

3037. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3038. By gpa(OpenERP)

[MERGE] ir.ui.menu,rng: support for embedded web icons for menuitems

3039. By Xavier (Open ERP)

[ADD] a few demo widgets

3040. By Xavier (Open ERP)

[IMP] have res.widget.wizard return its initial act_window itself to avoid hardcoding it in the client

3041. By Xavier (Open ERP)

[ADD] base: method to fetch an act_window from its xml_id on ir.actions.act_window

Also used it to replace the corresponding code in ir.attachment and res.widget.wizard

3042. By P. Christeas, O. Dony

[MERGE] many improvements regarding translations, logging, reports, http, speed, ...

3043. By qdp (OpenERP)

[MERGE] merged the report server branch

3044. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3045. By Olivier Laurent (Open ERP)

[FIX] po file parser: database creation crashes if res_id is an empty string

3046. By Xavier (Open ERP)

[ADD] base: web_icon for administration and sales applications

3047. By Xavier (Open ERP)

[IMP] fix colspan on left-hand column of install wizards

3048. By Olivier Dony (Odoo)

[MERGE] font loading issues fixed + performance improvements at module install/load

3049. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3050. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3051. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3052. By Olivier Dony (Odoo)

[MERGE] orm.read_group: partial support for orderby (m2o only so far)

3053. By Francois Degrave

[MERGE] base/rng: missing day_length added to gantt element

3054. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3055. By Olivier Dony (Odoo)

[MERGE+FIX] fixes for translations,sequence,copy,error messages - some patches courtesy of Margarita Manterola and Don Kirkby

3056. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3057. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3058. By Olivier Laurent (Open ERP)

[FIX] base: res.widget.user: (transparently) prevent adding the same widget to the same user twice

3059. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3060. By Olivier Dony (Odoo)

[FIX] base,yaml: fixed !assert with "count" attribute in yaml tests + enabled more tests in base

3061. By Olivier Dony (Odoo)

[MERGE] fix for bug 626806 by xrg - i.e. [(x2m,in,[])] should match nothing

3062. By Olivier Dony (Odoo)

[ADD] base: yaml tests for basic domain expressions (including some for bug 626806), mostly courtesy of xrg

3063. By Olivier Dony (Odoo)

[ADD] base: support alphabet-specific languages as in Rosetta + enabled Serbian@Latin

3064. By Olivier Dony (Odoo)

[I18N] base: updated PO template after latest cleanup

3065. By Christophe Simonis (OpenERP)

[FIX] base: check external dependencies at module update

3066. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3067. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3068. By Olivier Dony (Odoo)

[MERGE] fix for search view bug 681479 + improved support for images in RML, both courtesy of P. Christeas

3069. By Olivier Dony (Odoo)

[FIX] report.trml2pdf: fix path to locate <images> in RML

3070. By Olivier Dony (Odoo)

[FIX] orm.read_group: support ordering by any field (not just m2o ones)

3071. By Olivier Dony (Odoo)

[FIX] ir_values: revert GTK-specific hack for search_view_id after GTK client was fixed

3072. By Olivier Dony (Odoo)

[FIX] base: missing import _() in base_module_upgrade

3073. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3074. By Olivier Dony (Odoo)

[FIX] reports: support for multi-company headers (pending improvements after v6.0)

3075. By Olivier Dony (Odoo)

[FIX] tools.misc: correct argument to subprocess.Popen (via xrg, analysis/patch courtesy of Michael Telahun Makonnen)

3076. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3077. By Xavier (Open ERP)

[REM] @default attribute: not handled by the GTK client and not specified anywhere or by anyone

3078. By Olivier Dony (Odoo)

[FIX] osv.obj_list is broken via RPC and should not be available anymore

3079. By Olivier Dony (Odoo)

[IMP] license: renamed general license file, and included note about other applicable licenses

3080. By Olivier Dony (Odoo)

[FIX] base,release: updated some remaining source files to AGPLv3 license

3081. By Nicolas Vanhoren (OpenERP)

[MERGE] refactor maintenance.contract into publisher_warranty.contract + add system logs scheduler

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-12-02 10:01:14 +0000
3+++ .bzrignore 2010-12-08 16:09:30 +0000
4@@ -18,3 +18,6 @@
5 build/
6 bin/yolk
7 bin/pil*.py
8+.project
9+.pydevproject
10+.settings
11
12=== modified file 'bin/addons/base/__init__.py'
13--- bin/addons/base/__init__.py 2009-10-20 10:52:23 +0000
14+++ bin/addons/base/__init__.py 2010-12-08 16:09:30 +0000
15@@ -22,7 +22,7 @@
16 import ir
17 import module
18 import res
19-import maintenance
20+import publisher_warranty
21
22 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
23
24
25=== modified file 'bin/addons/base/__openerp__.py'
26--- bin/addons/base/__openerp__.py 2010-12-03 14:20:35 +0000
27+++ bin/addons/base/__openerp__.py 2010-12-08 16:09:30 +0000
28@@ -71,11 +71,12 @@
29
30 'res/ir_property_view.xml',
31 'security/base_security.xml',
32- 'maintenance/maintenance_view.xml',
33+ 'publisher_warranty/publisher_warranty_view.xml',
34
35 'security/ir.model.access.csv',
36 'res/res_widget_view.xml',
37 'res/res_widget_data.xml',
38+ 'publisher_warranty/publisher_warranty_data.xml',
39 ],
40 'demo_xml': [
41 'base_demo.xml',
42
43=== modified file 'bin/addons/base/ir/__init__.py'
44--- bin/addons/base/ir/__init__.py 2010-11-10 15:04:48 +0000
45+++ bin/addons/base/ir/__init__.py 2010-12-08 16:09:30 +0000
46@@ -34,6 +34,7 @@
47 import workflow
48 import ir_rule
49 import wizard
50+import ir_config_parameter
51 import osv_memory_autovacuum
52
53 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
54
55=== added file 'bin/addons/base/ir/ir_config_parameter.py'
56--- bin/addons/base/ir/ir_config_parameter.py 1970-01-01 00:00:00 +0000
57+++ bin/addons/base/ir/ir_config_parameter.py 2010-12-08 16:09:30 +0000
58@@ -0,0 +1,101 @@
59+# -*- coding: utf-8 -*-
60+##############################################################################
61+#
62+# OpenERP, Open Source Management Solution
63+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
64+#
65+# This program is free software: you can redistribute it and/or modify
66+# it under the terms of the GNU Affero General Public License as
67+# published by the Free Software Foundation, either version 3 of the
68+# License, or (at your option) any later version.
69+#
70+# This program is distributed in the hope that it will be useful,
71+# but WITHOUT ANY WARRANTY; without even the implied warranty of
72+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73+# GNU Affero General Public License for more details.
74+#
75+# You should have received a copy of the GNU Affero General Public License
76+# along with this program. If not, see <http://www.gnu.org/licenses/>.
77+#
78+##############################################################################
79+"""
80+A module to store some configuration parameters relative to a whole database.
81+"""
82+
83+from osv import osv,fields
84+import uuid
85+import datetime
86+from tools import misc
87+
88+"""
89+A dictionary holding some configuration parameters to be initialized when the database is created.
90+"""
91+_default_parameters = {
92+ "database.uuid": lambda: str(uuid.uuid1()),
93+ "database.create_date": lambda: datetime.datetime.now().strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT),
94+}
95+
96+class ir_config_parameter(osv.osv):
97+ """ An osv to old configuration parameters for a given database.
98+
99+ To be short, it's just a global dictionary of strings stored in a table. """
100+
101+ _name = 'ir.config_parameter'
102+
103+ _columns = {
104+ # The key of the configuration parameter.
105+ 'key': fields.char('Key', size=256, required=True, select=1),
106+ # The value of the configuration parameter.
107+ 'value': fields.text('Value', required=True),
108+ }
109+
110+ _sql_constraints = [
111+ ('key_uniq', 'unique (key)', 'Key must be unique.')
112+ ]
113+
114+ def init(self, cr):
115+ """
116+ Initializes the parameters listed in _default_parameters.
117+ """
118+ for key, func in _default_parameters.iteritems():
119+ ids = self.search(cr, 1, [('key','=',key)])
120+ if not ids:
121+ self.set_param(cr, 1, key, func())
122+
123+ def get_param(self, cr, uid, key, context=None):
124+ """ Get the value of a parameter.
125+
126+ @param key: The key of the parameter.
127+ @type key: string
128+ @return: The value of the parameter, False if it does not exist.
129+ @rtype: string
130+ """
131+ ids = self.search(cr, uid, [('key','=',key)], context=context)
132+ if not ids:
133+ return False
134+ param = self.browse(cr, uid, ids[0], context=context)
135+ value = param.value
136+ return value
137+
138+ def set_param(self, cr, uid, key, value, context=None):
139+ """ Set the value of a parameter.
140+
141+ @param key: The key of the parameter.
142+ @type key: string
143+ @param value: The value of the parameter.
144+ @type value: string
145+ @return: Return the previous value of the parameter of False if it did
146+ not existed.
147+ @rtype: string
148+ """
149+ ids = self.search(cr, uid, [('key','=',key)], context=context)
150+ if ids:
151+ param = self.browse(cr, uid, ids[0], context=context)
152+ old = param.value
153+ self.write(cr, uid, ids, {'value': value}, context=context)
154+ return old
155+ else:
156+ self.create(cr, uid, {'key': key, 'value': value}, context=context)
157+ return False
158+
159+ir_config_parameter()
160
161=== modified file 'bin/addons/base/ir/ir_cron.py'
162--- bin/addons/base/ir/ir_cron.py 2010-12-08 14:17:07 +0000
163+++ bin/addons/base/ir/ir_cron.py 2010-12-08 16:09:30 +0000
164@@ -144,7 +144,8 @@
165
166 def restart(self, dbname):
167 self.cancel(dbname)
168- self._poolJobs(dbname)
169+ # Reschedule cron processing job asap, but not in the current thread
170+ self.setAlarm(self._poolJobs, time.time(), dbname, dbname)
171
172 def create(self, cr, uid, vals, context=None):
173 res = super(ir_cron, self).create(cr, uid, vals, context=context)
174
175=== removed directory 'bin/addons/base/maintenance'
176=== removed file 'bin/addons/base/maintenance/__init__.py'
177--- bin/addons/base/maintenance/__init__.py 2009-10-20 10:52:23 +0000
178+++ bin/addons/base/maintenance/__init__.py 1970-01-01 00:00:00 +0000
179@@ -1,25 +0,0 @@
180-# -*- coding: utf-8 -*-
181-##############################################################################
182-#
183-# OpenERP, Open Source Management Solution
184-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
185-#
186-# This program is free software: you can redistribute it and/or modify
187-# it under the terms of the GNU Affero General Public License as
188-# published by the Free Software Foundation, either version 3 of the
189-# License, or (at your option) any later version.
190-#
191-# This program is distributed in the hope that it will be useful,
192-# but WITHOUT ANY WARRANTY; without even the implied warranty of
193-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194-# GNU Affero General Public License for more details.
195-#
196-# You should have received a copy of the GNU Affero General Public License
197-# along with this program. If not, see <http://www.gnu.org/licenses/>.
198-#
199-##############################################################################
200-
201-import maintenance
202-
203-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
204-
205
206=== removed file 'bin/addons/base/maintenance/maintenance.py'
207--- bin/addons/base/maintenance/maintenance.py 2009-10-20 10:52:23 +0000
208+++ bin/addons/base/maintenance/maintenance.py 1970-01-01 00:00:00 +0000
209@@ -1,206 +0,0 @@
210-# -*- coding: utf-8 -*-
211-##############################################################################
212-#
213-# OpenERP, Open Source Management Solution
214-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
215-#
216-# This program is free software: you can redistribute it and/or modify
217-# it under the terms of the GNU Affero General Public License as
218-# published by the Free Software Foundation, either version 3 of the
219-# License, or (at your option) any later version.
220-#
221-# This program is distributed in the hope that it will be useful,
222-# but WITHOUT ANY WARRANTY; without even the implied warranty of
223-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
224-# GNU Affero General Public License for more details.
225-#
226-# You should have received a copy of the GNU Affero General Public License
227-# along with this program. If not, see <http://www.gnu.org/licenses/>.
228-#
229-##############################################################################
230-
231-from osv import osv, fields
232-import pooler
233-import time
234-import netsvc
235-
236-from tools.misc import debug
237-from tools.misc import ustr
238-from tools.translate import _
239-import tools.maintenance as tm
240-
241-class maintenance_contract_module(osv.osv):
242- _name ="maintenance.contract.module"
243- _description = "maintenance contract modules"
244- _columns = {
245- 'name' : fields.char('Name', size=128, required=True),
246- 'version': fields.char('Version', size=64,),
247- }
248-
249-maintenance_contract_module()
250-
251-class maintenance_contract(osv.osv):
252- _name = "maintenance.contract"
253- _description = "Maintenance Contract"
254-
255- def _get_valid_contracts(self, cr, uid):
256- return [contract for contract in self.browse(cr, uid, self.search(cr, uid, [])) if contract.state == 'valid']
257-
258- def status(self, cr, uid):
259- covered_modules, uncovered_modules = set(), set()
260-
261- status = 'none'
262- for contract in self._get_valid_contracts(cr, uid):
263- covered_modules.update([m.name for m in contract.module_ids])
264-
265- if covered_modules:
266- modobj = self.pool.get('ir.module.module')
267- modids = modobj.search(cr, uid, [('state', '=', 'installed')])
268- uncovered_modules = set(m.name for m in modobj.browse(cr, uid, modids)) - covered_modules
269- status = ['full', 'partial'][len(uncovered_modules) > 0]
270-
271- return {
272- 'status': status,
273- 'uncovered_modules': list(uncovered_modules),
274- }
275-
276- def send(self, cr, uid, tb, explanations, remarks=None):
277- status = self.status(cr, uid)
278- if status['status'] != 'full':
279- raise osv.except_osv(_('Error'), _("Your can't submit bug reports due to uncovered modules: %s") % (', '.join(status['uncovered_modules']),))
280-
281- dbmsg = _('This error occurs on database %s') % (cr.dbname,)
282- if not remarks:
283- remarks = dbmsg
284- else:
285- remarks += '\n\n-----\n' + dbmsg
286-
287- valid_contracts = self._get_valid_contracts(cr, uid)
288-
289- crm_case_id = None
290- rc = None
291- try:
292- for contract in valid_contracts:
293- rc = tm.remote_contract(contract.name, contract.password)
294- if rc.id:
295- break
296- rc = None
297-
298- if not rc:
299- raise osv.except_osv(_('Error'), _('Unable to find a valid contract'))
300-
301- origin = 'client'
302- crm_case_id = rc.submit(rc.id, tb, explanations, remarks or '', origin)
303-
304- except tm.RemoteContractException, rce:
305- netsvc.Logger().notifyChannel('maintenance', netsvc.LOG_INFO, rce)
306- except osv.except_osv:
307- raise
308- except:
309- pass
310-
311- cid = rc and rc.name or valid_contracts[0].name
312- try:
313- # as backup, put it also in another database...
314- import urllib
315- args = urllib.urlencode({
316- 'contract_id': cid,
317- 'crm_case_id': crm_case_id or 0,
318- 'explanation': explanations,
319- 'remark': remarks or '',
320- 'tb': tb,
321- })
322- uo = urllib.urlopen('http://www.openerp.com/scripts/maintenance.php', args)
323- submit_result = uo.read()
324- debug(submit_result)
325- uo.close()
326- except:
327- if not crm_case_id:
328- # TODO schedule a retry (ir.cron)
329- return False
330- return True
331-
332- def _valid_get(self, cr, uid, ids, field_name, arg, context=None):
333- res = {}
334- for contract in self.browse(cr, uid, ids, context=context):
335- res[contract.id] = ("unvalid", "valid")[contract.date_stop >= time.strftime('%Y-%m-%d')]
336- return res
337-
338- _columns = {
339- 'name' : fields.char('Contract ID', size=256, required=True, readonly=True),
340- 'password' : fields.char('Password', size=64, invisible=True, required=True, readonly=True),
341- 'date_start' : fields.date('Starting Date', readonly=True),
342- 'date_stop' : fields.date('Ending Date', readonly=True),
343- 'module_ids' : fields.many2many('maintenance.contract.module', 'maintenance_contract_module_rel', 'contract_id', 'module_id', 'Covered Modules', readonly=True),
344- 'state' : fields.function(_valid_get, method=True, string="State", type="selection", selection=[('valid', 'Valid'),('unvalid', 'Unvalid')], readonly=True),
345- 'kind' : fields.selection([('full', 'Full'),('partial', 'Partial')], 'Kind', required=True, readonly=True),
346- }
347- _defaults = {
348- 'password' : lambda obj,cr,uid,context={} : '',
349- }
350- _sql_constraints = [
351- ('uniq_name', 'unique(name)', "Your maintenance contract is already subscribed in the system !")
352- ]
353-
354-maintenance_contract()
355-
356-
357-class maintenance_contract_wizard(osv.osv_memory):
358- _name = 'maintenance.contract.wizard'
359-
360- _columns = {
361- 'name' : fields.char('Contract ID', size=256, required=True ),
362- 'password' : fields.char('Password', size=64, required=True),
363- 'state' : fields.selection([('draft', 'Draft'),('validated', 'Validated'),('unvalidated', 'Unvalidated')], 'States'),
364- }
365-
366- _defaults = {
367- 'state' : lambda *a: 'draft',
368- }
369-
370- def action_validate(self, cr, uid, ids, context=None):
371- if not ids:
372- return False
373-
374- module_proxy = self.pool.get('ir.module.module')
375- module_ids = module_proxy.search(cr, uid, [('state', '=', 'installed')])
376- modules = module_proxy.read(cr, uid, module_ids, ['name', 'installed_version'])
377-
378- contract = self.read(cr, uid, ids, ['name', 'password'])[0]
379-
380- try:
381- contract_info = tm.remote_contract(contract['name'], contract['password'], modules)
382- except tm.RemoteContractException, rce:
383- raise osv.except_osv(_('Error'), ustr(rce))
384-
385- is_ok = contract_info['status'] in ('partial', 'full')
386- if is_ok:
387- module_ids = []
388- if contract_info['modules_with_contract']:
389- for name, version in contract_info['modules_with_contract']:
390- contract_module = self.pool.get('maintenance.contract.module')
391- res = contract_module.search(cr, uid, [('name', '=', name),('version', '=', version)])
392- if not res:
393- id = contract_module.create(cr, uid, { 'name' : name, 'version' : version } )
394- else:
395- id = res[0]
396- module_ids.append(id)
397-
398- self.pool.get('maintenance.contract').create(
399- cr,
400- uid, {
401- 'name' : contract['name'],
402- 'password' : contract['password'],
403- 'date_start' : contract_info['date_from'],
404- 'date_stop' : contract_info['date_to'],
405- 'kind' : contract_info['status'],
406- 'module_ids' : [(6,0,module_ids)],
407- }
408- )
409-
410- return self.write(cr, uid, ids, {'state' : ('unvalidated', 'validated')[is_ok] }, context=context)
411-
412-maintenance_contract_wizard()
413-
414-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
415-
416
417=== removed file 'bin/addons/base/maintenance/maintenance_security.xml'
418--- bin/addons/base/maintenance/maintenance_security.xml 2010-06-12 16:21:33 +0000
419+++ bin/addons/base/maintenance/maintenance_security.xml 1970-01-01 00:00:00 +0000
420@@ -1,6 +0,0 @@
421-<?xml version="1.0" encoding="utf-8"?>
422-<openerp>
423-<data noupdate="0">
424-
425-</data>
426-</openerp>
427
428=== removed file 'bin/addons/base/maintenance/maintenance_view.xml'
429--- bin/addons/base/maintenance/maintenance_view.xml 2010-10-15 06:54:45 +0000
430+++ bin/addons/base/maintenance/maintenance_view.xml 1970-01-01 00:00:00 +0000
431@@ -1,131 +0,0 @@
432-<?xml version="1.0" encoding="utf-8"?>
433-<openerp>
434- <data>
435-
436- <record id="maintenance_contract_tree_view" model="ir.ui.view">
437- <field name="name">maintenance.contract.tree</field>
438- <field name="model">maintenance.contract</field>
439- <field name="type">tree</field>
440- <field name="arch" type="xml">
441- <tree string="Maintenance Contract">
442- <field name="name"/>
443- <field name="date_start"/>
444- <field name="date_stop"/>
445- <field name="state" />
446- </tree>
447- </field>
448- </record>
449-
450- <record id="maintenance_contract_form_view" model="ir.ui.view">
451- <field name="name">maintenance.contract.form</field>
452- <field name="model">maintenance.contract</field>
453- <field name="type">form</field>
454- <field name="arch" type="xml">
455- <form string="Maintenance Contract">
456- <group col="6" colspan="4">
457- <field name="name"/>
458- <field name="date_start"/>
459- <field name="date_stop"/>
460- </group>
461- <separator string="Covered Modules" colspan="4"/>
462- <field name="module_ids" nolabel="1" colspan="4">
463- <tree string="Covered Modules">
464- <field name="name" />
465- <field name="version" />
466- </tree>
467- </field>
468- <field name="state" colspan="4"/>
469- </form>
470- </field>
471- </record>
472-
473- <record id="maintenance_contract_search_view" model="ir.ui.view">
474- <field name="name">maintenance.contract.search</field>
475- <field name="model">maintenance.contract</field>
476- <field name="type">search</field>
477- <field name="arch" type="xml">
478- <search string="Maintenance Contract">
479- <field name="name"/>
480- <field name="date_start"/>
481- <field name="date_stop"/>
482- </search>
483- </field>
484- </record>
485-
486- <record id="maintenance_contract_view_calendar" model="ir.ui.view">
487- <field name="name">maintenance.contract.calendar</field>
488- <field name="model">maintenance.contract</field>
489- <field name="type">calendar</field>
490- <field name="arch" type="xml">
491- <calendar string="Maintenance Contract" date_start="date_start" color="state">
492- <field name="name"/>
493- <field name="state"/>
494- </calendar>
495- </field>
496- </record>
497-
498- <record id="action_maintenance_contract_form" model="ir.actions.act_window">
499- <field name="name">Maintenance Contracts</field>
500- <field name="type">ir.actions.act_window</field>
501- <field name="res_model">maintenance.contract</field>
502- <field name="view_type">form</field>
503- <field name="view_mode">tree,form,calendar</field>
504- <field name="search_view_id" ref="maintenance_contract_search_view"/>
505- </record>
506-
507- <menuitem
508- name="Maintenance"
509- id="maintenance"
510- parent="base.menu_administration" groups="base.group_extended"/>
511-
512- <menuitem
513- action="action_maintenance_contract_form"
514- id="menu_maintenance_contract"
515- parent="maintenance"/>
516-
517- <record id="maintenance_contract_add_wizard" model="ir.ui.view">
518- <field name="name">maintenance.contract.add.wizard</field>
519- <field name="model">maintenance.contract.wizard</field>
520- <field name="type">form</field>
521- <field name="arch" type="xml">
522- <form string="Add Maintenance Contract" col="2">
523- <group col="1">
524- <separator string="Add Maintenance Contract" />
525- <group states="draft">
526- <field name="name" width="250" />
527- <newline />
528- <field name="password" password="True" />
529- <field name="state" invisible="1" />
530- </group>
531- <group states="validated">
532- <label string="Maintenance contract added !"/>
533- </group>
534- <group states="unvalidated">
535- <label string="Could you check your contract information ?" />
536- </group>
537- </group>
538- <group colspan="4">
539- <button type="object" string="_Cancel" icon="gtk-cancel" special="cancel" states="draft"/>
540- <button type="object" string="_Validate" icon="gtk-apply" name="action_validate" states="draft"/>
541- <button type="object" string="_Close" icon="gtk-close" special="cancel" states="validated,unvalidated"/>
542- </group>
543- </form>
544- </field>
545- </record>
546-
547- <record id="action_maintenance_contract_add_wizard" model="ir.actions.act_window">
548- <field name="name">Add Maintenance Contract</field>
549- <field name="type">ir.actions.act_window</field>
550- <field name="res_model">maintenance.contract.wizard</field>
551- <field name="view_type">form</field>
552- <field name="view_mode">form</field>
553- <field name="target">new</field>
554- </record>
555-
556- <menuitem
557- action="action_maintenance_contract_add_wizard"
558- id="menu_maintenance_contract_add"
559- parent="maintenance" />
560-
561- </data>
562-</openerp>
563
564=== added directory 'bin/addons/base/publisher_warranty'
565=== added file 'bin/addons/base/publisher_warranty/__init__.py'
566--- bin/addons/base/publisher_warranty/__init__.py 1970-01-01 00:00:00 +0000
567+++ bin/addons/base/publisher_warranty/__init__.py 2010-12-08 16:09:30 +0000
568@@ -0,0 +1,25 @@
569+# -*- coding: utf-8 -*-
570+##############################################################################
571+#
572+# OpenERP, Open Source Management Solution
573+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
574+#
575+# This program is free software: you can redistribute it and/or modify
576+# it under the terms of the GNU Affero General Public License as
577+# published by the Free Software Foundation, either version 3 of the
578+# License, or (at your option) any later version.
579+#
580+# This program is distributed in the hope that it will be useful,
581+# but WITHOUT ANY WARRANTY; without even the implied warranty of
582+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
583+# GNU Affero General Public License for more details.
584+#
585+# You should have received a copy of the GNU Affero General Public License
586+# along with this program. If not, see <http://www.gnu.org/licenses/>.
587+#
588+##############################################################################
589+
590+import publisher_warranty
591+
592+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
593+
594
595=== added file 'bin/addons/base/publisher_warranty/publisher_warranty.py'
596--- bin/addons/base/publisher_warranty/publisher_warranty.py 1970-01-01 00:00:00 +0000
597+++ bin/addons/base/publisher_warranty/publisher_warranty.py 2010-12-08 16:09:30 +0000
598@@ -0,0 +1,320 @@
599+# -*- coding: utf-8 -*-
600+##############################################################################
601+#
602+# OpenERP, Open Source Management Solution
603+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
604+#
605+# This program is free software: you can redistribute it and/or modify
606+# it under the terms of the GNU Affero General Public License as
607+# published by the Free Software Foundation, either version 3 of the
608+# License, or (at your option) any later version.
609+#
610+# This program is distributed in the hope that it will be useful,
611+# but WITHOUT ANY WARRANTY; without even the implied warranty of
612+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
613+# GNU Affero General Public License for more details.
614+#
615+# You should have received a copy of the GNU Affero General Public License
616+# along with this program. If not, see <http://www.gnu.org/licenses/>.
617+#
618+##############################################################################
619+"""
620+Module to handle publisher warranty contracts as well as notifications from
621+OpenERP.
622+"""
623+
624+from osv import osv, fields
625+import logging
626+from tools.translate import _
627+import urllib
628+import urllib2
629+from tools.safe_eval import safe_eval
630+import pooler
631+from tools.config import config
632+import release
633+import datetime
634+from tools import misc
635+import sys
636+
637+_logger = logging.getLogger(__name__)
638+
639+"""
640+Time interval that will be used to determine up to which date we will
641+check the logs to see if a message we just received was already logged.
642+@type: datetime.timedelta
643+"""
644+_PREVIOUS_LOG_CHECK = datetime.timedelta(days=365)
645+
646+class publisher_warranty_contract(osv.osv):
647+ """
648+ Osv representing a publisher warranty contract.
649+ """
650+ _name = "publisher_warranty.contract"
651+
652+ def _get_valid_contracts(self, cr, uid):
653+ """
654+ Return the list of the valid contracts encoded in the system.
655+
656+ @return: A list of contracts
657+ @rtype: list of publisher_warranty.contract browse records
658+ """
659+ return [contract for contract in self.browse(cr, uid, self.search(cr, uid, []))
660+ if contract.state == 'valid']
661+
662+ def status(self, cr, uid):
663+ """ Method called by the client to check availability of publisher warranty contract. """
664+
665+ contracts = self._get_valid_contracts(cr, uid)
666+ return {
667+ 'status': "full" if contracts else "none" ,
668+ 'uncovered_modules': list(),
669+ }
670+
671+ def send(self, cr, uid, tb, explanations, remarks=None):
672+ """ Method called by the client to send a problem to the publisher warranty server. """
673+
674+ if not remarks:
675+ remarks = ""
676+
677+ valid_contracts = self._get_valid_contracts(cr, uid)
678+ valid_contract = valid_contracts[0]
679+
680+ try:
681+ origin = 'client'
682+ dbuuid = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
683+ db_create_date = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.create_date')
684+
685+ msg = {'contract_name': valid_contract.name,
686+ 'tb': tb,
687+ 'explanations': explanations,
688+ 'remarks': remarks,
689+ 'origin': origin,
690+ 'dbname': cr.dbname,
691+ 'dbuuid': dbuuid,
692+ 'db_create_date': db_create_date}
693+
694+
695+ add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
696+ uo = urllib2.urlopen(config.get("publisher_warranty_url"),
697+ urllib.urlencode({'arg0': msg, "action": "send",}),**add_arg)
698+ try:
699+ submit_result = uo.read()
700+ finally:
701+ uo.close()
702+
703+ result = safe_eval(submit_result)
704+
705+ crm_case_id = result
706+
707+ if not crm_case_id:
708+ return False
709+
710+ except osv.except_osv:
711+ raise
712+ except:
713+ _logger.warning("Error sending problem report", exc_info=1)
714+ raise osv.except_osv("Connection error", "An error occured during the connection " +
715+ "with the publisher warranty server.")
716+
717+ return True
718+
719+ def check_validity(self, cr, uid, ids, context={}):
720+ """
721+ Check the validity of a publisher warranty contract. This method just call get_logs() but checks
722+ some more things, so it can be called from a user interface.
723+ """
724+ contract_id = ids[0]
725+ contract = self.browse(cr, uid, contract_id)
726+ state = contract.state
727+ validated = state != "unvalidated"
728+
729+ self.get_logs(cr, uid, ids, cron_mode=False, context=context)
730+
731+ contract = self.browse(cr, uid, contract_id)
732+ validated2 = contract.state != "unvalidated"
733+ if not validated and not validated2:
734+ raise osv.except_osv(_("Contract validation error"),
735+ _("Please check your publisher warranty contract name and validity."))
736+
737+ def get_logs(self, cr, uid, ids, cron_mode=True, context={}):
738+ """
739+ Send a message to OpenERP's publisher warranty server to check the validity of
740+ the contracts, get notifications, etc...
741+
742+ @param cron_mode: If true, catch all exceptions (appropriate for usage in a cron).
743+ @type cron_mode: boolean
744+ """
745+ try:
746+ try:
747+ result = get_sys_logs(cr, uid)
748+ except:
749+ _logger.debug("Exception while sending a get logs messages", exc_info=1)
750+ raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server."))
751+
752+ contracts = result["contracts"]
753+ for contract in contracts:
754+ c_id = self.search(cr, uid, [("name","=",contract)])[0]
755+ date_from = contracts[contract][0]
756+ date_to = contracts[contract][1]
757+ state = contracts[contract][2]
758+ self.write(cr, uid, c_id, {
759+ "date_start": date_from,
760+ "date_stop": date_to,
761+ "state": state,
762+ })
763+
764+ limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
765+ for message in result["messages"]:
766+ ids = self.pool.get("res.log").search(cr, uid, [("res_model", "=", "publisher_warranty.contract"),
767+ ("create_date", ">=", limit_date),
768+ ("name", "=", message)])
769+ if ids:
770+ continue
771+ self.pool.get('res.log').create(cr, uid,
772+ {
773+ 'name': message,
774+ 'res_model': "publisher_warranty.contract",
775+ "read": True,
776+ "user_id": False,
777+ },
778+ context=context
779+ )
780+ except:
781+ if cron_mode:
782+ return False # we don't want to see any stack trace in cron
783+ else:
784+ raise
785+ return True
786+
787+ def get_last_user_messages(self, cr, uid, limit, context={}):
788+ """
789+ Get the messages to be written in the web client.
790+ @return: A list of html messages with ids, can be False or empty.
791+ @rtype: list of tuples(int,string)
792+ """
793+ ids = self.pool.get('res.log').search(cr, uid, [("res_model", "=", "publisher_warranty.contract")]
794+ , order="create_date desc", limit=limit)
795+ if not ids:
796+ return []
797+ messages = [(x.id, x.name) for x in self.pool.get('res.log').browse(cr, uid, ids)]
798+
799+ return messages
800+
801+ def del_user_message(self, cr, uid, id, context={}):
802+ """
803+ Delete a message.
804+ """
805+ self.pool.get('res.log').unlink(cr, uid, [id])
806+
807+ return True
808+
809+ _columns = {
810+ 'name' : fields.char('Serial Key', size=384, required=True),
811+ 'date_start' : fields.date('Starting Date', readonly=True),
812+ 'date_stop' : fields.date('Ending Date', readonly=True),
813+ 'state' : fields.selection([('unvalidated', 'Unvalidated'), ('valid', 'Valid')
814+ , ('terminated', 'Terminated'), ('canceled', 'Canceled')], string="State", readonly=True),
815+ 'kind' : fields.char('Kind', size=64, readonly=True),
816+ }
817+
818+ _defaults = {
819+ 'state': 'unvalidated',
820+ }
821+
822+ _sql_constraints = [
823+ ('uniq_name', 'unique(name)', "Your publisher warranty contract is already subscribed in the system !")
824+ ]
825+
826+publisher_warranty_contract()
827+
828+class maintenance_contract(osv.osv_memory):
829+ """ Old osv we only keep for compatibility with the clients. """
830+
831+ _name = "maintenance.contract"
832+
833+ def status(self, cr, uid):
834+ return self.pool.get("publisher_warranty.contract").status(cr, uid)
835+
836+ def send(self, cr, uid, tb, explanations, remarks=None):
837+ return self.pool.get("publisher_warranty.contract").send(cr, uid, tb, explanations, remarks)
838+
839+maintenance_contract()
840+
841+class publisher_warranty_contract_wizard(osv.osv_memory):
842+ """
843+ A wizard osv to help people entering a publisher warranty contract.
844+ """
845+ _name = 'publisher_warranty.contract.wizard'
846+ _inherit = "ir.wizard.screen"
847+
848+ _columns = {
849+ 'name' : fields.char('Serial Key', size=256, required=True ),
850+ 'state' : fields.selection([("draft", "Draft"), ("finished", "Finished")])
851+ }
852+
853+ _defaults = {
854+ "state": "draft",
855+ }
856+
857+ def action_validate(self, cr, uid, ids, context=None):
858+ if not ids:
859+ return False
860+
861+ wiz = self.browse(cr, uid, ids[0])
862+ c_name = wiz.name
863+
864+ contract_osv = self.pool.get("publisher_warranty.contract")
865+ contracts = contract_osv.search(cr, uid, [("name","=",c_name)])
866+ if contracts:
867+ raise osv.except_osv(_("Error"), _("That contract is already registered in the system."))
868+
869+ contract_id = contract_osv.create(cr, uid, {
870+ "name": c_name,
871+ "state": "unvalidated",
872+ })
873+
874+ contract_osv.check_validity(cr, uid, [contract_id])
875+
876+ self.write(cr, uid, ids, {"state": "finished"})
877+
878+ return True
879+
880+
881+publisher_warranty_contract_wizard()
882+
883+def get_sys_logs(cr, uid):
884+ """
885+ Utility method to send a publisher warranty get logs messages.
886+ """
887+ pool = pooler.get_pool(cr.dbname)
888+
889+ dbuuid = pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
890+ db_create_date = pool.get('ir.config_parameter').get_param(cr, uid, 'database.create_date')
891+ nbr_users = pool.get("res.users").search(cr, uid, [], count=True)
892+ contractosv = pool.get('publisher_warranty.contract')
893+ contracts = contractosv.browse(cr, uid, contractosv.search(cr, uid, []))
894+ user = pool.get("res.users").browse(cr, uid, uid)
895+ msg = {
896+ "dbuuid": dbuuid,
897+ "nbr_users": nbr_users,
898+ "dbname": cr.dbname,
899+ "db_create_date": db_create_date,
900+ "version": release.version,
901+ "contracts": [c.name for c in contracts],
902+ "language": user.context_lang,
903+ }
904+
905+ add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
906+ uo = urllib2.urlopen(config.get("publisher_warranty_url"),
907+ urllib.urlencode({'arg0': msg, "action": "update",}), **add_arg)
908+ try:
909+ submit_result = uo.read()
910+ finally:
911+ uo.close()
912+
913+ result = safe_eval(submit_result)
914+
915+ return result
916+
917+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
918+
919
920=== added file 'bin/addons/base/publisher_warranty/publisher_warranty_data.xml'
921--- bin/addons/base/publisher_warranty/publisher_warranty_data.xml 1970-01-01 00:00:00 +0000
922+++ bin/addons/base/publisher_warranty/publisher_warranty_data.xml 2010-12-08 16:09:30 +0000
923@@ -0,0 +1,20 @@
924+<?xml version="1.0" encoding="UTF-8"?>
925+<openerp>
926+ <data>
927+
928+ <record id="ir_cron_ping_scheduler" model="ir.cron">
929+ <field name="name">Update System Logs</field>
930+ <field eval="True" name="active" />
931+ <field name="user_id" ref="base.user_root" />
932+ <field name="interval_number">1</field>
933+ <field name="interval_type">weeks</field>
934+ <field name="numbercall">-1</field>
935+ <field eval="False" name="doall" />
936+ <field eval="'publisher_warranty.contract'" name="model" />
937+ <field eval="'get_logs'" name="function" />
938+ <field eval="'(None,)'" name="args" />
939+ <field name="priority">1000</field>
940+ </record>
941+
942+ </data>
943+</openerp>
944\ No newline at end of file
945
946=== added file 'bin/addons/base/publisher_warranty/publisher_warranty_view.xml'
947--- bin/addons/base/publisher_warranty/publisher_warranty_view.xml 1970-01-01 00:00:00 +0000
948+++ bin/addons/base/publisher_warranty/publisher_warranty_view.xml 2010-12-08 16:09:30 +0000
949@@ -0,0 +1,146 @@
950+<?xml version="1.0" encoding="utf-8"?>
951+<openerp>
952+ <data>
953+
954+ <record id="publisher_warranty_contract_tree_view" model="ir.ui.view">
955+ <field name="name">publisher_warranty.contract.tree</field>
956+ <field name="model">publisher_warranty.contract</field>
957+ <field name="type">tree</field>
958+ <field name="arch" type="xml">
959+ <tree string="Publisher Warranty Contracts">
960+ <field name="name"/>
961+ <field name="date_start"/>
962+ <field name="date_stop"/>
963+ <field name="state" />
964+ </tree>
965+ </field>
966+ </record>
967+
968+ <record id="publisher_warranty_contract_form_view" model="ir.ui.view">
969+ <field name="name">publisher_warranty.contract.form</field>
970+ <field name="model">publisher_warranty.contract</field>
971+ <field name="type">form</field>
972+ <field name="arch" type="xml">
973+ <form string="Publisher Warranty Contract">
974+ <group col="2" colspan="4">
975+ <group col="2">
976+ <field name="name"/>
977+ </group>
978+ <group col="2">
979+ <field name="date_start"/>
980+ <field name="date_stop"/>
981+ </group>
982+ <group col="2">
983+ <field name="state"/>
984+ <field name="kind"/>
985+ </group>
986+ <group col="2">
987+ <button name="check_validity" string="Validate" type="object"
988+ attrs="{'invisible':[('state','in',['valid', 'terminated', 'canceled'])]}"/>
989+ <button name="check_validity" string="Refresh Validation Dates" type="object"
990+ attrs="{'invisible':[('state','in',['unvalidated'])]}"/>
991+ </group>
992+ </group>
993+ </form>
994+ </field>
995+ </record>
996+
997+ <record id="publisher_warranty_contract_search_view" model="ir.ui.view">
998+ <field name="name">publisher_warranty.contract.search</field>
999+ <field name="model">publisher_warranty.contract</field>
1000+ <field name="type">search</field>
1001+ <field name="arch" type="xml">
1002+ <search string="Publisher Warranty Contract">
1003+ <field name="name"/>
1004+ <field name="date_start"/>
1005+ <field name="date_stop"/>
1006+ </search>
1007+ </field>
1008+ </record>
1009+
1010+ <record id="publisher_warranty_contract_view_calendar" model="ir.ui.view">
1011+ <field name="name">publisher_warranty.contract.calendar</field>
1012+ <field name="model">publisher_warranty.contract</field>
1013+ <field name="type">calendar</field>
1014+ <field name="arch" type="xml">
1015+ <calendar string="Maintenance Contract" date_start="date_start" color="state">
1016+ <field name="name"/>
1017+ <field name="state"/>
1018+ </calendar>
1019+ </field>
1020+ </record>
1021+
1022+ <record id="action_publisher_warranty_contract_form" model="ir.actions.act_window">
1023+ <field name="name">Contracts</field>
1024+ <field name="type">ir.actions.act_window</field>
1025+ <field name="res_model">publisher_warranty.contract</field>
1026+ <field name="view_type">form</field>
1027+ <field name="view_mode">tree,form,calendar</field>
1028+ <field name="search_view_id" ref="publisher_warranty_contract_search_view"/>
1029+ </record>
1030+
1031+ <menuitem name="Publisher Warranty" id="publisher_warranty"
1032+ parent="base.menu_administration" groups="base.group_extended"/>
1033+
1034+ <menuitem action="action_publisher_warranty_contract_form" id="menu_publisher_warranty_contract"
1035+ parent="publisher_warranty" sequence="2"/>
1036+
1037+
1038+ <record id="publisher_warranty_contract_add_wizard" model="ir.ui.view">
1039+ <field name="name">publisher_warranty.contract.add.wizard</field>
1040+ <field name="model">publisher_warranty.contract.wizard</field>
1041+ <field name="type">form</field>
1042+ <field name="arch" type="xml">
1043+ <form string="Register a Contract">
1044+ <group col="8">
1045+ <group colspan="3" col="1">
1046+ <field name="config_logo" widget="image" width="220" height="130" nolabel="1" colspan="1"/>
1047+ <newline/>
1048+ <label width="220" string="This wizard helps you register a publisher warranty contract in your OpenERP system. After the contract has been registered, you will be able to send issues directly to OpenERP."/>
1049+ <label width="220"/>
1050+ <label width="220" string=""/>
1051+ <field name="state" invisible="1"/>
1052+ </group>
1053+ <separator orientation="vertical" rowspan="5"/>
1054+ <group colspan="4">
1055+ <separator string="Register a Contract" colspan="4"/>
1056+ <group states="draft" col="4">
1057+ <label string="Please enter the serial key provided in your contract document:" colspan="4"/>
1058+ <field name="name" colspan="4"/>
1059+ </group>
1060+ <group states="finished" col="4">
1061+ <label string="Publisher warranty contract successfully registered!" colspan="4"/>
1062+ </group>
1063+ </group>
1064+ <group colspan="8" col="8" states="draft">
1065+ <separator string="" colspan="8"/>
1066+ <label colspan="6" width="220"/>
1067+ <button special="cancel" string="Cancel" icon="gtk-cancel"/>
1068+ <button name="action_validate" string="Register" type="object" icon="gtk-apply"/>
1069+ </group>
1070+ <group colspan="8" col="8" states="finished">
1071+ <separator string="" colspan="8"/>
1072+ <label colspan="6" width="220"/>
1073+ <button special="cancel" string="Close" icon="gtk-ok"/>
1074+ </group>
1075+ </group>
1076+ </form>
1077+ </field>
1078+ </record>
1079+
1080+ <record id="action_publisher_warranty_contract_add_wizard" model="ir.actions.act_window">
1081+ <field name="name">Register a Contract</field>
1082+ <field name="type">ir.actions.act_window</field>
1083+ <field name="res_model">publisher_warranty.contract.wizard</field>
1084+ <field name="view_type">form</field>
1085+ <field name="view_mode">form</field>
1086+ <field name="target">new</field>
1087+ </record>
1088+
1089+ <menuitem
1090+ action="action_publisher_warranty_contract_add_wizard"
1091+ id="menu_publisher_warranty_contract_add"
1092+ parent="publisher_warranty" sequence="1"/>
1093+
1094+ </data>
1095+</openerp>
1096
1097=== modified file 'bin/addons/base/res/res_log.py'
1098--- bin/addons/base/res/res_log.py 2010-11-23 16:05:06 +0000
1099+++ bin/addons/base/res/res_log.py 2010-12-08 16:09:30 +0000
1100@@ -20,24 +20,23 @@
1101 ##############################################################################
1102
1103 from osv import fields, osv
1104-import tools
1105
1106 class res_log(osv.osv):
1107 _name = 'res.log'
1108 _columns = {
1109- 'name': fields.char('Message', size=128, help='The logging message.', required=True),
1110- 'user_id': fields.many2one('res.users','User', required=True),
1111- 'res_model': fields.char('Object', size=128),
1112+ 'name': fields.char('Message', size=250, help='The logging message.', required=True, select=1),
1113+ 'user_id': fields.many2one('res.users','User'),
1114+ 'res_model': fields.char('Object', size=128, select=1),
1115 'context': fields.char('Context', size=250),
1116 'res_id': fields.integer('Object ID'),
1117 'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on'),
1118- 'create_date': fields.datetime('Created Date', readonly=True),
1119- 'read': fields.boolean('Read', help="If this log item has been read, get() should not send it to the client")
1120+ 'create_date': fields.datetime('Created Date', readonly=True, select=1),
1121+ 'read': fields.boolean('Read', help="If this log item has been read, get() should not send it to the client"),
1122 }
1123 _defaults = {
1124 'user_id': lambda self,cr,uid,ctx: uid,
1125 'context': "{}",
1126- 'read': False
1127+ 'read': False,
1128 }
1129 _order='create_date desc'
1130
1131
1132=== modified file 'bin/addons/base/res/res_log_view.xml'
1133--- bin/addons/base/res/res_log_view.xml 2010-10-17 21:47:55 +0000
1134+++ bin/addons/base/res/res_log_view.xml 2010-12-08 16:09:30 +0000
1135@@ -11,6 +11,8 @@
1136 <filter icon="terp-stock_align_left_24" string="Unread" domain="[('read','&lt;&gt;',True)]" name="unread"/>
1137 <separator orientation="vertical"/>
1138 <filter icon="terp-stock_align_left_24" string="My Logs" domain="[('user_id','=',uid)]" name="my"/>
1139+ <filter icon="terp-stock_align_left_24" string="System Logs"
1140+ domain="[('res_model','=','publisher_warranty.contract')]" name="sys"/>
1141 <separator orientation="vertical"/>
1142 <field name="name"/>
1143 <field name="user_id"/>
1144
1145=== modified file 'bin/addons/base/security/ir.model.access.csv'
1146--- bin/addons/base/security/ir.model.access.csv 2010-10-17 21:30:11 +0000
1147+++ bin/addons/base/security/ir.model.access.csv 2010-12-08 16:09:30 +0000
1148@@ -112,8 +112,8 @@
1149 "access_res_payterm_group_system","res_payterm_group_system","model_res_payterm","group_system",1,1,1,1
1150 "access_res_bank_group_partner_manager","res_bank_group_partner_manager","model_res_bank","group_partner_manager",1,1,1,1
1151 "access_res_bank_user","res_bank user","model_res_bank","group_user",1,0,0,0
1152-"access_maintenance_group_user","maintenance_contract group_user","model_maintenance_contract","group_system",1,1,1,1
1153-"access_maintenance_contract_module","maintenance.contract.module","model_maintenance_contract_module","group_system",1,1,1,1
1154+"access_publisher_warranty_group_user","publisher_warranty_contract group_user","model_publisher_warranty_contract","group_system",1,1,1,1
1155+"access_publisher_warranty_all","publisher_warranty_contract all","model_publisher_warranty_contract",,1,0,0,0
1156 "access_multi_company_default user","multi_company_default all","model_multi_company_default",,1,0,0,0
1157 "access_multi_company_default manager","multi_company_default Manager","model_multi_company_default","group_erp_manager",1,1,1,1
1158 "access_ir_filter all","ir_filters all","model_ir_filters",,1,0,0,0
1159@@ -123,3 +123,4 @@
1160 "access_res_widget","res.widget","model_res_widget","group_erp_manager",1,1,1,1
1161 "access_res_widget_user","res.widget.user","model_res_widget",,1,0,0,0
1162 "access_res_log_all","res.log","model_res_log",,1,1,1,1
1163+"access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0
1164
1165=== modified file 'bin/netsvc.py'
1166--- bin/netsvc.py 2010-11-26 13:02:25 +0000
1167+++ bin/netsvc.py 2010-12-08 16:09:30 +0000
1168@@ -490,6 +490,7 @@
1169 self.log('result', result, channel=logging.DEBUG_RPC_ANSWER, depth=(logger.isEnabledFor(logging.DEBUG_SQL) and 5 or 3))
1170 return result
1171 except Exception, e:
1172+ logging.getLogger(__name__).exception("Dispatcher error")
1173 self.log('exception', tools.exception_to_unicode(e))
1174 tb = getattr(e, 'traceback', sys.exc_info())
1175 tb_s = "".join(traceback.format_exception(*tb))
1176
1177=== modified file 'bin/tools/config.py'
1178--- bin/tools/config.py 2010-11-17 12:39:28 +0000
1179+++ bin/tools/config.py 2010-12-08 16:09:30 +0000
1180@@ -31,8 +31,8 @@
1181 try:
1182 from OpenSSL import SSL
1183 import socket
1184-
1185- return hasattr(socket, 'ssl')
1186+
1187+ return hasattr(socket, 'ssl') and hasattr(SSL, "Connection")
1188 except:
1189 return False
1190
1191@@ -91,7 +91,10 @@
1192 'static_http_url_prefix': None,
1193 'secure_cert_file': 'server.cert',
1194 'secure_pkey_file': 'server.pkey',
1195+ 'publisher_warranty_url': 'http://www.openerp.com/publisher-warranty',
1196 }
1197+
1198+ self.blacklist_for_save = set(["publisher_warranty_url"])
1199
1200 self.misc = {}
1201 self.config_file = fname
1202@@ -224,7 +227,7 @@
1203 parser.add_option_group(security)
1204
1205 def parse_config(self):
1206- (opt, args) = self.parser.parse_args()
1207+ opt = self.parser.parse_args()[0]
1208
1209 def die(cond, msg):
1210 if cond:
1211@@ -317,7 +320,7 @@
1212 # If an explicit TZ was provided in the config, make sure it is known
1213 try:
1214 import pytz
1215- tz = pytz.timezone(self.options['timezone'])
1216+ pytz.timezone(self.options['timezone'])
1217 except pytz.UnknownTimeZoneError:
1218 die(True, "The specified timezone (%s) is invalid" % self.options['timezone'])
1219 except:
1220@@ -374,7 +377,10 @@
1221 fp.close()
1222
1223 if is_win32:
1224- import _winreg
1225+ try:
1226+ import _winreg
1227+ except ImportError:
1228+ _winreg = None
1229 x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
1230 y = _winreg.OpenKey(x, r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", 0,_winreg.KEY_ALL_ACCESS)
1231 _winreg.SetValueEx(y,"PGPASSFILE", 0, _winreg.REG_EXPAND_SZ, filename )
1232@@ -436,16 +442,18 @@
1233 p = ConfigParser.ConfigParser()
1234 loglevelnames = dict(zip(self._LOGLEVELS.values(), self._LOGLEVELS.keys()))
1235 p.add_section('options')
1236- for opt in self.options.keys():
1237+ for opt in sorted(self.options.keys()):
1238 if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'):
1239 continue
1240+ if opt in self.blacklist_for_save:
1241+ continue
1242 if opt in ('log_level', 'assert_exit_level'):
1243 p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt]))
1244 else:
1245 p.set('options', opt, self.options[opt])
1246
1247- for sec in self.misc.keys():
1248- for opt in self.misc[sec].keys():
1249+ for sec in sorted(self.misc.keys()):
1250+ for opt in sorted(self.misc[sec].keys()):
1251 p.set(sec,opt,self.misc[sec][opt])
1252
1253 # try to create the directories and write the file
1254
1255=== removed file 'bin/tools/maintenance.py'
1256--- bin/tools/maintenance.py 2009-10-20 10:52:23 +0000
1257+++ bin/tools/maintenance.py 1970-01-01 00:00:00 +0000
1258@@ -1,69 +0,0 @@
1259-# -*- coding: utf-8 -*-
1260-##############################################################################
1261-#
1262-# OpenERP, Open Source Management Solution
1263-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
1264-#
1265-# This program is free software: you can redistribute it and/or modify
1266-# it under the terms of the GNU Affero General Public License as
1267-# published by the Free Software Foundation, either version 3 of the
1268-# License, or (at your option) any later version.
1269-#
1270-# This program is distributed in the hope that it will be useful,
1271-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1272-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1273-# GNU Affero General Public License for more details.
1274-#
1275-# You should have received a copy of the GNU Affero General Public License
1276-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1277-#
1278-##############################################################################
1279-
1280-import xmlrpclib
1281-
1282-class RemoteContractException(Exception): pass
1283-
1284-class remote_contract(object):
1285- def __init__(self, contract_id, contract_password, modules=None):
1286- self.__server = 'http://tiny.my.odoo.com:8069/xmlrpc/'
1287- self.__db = "tiny_belgium"
1288- self.__password = "maintenance"
1289- self.__login = "maintenance"
1290-
1291- rpc = xmlrpclib.ServerProxy(self.__server + 'common')
1292- try:
1293- self.__userid = rpc.login(self.__db, self.__login, self.__password)
1294- except:
1295- raise RemoteContractException("Unable to contact the migration server")
1296-
1297- if not self.__userid:
1298- raise RemoteContractException("Unable to contact the migration server")
1299-
1300- self.__rpc = xmlrpclib.ServerProxy(self.__server + 'object')
1301-
1302-
1303- contract = {
1304- 'name': contract_id,
1305- 'password': contract_password,
1306- }
1307- if modules is None:
1308- modules = []
1309-
1310- info = self.check_contract(modules, contract)
1311- for n in info:
1312- setattr(self, n, info[n])
1313-
1314- self.name = contract_id
1315- self.contract_id = self.name
1316- self.password = contract_password
1317-
1318- def __getattr__(self, fun):
1319- def remote_call(*args, **kwargs):
1320- return self.__rpc.execute(self.__db, self.__userid, self.__password, 'maintenance.maintenance', fun, *args, **kwargs)
1321- return remote_call
1322-
1323- def __getitem__(self, item):
1324- return getattr(self, item)
1325-
1326-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1327-