Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-574709-msh into 
lp:openobject-addons/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574709-msh/+merge/107734

Hello,

Fixed the issue of pad as it not working in 6.1, currently it calls pad_get 
method of current model instead of ir.attachment, also when pad added it does 
not return anything so do_action will not do anything, hence return type: 
ir.action.act_url.

Demo :- Install Pad module and open any view and select the record or open any 
existing record, and click on Add Pad link, it will give traceback that the 
model doesn't have pad_get method.

The branch will fix this issue.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574709-msh/+merge/107734
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-574709-msh.
=== modified file 'pad/ir_attachment.py'
--- pad/ir_attachment.py	2011-12-19 16:54:40 +0000
+++ pad/ir_attachment.py	2012-05-29 08:39:20 +0000
@@ -19,7 +19,7 @@
         }
         return pad_url_template % template_vars
 
-    def pad_get(self, cr, uid, model, id):
+    def pad_get(self, cr, uid, model, id, context=None):
         attachment = self.search(cr, uid, [('res_model', '=', model), ('res_id', '=', id), ('type', '=', 'url'), ('name', '=', 'Pad')])
         if attachment:
             return self.read(cr, uid, attachment)[0]['url']
@@ -32,6 +32,6 @@
                 'name' : 'Pad',
                 'url' : url,
             })
-            return url
+            return {'type':'ir.actions.act_url','url': url}
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'pad/static/src/js/pad.js'
--- pad/static/src/js/pad.js	2011-11-10 10:21:53 +0000
+++ pad/static/src/js/pad.js	2012-05-29 08:39:20 +0000
@@ -18,7 +18,9 @@
         var self = this;
         var $padbtn = this.$element.find('button.pad');
         $padbtn.attr('disabled', 'true').find('img, span').toggle();
-        this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) {
+        dataset = new instance.web.DataSetSearch(
+                this, 'ir.attachment', this.view.dataset.get_context(),this.view.dataset.domain);
+        dataset.call_button('pad_get', [this.view.dataset.model, this.view.datarecord.id, this.view.dataset.get_context()], function(r) {
             $padbtn.hide();
             self.do_update();
             self.do_action(r.result);

_______________________________________________
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

Reply via email to