~ubuntu-branches/ubuntu/trusty/openerp-client/trusty

« back to all changes in this revision

Viewing changes to bin/common/common.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-01-09 18:18:00 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090109181800-p6t4lx2fbr0q3562
Tags: 5.0.0~rc3-1
* Merging upstream version 5.0.0~rc3.
* Using quilt rather than dpatch.
* Updating menu file.
* Updating year in copyright file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
301
301
    win.destroy()
302
302
    return True
303
303
 
304
 
def error(title, message, details='', parent=None):
 
304
def error(title, message, details='', parent=None, disconnected_mode=False):
305
305
    """
306
306
    Show an error dialog with the support request or the maintenance
307
307
    """
310
310
 
311
311
    show_message = True
312
312
 
313
 
    try:
314
 
        contract_ids = rpc.session.rpc_exec_auth_try('/object', 'execute', 'maintenance.contract', 'search', [])
315
 
    except:
316
 
        contract_ids = []
317
 
    if not contract_ids:
318
 
        maintenance_contract_message=_("""
319
 
<i>Open ERP crashed for an unknown reason.</i>
 
313
    if not disconnected_mode:
 
314
        maintenance = rpc.session.rpc_exec_auth_try('/object', 'execute', 'maintenance.contract', 'status')
 
315
    
 
316
        if maintenance['status'] == 'none':
 
317
            maintenance_contract_message=_("""
 
318
<b>An unknown error has been reported.</b>
320
319
 
321
320
<b>You do not have a valid Open ERP maintenance contract !</b>
322
321
If you are using Open ERP in production, it is highly suggested to subscribe
337
336
You can use the link bellow for more information. The detail of the error
338
337
is displayed on the second tab.
339
338
""")
340
 
    else:
341
 
        contract = rpc.session.rpc_exec_auth_try('/object', 'execute', 'maintenance.contract', 'read', contract_ids, [])[0]
342
 
        show_message = (contract['kind'] <> 'full')
343
 
        if show_message:
 
339
        elif maintenance['status'] == 'partial':
344
340
            maintenance_contract_message=_("""
345
 
<b>Open ERP crashed for an unknown reason.</b>
 
341
<b>An unknown error has been reported.</b>
346
342
 
347
343
Your maintenance contract does not cover all modules installed in your system !
348
344
If you are using Open ERP in production, it is highly suggested to upgrade your
349
345
contract.
350
346
 
351
 
If you have developped your own modules or installed third party module, we
 
347
If you have developed your own modules or installed third party module, we
352
348
can provide you an additional maintenance contract for these modules. After
353
349
having reviewed your modules, our quality team will ensure they will migrate
354
 
automatically for all futur stable versions of Open ERP at no extra cost.
 
350
automatically for all future stable versions of Open ERP at no extra cost.
355
351
 
356
352
Here is the list of modules not covered by your maintenance contract:
357
353
%s
358
354
 
359
355
You can use the link bellow for more information. The detail of the error
360
 
is displayed on the second tab.""") % (",".join(result['modules']), )
 
356
is displayed on the second tab.""") % (", ".join(maintenance['uncovered_modules']), )
 
357
        else:
 
358
            show_message = False
 
359
    else:
 
360
        maintenance_contract_message=_("""
 
361
<b>An unknown error has been reported.</b>
 
362
 
 
363
<b>You do not have a valid Open ERP maintenance contract !</b>
 
364
If you are using Open ERP in production, it is highly suggested to subscribe
 
365
a maintenance program.
 
366
 
 
367
The Open ERP maintenance contract provides you a bugfix guarantee and an
 
368
automatic migration system so that we can fix your problems within a few
 
369
hours. If you had a maintenance contract, this error would have been sent
 
370
to the quality team of the Open ERP editor.
 
371
 
 
372
The maintenance program offers you:
 
373
* Automatic migrations on new versions,
 
374
* A bugfix guarantee,
 
375
* Monthly announces of potential bugs and their fixes,
 
376
* Security alerts by email and automatic migration,
 
377
* Access to the customer portal.
 
378
 
 
379
You can use the link bellow for more information. The detail of the error
 
380
is displayed on the second tab.
 
381
""")
361
382
 
362
383
    xmlGlade = glade.XML(terp_path('win_error.glade'), 'dialog_error', gettext.textdomain())
363
384
    win = xmlGlade.get_widget('dialog_error')
378
399
 
379
400
    xmlGlade.get_widget('notebook').remove_page(int(show_message))
380
401
 
381
 
    def send(widget):
382
 
        def get_text_from_text_view(textView):
383
 
            """Retrieve the buffer from a text view and return the content of this buffer"""
384
 
            buffer = textView.get_buffer()
385
 
            return buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
386
 
            
387
 
        # Use details_buffer
388
 
        id_contract = contract['name']
389
 
        traceback = get_text_from_text_view(xmlGlade.get_widget('details_explanation'))
390
 
        explanation = get_text_from_text_view(xmlGlade.get_widget('explanation_textview'))
391
 
        remarks = get_text_from_text_view(xmlGlade.get_widget('remarks_textview'))
392
 
 
393
 
        content = "(%s) has reported the following bug:\n%s\nremarks: %s\nThe traceback is:\n%s" % (
394
 
            id_contract, explanation, remarks, traceback
395
 
        )
396
 
 
397
 
        if upload_data('', content, 'error', id_contract):
398
 
            common.message(_('You problem has been sent to the quality team !\nWe will recontact you after analysing the problem.'))
399
 
        return
400
 
 
401
402
    if not show_message:
 
403
        def send(widget):
 
404
            def get_text_from_text_view(textView):
 
405
                """Retrieve the buffer from a text view and return the content of this buffer"""
 
406
                buffer = textView.get_buffer()
 
407
                return buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
 
408
                
 
409
            # Use details_buffer
 
410
            tb = get_text_from_text_view(xmlGlade.get_widget('details_explanation'))
 
411
            explanation = get_text_from_text_view(xmlGlade.get_widget('explanation_textview'))
 
412
            remarks = get_text_from_text_view(xmlGlade.get_widget('remarks_textview'))
 
413
 
 
414
            if rpc.session.rpc_exec_auth_try('/object', 'execute', 'maintenance.contract', 'send', tb, explanation, remarks):
 
415
                common.message(_('Your problem has been sent to the quality team !\nWe will recontact you after analysing the problem.'))
 
416
            else:
 
417
                message(_('Your problem could <u>NOT</u> be sent to the quality team !\nPlease report this error manually at %s') % ('http://openerp.com/report_bug.html'))
 
418
 
402
419
        xmlGlade.signal_connect('on_button_send_clicked', send)
403
420
        xmlGlade.signal_connect('on_closebutton_clicked', lambda x : win.destroy())
404
421