Vishmita Jadeja (openerp) has proposed merging
lp:~openerp-dev/openerp-web/trunk-opw-581041-vja into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-opw-581041-vja/+merge/136372
Hello,
Fixed the issue of raised exception not displayed in trunk when adding
attachment to object if create of ir.attachment raises exception.
To reproduce :-
For the purpose of the test, do the following :
In 'server/openerp/addons/base/ir/ir_attachment.py' add
the following line as first line in method create (line 115):
raise osv.except_osv("ValueError", "We cannot save your file for some reason.")
- go to Customers (or any other object)
- add an attachment on the new created
partner by clicking "Add" button from Attachments.
Expected :- It should display the warning message.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-opw-581041-vja/+merge/136372
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-opw-581041-vja.
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2012-11-26 08:43:39 +0000
+++ addons/web/controllers/main.py 2012-11-27 11:30:33 +0000
@@ -1617,8 +1617,8 @@
'filename': ufile.filename,
'id': attachment_id
}
- except Exception, e:
- args = { 'error': e.message }
+ except Exception,e:
+ args = {'erorr':e.faultCode.split('--')[1],'title':e.faultCode.split('--')[0]}
return out % (simplejson.dumps(callback), simplejson.dumps(args))
class Action(openerpweb.Controller):
=== modified file 'addons/web/static/src/js/views.js'
--- addons/web/static/src/js/views.js 2012-11-22 09:43:47 +0000
+++ addons/web/static/src/js/views.js 2012-11-27 11:30:33 +0000
@@ -978,11 +978,7 @@
this.fileupload_id = _.uniqueId('oe_fileupload');
$(window).on(this.fileupload_id, function() {
var args = [].slice.call(arguments).slice(1);
- if (args[0] && args[0].error) {
- alert(args[0].error);
- } else {
- self.do_attachement_update(self.dataset, self.model_id);
- }
+ self.do_attachement_update(self.dataset, self.model_id,args);
instance.web.unblockUI();
});
},
@@ -1092,9 +1088,21 @@
});
});
},
- do_attachement_update: function(dataset, model_id) {
+ do_attachement_update: function(dataset, model_id,args) {
+ var self = this;
this.dataset = dataset;
this.model_id = model_id;
+ if (args && args[0]["erorr"]) {
+ instance.web.dialog($('<div>'),{
+ modal: true,
+ title: "OpenERP " + _.str.capitalize(args[0]["title"]),
+ buttons: [{
+ text: _t("Ok"),
+ click: function(){
+ $(this).dialog("close");
+ }}]
+ }).html(args[0]["erorr"]);
+ }
if (!model_id) {
this.on_attachments_loaded([]);
} else {
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp