customize actions (buttons) for managing submitted documents e.g s.o.

185 views
Skip to first unread message

Sören H. Biere

unread,
Apr 19, 2013, 1:02:59 PM4/19/13
to erpnext-dev...@googlegroups.com
Hi,
 
I'm currently eveluating erpnext and at first i want to say i'm very enthused by this great erp.
The configuration seems to me much faster and 'straight forward' then in a lot of other systems.
 
Now there are some actions on top of a documents detailview i don't know how they're meant to be customized.
For example on an submitted sales order i'm abled to trigger following actions:
Print View/Cancel/Send SMS/Make Delivery/Make Material anfordern/Make Invoice/Stop!
 
 - how should i translate them
 - on some, like submit, permissions seem to be applied but how do i remove/add this actions in general?
 
What may i have missed?
 
Kind regards from Germany,
Sören

Rushabh Mehta

unread,
Apr 20, 2013, 2:03:55 AM4/20/13
to erpnext-dev...@googlegroups.com
Hi Soren,

Welcome to the forum :) and thanks for your encouragement.

Those actions are a part of the system and are not configurable. You can also setup workflows using Setup > Workflow.

Here is the link to a slightly oldish video - but you should get the idea.


best,
Rushabh





--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/1n1BtvOdB-AJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta

Sören H. Biere

unread,
Apr 20, 2013, 4:20:06 AM4/20/13
to erpnext-dev...@googlegroups.com
Ah ok, i see how to extend with the fsm's.
Thanks!

On Saturday, April 20, 2013 8:03:55 AM UTC+2, rushabh wrote:
Hi Soren,

Welcome to the forum :) and thanks for your encouragement.

Those actions are a part of the system and are not configurable. You can also setup workflows using Setup > Workflow.

Here is the link to a slightly oldish video - but you should get the idea.


best,
Rushabh



On Fri, Apr 19, 2013 at 10:32 PM, Sören H. Biere <Kon...@shb-technologie.de> wrote:
Hi,
 
I'm currently eveluating erpnext and at first i want to say i'm very enthused by this great erp.
The configuration seems to me much faster and 'straight forward' then in a lot of other systems.
 
Now there are some actions on top of a documents detailview i don't know how they're meant to be customized.
For example on an submitted sales order i'm abled to trigger following actions:
Print View/Cancel/Send SMS/Make Delivery/Make Material anfordern/Make Invoice/Stop!
 
 - how should i translate them
 - on some, like submit, permissions seem to be applied but how do i remove/add this actions in general?
 
What may i have missed?
 
Kind regards from Germany,
Sören

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/1n1BtvOdB-AJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Sören H. Biere

unread,
Apr 21, 2013, 7:00:46 AM4/21/13
to erpnext-dev...@googlegroups.com
Hi,
 
ist there any reason against customizing existing doktypes by overwriting with custom script. E.g. adding
 
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
    cur_frm.clear_custom_buttons();
 if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);

 if(doc.docstatus == 1 && doc.status!='Order Lost') {
  cur_frm.add_custom_button('in Bestellung umwandeln', cur_frm.cscript['Make Sales Order']);
  cur_frm.add_custom_button('Auftrag verloren', cur_frm.cscript['Declare Order Lost']);
 }
 
...
 
to the quotation's  custom script.?
 
regards,
Sören

Anand Doshi

unread,
Apr 21, 2013, 7:23:15 AM4/21/13
to erpnext-dev...@googlegroups.com
put such a script in:

cur_frm.cscript.custom_refresh = function(doc, cdt, cdn) {
 if(doc.docstatus == 1 && doc.status!='Order Lost') {
  cur_frm.add_custom_button('in Bestellung umwandeln', cur_frm.cscript['Make Sales Order']);
  cur_frm.add_custom_button('Auftrag verloren', cur_frm.cscript['Declare Order Lost']);
 }
}

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Sören H. Biere

unread,
Apr 22, 2013, 5:15:02 AM4/22/13
to erpnext-dev...@googlegroups.com
Thanks,
 
could you also give me hint why /public/js/all-app.min.js isn't translated?
I played a little with the translate.py so the messaged get exported and can be build in the message files
but aren't respected when the app is displayed.
 
For the moment i can't make real contributions but does it make sense to fork and add the possibility to translate where its's still missing?
To give you the pull-request afterwards?
 
regards Sören

Anand Doshi

unread,
Apr 22, 2013, 6:05:42 AM4/22/13
to erpnext-dev...@googlegroups.com
Hi Soren,

Translation happens at runtime.

For translation, we need to wrap message strings in wn._("message") for javascript and webnotes._("""message""") for python code.

The translate code parses such files and extracts messages which are wrapper within wn._() and webnotes._(). And makes it available for translation.

Only those message enclosed within these underscore methods (wn._ and webnotes._) invoke translation.

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

Sören H. Biere

unread,
Apr 22, 2013, 6:22:35 AM4/22/13
to erpnext-dev...@googlegroups.com
Hi Anand,
 
for example in my /public/js/all-app.min.js it says "var appframe=this.print_wrapper.appframe;appframe.add_button(wn._("View Details"),"
but at first the View Details wasn't even in the message-export.
 
Then i added the path public/js manually to the translate.py and got about
25 new records in my export.
 
But when i Import this translations again they aren't used for replacement.
 
Where might i take a look at?`
 
 
Thanks!
Sören
 

On Monday, April 22, 2013 12:05:42 PM UTC+2, Anand Doshi wrote:
Hi Soren,

Translation happens at runtime.

For translation, we need to wrap message strings in wn._("message") for javascript and webnotes._("""message""") for python code.

The translate code parses such files and extracts messages which are wrapper within wn._() and webnotes._(). And makes it available for translation.

Only those message enclosed within these underscore methods (wn._ and webnotes._) invoke translation.

Thanks,
Anand.
On 22-Apr-2013, at 2:45 PM, Sören H. Biere <Kon...@SHB-Technologie.de> wrote:

Thanks,
 
could you also give me hint why /public/js/all-app.min.js isn't translated?
I played a little with the translate.py so the messaged get exported and can be build in the message files
but aren't respected when the app is displayed.
 
For the moment i can't make real contributions but does it make sense to fork and add the possibility to translate where its's still missing?
To give you the pull-request afterwards?
 
regards Sören

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

unread,
Apr 22, 2013, 6:27:41 AM4/22/13
to erpnext-dev...@googlegroups.com
Hi,

You will need to run lib/wnf.py --build

This builds the minified js files which are used in the app.

If you plan to make a lot of changes incrementally, you can use watch to build js files:
lib/wnf.py -w

You will need to go to Tools > Clear Cache & Refresh after such changes.

Thanks,
Anand.

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

To post to this group, send email to erpnext-dev...@googlegroups.com.

Sören H. Biere

unread,
Apr 22, 2013, 8:21:43 AM4/22/13
to erpnext-dev...@googlegroups.com
I'm really sorry für stealing your time but i don't see it.
I sum up: in my freshly build all-app.min.js i have wrapped text like wn._("View Details").
Now i'm expecting the Translation-function to cache  and replace View Details with its translation but it doesn't although it obviously does anywhere else but all-app.min.js.
 
Thanks Sören

Rushabh Mehta

unread,
Apr 22, 2013, 8:28:32 AM4/22/13
to erpnext-dev...@googlegroups.com
Soren,

It does not replace in the code, but all the app translatable texts are loaded during the application "boot" process (server.py?cmd=startup)

Also see "load_translations" method in "lib/webnotes/boot.py" for more idea.

Translations for DocTypes are loaded with the doctype in the "wn.model.with_doctype" method.

This is then appended to wn.translations and then the _ method replaces as required.

Hope this helps

best,
Rushabh



--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

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



--



Twitter: @rushabh_mehta

Sören H. Biere

unread,
Apr 22, 2013, 8:54:29 AM4/22/13
to erpnext-dev...@googlegroups.com
THANKS!,
now I've got it, what are you thinking about adding bootinfo["__messages"].update(get_lang_data('../public/js', None, "js"))
on line 111 in boot.py?

On Monday, April 22, 2013 2:28:32 PM UTC+2, rushabh wrote:
Soren,

It does not replace in the code, but all the app translatable texts are loaded during the application "boot" process (server.py?cmd=startup)

Also see "load_translations" method in "lib/webnotes/boot.py" for more idea.

Translations for DocTypes are loaded with the doctype in the "wn.model.with_doctype" method.

This is then appended to wn.translations and then the _ method replaces as required.

Hope this helps

best,
Rushabh

On Mon, Apr 22, 2013 at 5:51 PM, Sören H. Biere <Kon...@shb-technologie.de> wrote:
I'm really sorry für stealing your time but i don't see it.
I sum up: in my freshly build all-app.min.js i have wrapped text like wn._("View Details").
Now i'm expecting the Translation-function to cache  and replace View Details with its translation but it doesn't although it obviously does anywhere else but all-app.min.js.
 
Thanks Sören

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/zssgET3Hx5sJ.

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

Rushabh Mehta

unread,
Apr 22, 2013, 9:00:57 AM4/22/13
to erpnext-dev...@googlegroups.com
You need a "locale" folder to include translations.

Is there something specific you are stuck with?


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

To post to this group, send email to erpnext-dev...@googlegroups.com.

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

Sören H. Biere

unread,
Apr 22, 2013, 9:13:06 AM4/22/13
to erpnext-dev...@googlegroups.com
Sorry have been a little fast, maybe only works through my previouly mods, will try this on new Installation soon.
The Problem was the translation default buttons from from or formheader. The locale-folders were always present.
I will try to examine why the Translation for form and form headers didn't work out from the start as it did anywhere else.

Sören H. Biere

unread,
Apr 22, 2013, 9:40:47 AM4/22/13
to erpnext-dev...@googlegroups.com
Ok i have checked again and maybe i'm totally messing up what should happen but in my experience the stuff from all-app.min.js only translates if:
 
- i add 'build_for_framework('public/js', 'js', with_doctype_names=True)' to translate.py line 54
- and add 'bootinfo["__messages"].update(get_lang_data('../public/js', None, "js"))' to boot.py line 111
 
and naturally add my translations in between:
root@erp:~/erpnext# lib/wnf.py --build_message_files de
root@erp:~/erpnext# lib/wnf.py --export_messages de ~/neu_de.csv
vim ~/neu_de.csv
root@erp:~/erpnext# lib/wnf.py --import_messages de ~/neu_de.csv
root@erp:~/erpnext# lib/wnf.py --build_message_files de
 
Thanks, Sören

Sören H. Biere

unread,
Apr 22, 2013, 10:17:15 AM4/22/13
to erpnext-dev...@googlegroups.com
Here's my de.csv attached. Maybe you want to update the translation in the git-repo.
 

neu_de.csv

Rushabh Mehta

unread,
Apr 22, 2013, 11:19:03 AM4/22/13
to erpnext-dev...@googlegroups.com
Soren,

The translations are unfortunately not always updated. Will try and update them soon.

best,
Rushabh


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages