Image field in sales order item

Dear All,

Is it possible that a custom image field be created in Sales Order Item for which we can add an image while creating Sales Order?

This would be useful where the products are engineer to order and a generic item has been created. At the time of finalization of order we could attach the image file just for reference. This particular image may not be useful for any further orders and remains specific to the Sales Order only.

Regards
Satish



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bfc37fd6-a0ff-484e-826b-44b087410aa8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



2014-04-03 2:10 GMT-03:00 Satish <sa...@gmail.com>:
Dear All,

Is it possible that a custom image field be created in Sales Order Item for which we can add an image while creating Sales Order?

This would be useful where the products are engineer to order and a generic item has been created. At the time of finalization of order we could attach the image file just for reference. This particular image may not be useful for any further orders and remains specific to the Sales Order only.

Regards
Satish



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bfc37fd6-a0ff-484e-826b-44b087410aa8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.






Best Regards.

Maxwell Morais

Python Developer powered by Webnotes framework <3
+55 11 954329659




You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkOnG0fSy7YWQCNCKGDv9ccxvsLr0OPURn_NyVVUNhETSg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Thanks Maxwell.
It is a nice way to attach files.

However, I would like that the attached images show in the list as the Item images are shown in sales order.
For that I suppose I would need to generate an HTML description similar to the one generated in Item Master.

Could you guide me to achieve that?

Regards
Satish


On Thursday, 3 April 2014 17:00:39 UTC+5:30, Maxwell wrote:


2014-04-03 2:10 GMT-03:00 Satish <sa...@gmail.com>:
Dear All,

Is it possible that a custom image field be created in Sales Order Item for which we can add an image while creating Sales Order?

This would be useful where the products are engineer to order and a generic item has been created. At the time of finalization of order we could attach the image file just for reference. This particular image may not be useful for any further orders and remains specific to the Sales Order only.

Regards
Satish



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bfc37fd6-a0ff-484e-826b-44b087410aa8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.






Best Regards.

Maxwell Morais

Python Developer powered by Webnotes framework <3
+55 11 954329659




You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/ce9d5e3e-7963-4b5c-82f0-51979afc4225%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Update!

I created a new field with field type "small text" .
Then went to the sales order and manually typed  <img src="files/name.jpg" width="100px">  and voila, I could see the image right there.
So now I just need to find a way to generate the HTML code automatically which can show the uploaded file.

Would be great if you could help out.

Regards
Satish



On Friday, 4 April 2014 11:09:01 UTC+5:30, Satish wrote:
Thanks Maxwell.
It is a nice way to attach files.

However, I would like that the attached images show in the list as the Item images are shown in sales order.
For that I suppose I would need to generate an HTML description similar to the one generated in Item Master.

Could you guide me to achieve that?

Regards
Satish


On Thursday, 3 April 2014 17:00:39 UTC+5:30, Maxwell wrote:


2014-04-03 2:10 GMT-03:00 Satish <sa...@gmail.com>:
Dear All,

Is it possible that a custom image field be created in Sales Order Item for which we can add an image while creating Sales Order?

This would be useful where the products are engineer to order and a generic item has been created. At the time of finalization of order we could attach the image file just for reference. This particular image may not be useful for any further orders and remains specific to the Sales Order only.

Regards
Satish



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bfc37fd6-a0ff-484e-826b-44b087410aa8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.






Best Regards.

Maxwell Morais

Python Developer powered by Webnotes framework <3
+55 11 954329659




You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/0843d380-48bd-41ad-a0f4-fce64a4027d4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You can easily write a custom script for that!


On Friday, April 4, 2014 11:24:48 AM UTC+5:30, Satish wrote:
Update!

I created a new field with field type "small text" .
Then went to the sales order and manually typed  <img src="files/name.jpg" width="100px">  and voila, I could see the image right there.
So now I just need to find a way to generate the HTML code automatically which can show the uploaded file.

Would be great if you could help out.

Regards
Satish





You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/7f7bd309-79a3-46a7-8812-8c37dfd09796%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Well that's the problem.
I don't have any technical background and have absolutely no idea about writing scripts.

However, I think I found the script being used in Item Master for generating HTML description:


// for description from attachment
// takes the first attachment and creates
// a table with both image and attachment in HTML
// in the "alternate_description" field
cur_frm.cscript.add_image = function(doc, dt, dn) {
if(!doc.image) {
msgprint(wn._('Please select an "Image" first'));
return;
}

doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">'+
'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
'<td>%(desc)s</td></tr>'+
'</table>', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description});

refresh_field('description_html');
}


Do you think this would work for me, with some changes?


Regards
Satish


On Friday, 4 April 2014 14:51:48 UTC+5:30, Rushabh Mehta wrote:
You can easily write a custom script for that!


On Friday, April 4, 2014 11:24:48 AM UTC+5:30, Satish wrote:
Update!

I created a new field with field type "small text" .
Then went to the sales order and manually typed  <img src="files/name.jpg" width="100px">  and voila, I could see the image right there.
So now I just need to find a way to generate the HTML code automatically which can show the uploaded file.

Would be great if you could help out.

Regards
Satish





You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/58404cb1-2512-4772-9462-d5268cf9ab25%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I have created 3 custom fields in doctype  "Sales Order Item"

1.   image          option: attach_files:       Field type: Select
2.  ref_image                                         Field type: Small Text
3. attach_image                                    Field type: Button


and I have the following custom script



cur_frm.cscript.attach_image = function(doc, dt, dn) {
if(!doc.image) {
msgprint(wn._('Please select an "Image" first'));
return;
}

doc.ref_image = repl('<table style="width: 100%; table-layout: fixed;">'+
'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
'</table>', {imgurl: wn.utils.get_file_link(doc.image)});

refresh_field('ref_image');
}




The script is not working. When I click the button nothing happens.
I suspect something is wrong with the script. 
I must mention that I have no idea about writing scripts but I have tried using the script of similar function being used elsewhere in erpnext.
What I am trying to achieve could be understood by reading previous post in this thread.
Could someone please point out the mistake in the script? I somehow feel that it would work with little correction.

Regards
Satish




On Friday, 4 April 2014 17:38:32 UTC+5:30, Satish wrote:
Well that's the problem.
I don't have any technical background and have absolutely no idea about writing scripts.

However, I think I found the script being used in Item Master for generating HTML description:


// for description from attachment
// takes the first attachment and creates
// a table with both image and attachment in HTML
// in the "alternate_description" field
cur_frm.cscript.add_image = function(doc, dt, dn) {
if(!doc.image) {
msgprint(wn._('Please select an "Image" first'));
return;
}

doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">'+
'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
'<td>%(desc)s</td></tr>'+
'</table>', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description});

refresh_field('description_html');
}


Do you think this would work for me, with some changes?


Regards
Satish


On Friday, 4 April 2014 14:51:48 UTC+5:30, Rushabh Mehta wrote:
You can easily write a custom script for that!


On Friday, April 4, 2014 11:24:48 AM UTC+5:30, Satish wrote:
Update!

I created a new field with field type "small text" .
Then went to the sales order and manually typed  <img src="files/name.jpg" width="100px">  and voila, I could see the image right there.
So now I just need to find a way to generate the HTML code automatically which can show the uploaded file.

Would be great if you could help out.

Regards
Satish





You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/8bd93575-5ac6-4813-a66f-235f215fbd7b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.