Advertisement
Guest User

image field in sales order

a guest
May 30th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // for image from attachment
  2. // takes the selected image and creates
  3. // a table with image in HTML
  4. // in the "ref_image" field
  5. console.log (" Custom code working fine ")
  6.  
  7. cur_frm.cscript.add_new_image = function(doc, cdt, cdn) {
  8.      var d = locals[cdt][cdn];
  9.           if(!d.new_image) {
  10.         msgprint(wn._('Please select an "Image" first'));
  11.         return;
  12.     }
  13.  
  14.     d.description = repl('<table style="width: 100%; table-layout: fixed;">'+
  15.     '<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
  16.         '<td>%(desc)s<td/><tr/>'+
  17.     '</table>', {imgurl: wn.utils.get_file_link(d.new_image), desc:d.description});
  18.  
  19.     refresh_field('d.description');
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement