|
@ -19,9 +19,12 @@ |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
|
|
|
import xmlrpclib |
|
|
|
|
|
|
|
|
import openerp |
|
|
import openerp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WarningOnSaveController(openerp.addons.web.http.Controller): |
|
|
class WarningOnSaveController(openerp.addons.web.http.Controller): |
|
|
_cp_path = "/web_warning_on_save" |
|
|
_cp_path = "/web_warning_on_save" |
|
|
|
|
|
|
|
@ -32,8 +35,12 @@ class WarningOnSaveController(openerp.addons.web.http.Controller): |
|
|
if method does not exist in the model, do nothing |
|
|
if method does not exist in the model, do nothing |
|
|
""" |
|
|
""" |
|
|
m = req.session.model(model) |
|
|
m = req.session.model(model) |
|
|
if hasattr(m, 'check_warning_on_save'): |
|
|
|
|
|
|
|
|
try: |
|
|
return getattr(m, 'check_warning_on_save')(id, req.context) |
|
|
return getattr(m, 'check_warning_on_save')(id, req.context) |
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
|
except xmlrpclib.Fault as e: |
|
|
|
|
|
if 'AttributeError' in e.faultString: |
|
|
return False |
|
|
return False |
|
|
|
|
|
else: |
|
|
|
|
|
raise openerp.osv.osv.except_osv('Error', e.faultCode) |
|
|
|
|
|
|