Upload File field

214 просмотров
Перейти к первому непрочитанному сообщению

Paul Dowd

не прочитано,
26 мар. 2014 г., 05:48:0526.03.2014
– erpnext-u...@googlegroups.com, akshay. jindal
Hi,

Is it possible to have some kind of field that a user can use to upload a specific type of file?

I want to then be able to easily access this file using the API. 

There will be multiple files uploaded to an item and we need to be able to retrieve them individually and I don't think that the attach file system will reliably work for me in this.

Thanks

Paul

Maxwell Morais

не прочитано,
26 мар. 2014 г., 08:51:0226.03.2014
– erpnext-u...@googlegroups.com

Yes, what you need is add a Upload Custom Field and a validate method for the extension of the file, eg:


function hasExtensions(filename, exts){
    return new RegExp("(" + exts.join("|").replace(/\./g, '\\.') + ')$')).test(filename);
}

cur_frm.my_field_custom(doc, cdt, cdn){
    if (!doc.my_field && !hasExtensions(doc.my_field, [".pdf", ".doc", ".docx"]){
        doc.my_field = undefined;
        cur_frm.refresh_fields();
        wn.msgprint(wn._("Wrong File type"));
}
}

Adapted from: http://stackoverflow.com/questions/4234589/validation-of-file-extension-before-uploading-file



--
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-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/d3e1be09-3289-4932-9fbd-cacb9ed5fb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3

Paul Dowd

не прочитано,
30 мар. 2014 г., 19:33:5130.03.2014
– erpnext-u...@googlegroups.com
thanks Maxwell, but I'm not sure how to "add a Upload Custom Field" since this isn't one of the field-type options.

Should I be adding a new script or is there a way to add a new Custom Field type?

On Thursday, 27 March 2014 01:51:02 UTC+13, Maxwell wrote:

Yes, what you need is add a Upload Custom Field and a validate method for the extension of the file, eg:


function hasExtensions(filename, exts){
    return new RegExp("(" + exts.join("|").replace(/\./g, '\\.') + ')$')).test(filename);
}

cur_frm.my_field_custom(doc, cdt, cdn){
    if (!doc.my_field && !hasExtensions(doc.my_field, [".pdf", ".doc", ".docx"]){
        doc.my_field = undefined;
        cur_frm.refresh_fields();
        wn.msgprint(wn._("Wrong File type"));
}
}

Adapted from: http://stackoverflow.com/questions/4234589/validation-of-file-extension-before-uploading-file

2014-03-26 6:48 GMT-03:00 Paul Dowd <pd...@myzealand.com>:
Hi,

Is it possible to have some kind of field that a user can use to upload a specific type of file?

I want to then be able to easily access this file using the API. 

There will be multiple files uploaded to an item and we need to be able to retrieve them individually and I don't think that the attach file system will reliably work for me in this.

Thanks

Paul

--
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+unsub...@googlegroups.com.

Maxwell Morais

не прочитано,
31 мар. 2014 г., 07:14:1131.03.2014
– erpnext-u...@googlegroups.com
The type of the Custom Field are Upload!

Do you know what your version of ERPNext?

If it is a version less than 3.x the type are "Selecet" and in options you fill "Image"


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a1b5041e-f68b-4530-b901-fd9e1e0d7931%40googlegroups.com.

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

Paul Dowd

не прочитано,
2 апр. 2014 г., 18:59:1202.04.2014
– erpnext-u...@googlegroups.com
Hi Maxwell,

It is v3.7.1

I've tried changing the custom field to:
Field Type = Select
Options = Image

All it gives me is a drop down select box where I can select "Image"... which is what I expected it would do. 

Am I missing that field option? Upload isn't an option in the Field Type menu. 

Thanks

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



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3

--
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+unsub...@googlegroups.com.

Maxwell Morais

не прочитано,
2 апр. 2014 г., 21:06:3902.04.2014
– erpnext-u...@googlegroups.com
you have a fieldtype named Upload?


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/2839694f-66c3-43f2-b40a-6c7719881f98%40googlegroups.com.

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

Paul Dowd

не прочитано,
2 апр. 2014 г., 21:12:1002.04.2014
– erpnext-u...@googlegroups.com
nope, it also isn't specified here: http://erpnext.org/doctype-fields

Paul Dowd
Managing Director



--
You received this message because you are subscribed to a topic in the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-user-forum/PxTzy9_7Lg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CABK1YkM8TA9JNPNwuZrej%3DP1TFYXmqhMBD0PgVHix_poXZR_fg%40mail.gmail.com.

Maxwell Morais

не прочитано,
2 апр. 2014 г., 21:25:3502.04.2014
– erpnext-u...@googlegroups.com

Paul sorry, the correct option for the field are attach_files:
To check this, goto Setup > Personalize Form > Edit

Select the doctype Item and look the field Image




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

Paul Dowd

не прочитано,
2 апр. 2014 г., 21:49:1802.04.2014
– erpnext-user-forum
are you referring to the "Customize Form" / "Allow Attach" tickbox??

This solution is what I'm trying to get away from!! :) 

I need to upload multiple files to the Batch doc-type because we have to record multiple PDFs of different government inspections and certifications. We then needs to retrieve those inspections through the API automatically, so we need to be able to reliably reference them. 

Any assistance in figuring out this issue would be awesome.

Thanks

Paul

Paul Dowd
Managing Director



Maxwell Morais

не прочитано,
2 апр. 2014 г., 22:05:5202.04.2014
– erpnext-u...@googlegroups.com
I'm refer​ring how configure a Upload Field in system (see the atachment)







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

Paul Dowd

не прочитано,
3 апр. 2014 г., 20:35:4203.04.2014
– erpnext-u...@googlegroups.com, akshay. jindal
fantastic, thanks Maxwell.

To clarify what I've done for others, to create a upload file field you do the following:

1. Create new Custom Field and enter your name/label. 
2. Use: Field Type = Select
3. Use: Options = "attach_files:"

wa...@xavierltd.com

не прочитано,
4 апр. 2014 г., 09:04:0404.04.2014
– erpnext-u...@googlegroups.com
‎Hi team,

Is there any way to add attachments to emails being sent from ERPNext? For example, after submitting a Sales Invoice, there's an email dialog box that comes ‎up right after. The issue however is that some of us need to attach other documents along with an invoice before it is sent to the customer. 

Any solution? 


Kind regards,

Umair Sayyed

не прочитано,
4 апр. 2014 г., 09:43:0004.04.2014
– ERPNext User's Forum
Hello Wale,

You should first attach files in Invoice to be sent as an attachment. The attached files will be available for selection at the bottom of email dialog box.




--
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-fo...@googlegroups.com.

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



--
Thanks and Regards,
Umair Sayyed
www.erpnext.com

wa...@xavierltd.com

не прочитано,
4 апр. 2014 г., 10:10:1804.04.2014
– ERPNext User's Forum
Wow... Great! Thanks Umair 


Kind regards,
Wale
From: Umair Sayyed
Sent: Friday, April 4, 2014 2:43 PM
To: ERPNext User's Forum
Subject: Re: [erpnext-user-forum] Attachments in Email

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений