Advertisement
sguptajpr

attach image to items in sales order

May 1st, 2014
341
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. cur_frm.cscript.attach_image = function(doc, dt, dn) {
  7.     if(!doc.image) {
  8.         msgprint(wn._('Please select an "Image" first'));
  9.         return;
  10.     }
  11.  
  12.     doc.ref_image = repl('<table style="width: 100%; table-layout: fixed;">'+
  13.     '<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td></tr>'+
  14.     '</table>', {imgurl: wn.utils.get_file_link(!doc.image)});
  15.  
  16.     refresh_field('ref_image');
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement