My startup app

311 views
Skip to first unread message

Fabio Lenzarini

unread,
May 5, 2021, 10:37:47 AM5/5/21
to Jam.py Users Mailing List
I would like to share with you the beginning of the development of my new application.
SEM - Softup Enterprise Manager
Softup is the name of the company..

There are a few nice things...I hope.

The first is the menu created with a tree. The menu was getting crowded and the application will count (if I get to the end) more than 200 forms.. and so I thought of this.

The tree is automatically generated by reading the structure of the groups and items, so now it is identical to the menu generated by Jam.Py.

I've inserted the search function and a favorites menu, that shows the last 10 forms opened by the user, ordered by frequency of use.

Another nice thing is the possibility to translate menus, items and fields according to the user's language.

Now it should be in Italian, to switch back to English, enter 87 in the user setup filter and clear the language.
2021-05-05 16_25_22-Soft up Enterprise Manager.png

2021-05-05 16_26_05-Soft up Enterprise Manager.png

To do this I created 3 tables:
languages, items, transalted items.
In the languages table we insert the languages we want to manage.
The Item translator table is generated with a button function that scans the tree.
The table with the translations generates, for each ID and for each language, its translation.
The procedure uses the Google Translator engine to translate the texts, so most of the work is done automatically.

You can download the sources from 

and the test DB

Let me know what you think.

Ah, I forgot, if you close the form with the tree menu, it opens the classic menu of Jam.py

ciao
Fabio

Fabio Lenzarini

unread,
May 5, 2021, 2:44:34 PM5/5/21
to Jam.py Users Mailing List
I've forgotten..
The user ID is Fabio PWD Fabio
Fior the builder, semadmin, semadmin

Danijel Kaurin

unread,
May 5, 2021, 3:11:42 PM5/5/21
to Jam.py Users Mailing List
Hi Fabio.

Thak you for sharing your project. Link http://www.softup.it/download/seq.sqlite show error:

HTTP Error 404.0 - Not FoundThe resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Regards

Fabio Lenzarini

unread,
May 5, 2021, 3:32:58 PM5/5/21
to Danijel Kaurin, Jam.py Users Mailing List
Sorry, sem.sqlite 

--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/uvP9xNWK4yE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/b41cef10-f3fb-41ed-975d-9b095b0d8895n%40googlegroups.com.

Drazen D. Babic

unread,
May 5, 2021, 10:12:16 PM5/5/21
to Jam.py Users Mailing List
Hi, thanks for sharing. Looks good, congrats! I think sem.sqlite does not exist for download.
What I would looove to read, and probably interesting for others is about the learning curve and the obstacles on the way.

 Cheers

D.

Drazen D. Babic

unread,
May 5, 2021, 11:00:37 PM5/5/21
to Jam.py Users Mailing List
Sorry, forgotten to add, the SEM.zip is the App Export, so new jam-project is needed and after that Import. Of course, after Fabio provides the sample DB, point the App to downloaded DB file.

Re google translate, I did use it a few times, but the results are sometimes funny. For example, on Demo, genres "Rock" will be translated to, guess what, rock as in a stone formation ;) Definitely not music genre :) So simple translation is always more reliable with human intervention. The less prominent language, the worse google translation, I'm afraid.

Fabio Lenzarini

unread,
May 6, 2021, 2:50:43 AM5/6/21
to Jam.py Users Mailing List
Ok, I've just upload sem.sqlite.zip (http://www.softup.it/download/sem.sqlite.zip).

And.. yes, the automatic translate are sometimes funny.. "Journals" are translate on "riviste".. like "Magazine".
for that, the user can change the label.. for Group, Item and field.

2021-05-06 08_40_36-Soft up Enterprise Manager.png 

For the permission, every user is part of group
2021-05-06 08_44_27-Soft up Enterprise Manager.png

Every group can have different permission on the Item.

2021-05-06 08_47_48-Soft up Enterprise Manager.png

Drazen D. Babic

unread,
May 6, 2021, 2:59:37 AM5/6/21
to Jam.py Users Mailing List
Thanks, 
got the DB. Im getting issues:

Traceback (most recent call last):
  File "/home/dbabic/Downloads/SAML/saml/lib/python3.6/site-packages/jam/wsgi.py", line 387, in login
    user_info = task.on_login(task, form_data, {'ip': ip, 'session_uuid': session_uuid})
  File "SEM", line 16, in on_login
    print("Login:", task.company, task.company_lookup, task.user_language)
AttributeError: 'Task' object has no attribute 'company_lookup'

This is with Login. If I disable Safe mode, I'm getting:
"Item users - an attempt to get or set a field value in the empty dataset"

Asked Andrew to have a look...

Cheers

Fabio Lenzarini

unread,
May 6, 2021, 3:04:24 AM5/6/21
to Jam.py Users Mailing List
Sorry, try to remove this line:
2021-05-06 09_03_30-Application builder.png

Drazen D. Babic

unread,
May 6, 2021, 3:38:31 AM5/6/21
to Jam.py Users Mailing List
Yep, all good. 
Fantastic work Fabio! Very polished, even reports work as expected. I'm still getting below though:
Item company - an attempt to get or set a field value in the empty dataset

this is after created an user who has different Company and Manager role. 

So, how to use translation? Looks like language_translation table is missing.

Fabio Lenzarini

unread,
May 6, 2021, 6:47:38 AM5/6/21
to Jam.py Users Mailing List
Now there are 3 table: group, item and field_translation
2021-05-06 12_43_57-Soft up Enterprise Manager.png

Drazen D. Babic

unread,
Jun 8, 2021, 3:42:53 AM6/8/21
to Jam.py Users Mailing List
HI Fabio, 

I figured how to switch to another Language, it is settings for the User, not Admin Language settings.  It seems to work. Brilliant. Thank you.

It does look like the table needs refreshing to pickup the Language. How to have a main Menu translated though?

Also, how to add completely new language? SQL? Or the bigger question would be how to do it for a New App, and not SEM? I was waiting for this for years, btw, this is huge contribution.

Grazie mile

D.
Message has been deleted

Tony Anytime

unread,
Jun 8, 2021, 7:56:45 AM6/8/21
to Jam.py Users Mailing List
Wow, very interested in this. going to try it.

Andreas Schneider

unread,
Jun 8, 2021, 4:37:09 PM6/8/21
to Jam.py Users Mailing List
Hi Fabio

Can you explain me where the function "task.global_function.get_field_item_by_id" is definied in jam.py  (you have used this in function translate_item_fields in language_table.js)

Drazen D. Babic

unread,
Jun 9, 2021, 2:42:22 AM6/9/21
to Jam.py Users Mailing List
I can answer, it is in SEM.js:

grep -R get_field_item_by_id *

js/SEM.js: function get_field_item_by_id(item, id) {
js/SEM.js: this.get_field_item_by_id = get_field_item_by_id;
js/SEM.js: var trans_item = task.global_function.get_field_item_by_id(item, field_translation.id_field_id.value);

It is not in Jam core.

Drazen D. Babic

unread,
Jun 9, 2021, 3:40:52 AM6/9/21
to Jam.py Users Mailing List
As mentioned above, the language_translation table is missing, so the translation will not work:

ERROR - 'Task' object has no attribute 'language_translation'

Traceback (most recent call last):

Plus, this is needed:
pip install googletrans 

Fabio's turn :)

Fabio Lenzarini

unread,
Jun 9, 2021, 4:09:12 AM6/9/21
to Jam.py Users Mailing List
Hi Drazen,
my app is a prototype app.. and yes, to automatic translate you need install:

pip install -U deep_translator

https://pypi.org/project/deep-translator/


Hi Schnei:
I've created this function because I don't have found similar on Jam.py...

Drazen D. Babic

unread,
Jun 9, 2021, 4:16:00 AM6/9/21
to Jam.py Users Mailing List
Thank you Fabio

Could you provide language_translation table structure please? Only then I can test it though...

Andreas Schneider

unread,
Jun 9, 2021, 10:36:16 AM6/9/21
to Jam.py Users Mailing List
now its clear .... i search in SEM.js via /builder.html  ... and that is not same as in real filesystem!

Thank you

Drazen D. Babic

unread,
Jun 28, 2021, 3:05:00 AM6/28/21
to Jam.py Users Mailing List
Hi Fabio,

I'm still puzzled with your idea of translations. It does not work for me since the table is missing :(
Could you help us please?

Thanks

Fabio Lenzarini

unread,
Jun 28, 2021, 4:10:55 AM6/28/21
to Jam.py Users Mailing List
Hi Drazen,
sorry but my app now is not sharable because I've implemente the SQL view..

Tell me your error.

Dražen Babić

unread,
Jun 28, 2021, 5:44:42 AM6/28/21
to Jam.py Users Mailing List
Hi

As mentioned, in the App you shared, there is no translation table the Google deep_translator is using.
So translator does not work in the Server Module.

Also we do not know how to populate data for new language or New App. The new Language is added but nothing happens, there is nothing for that language anywhere.

U can write in Italian if easier for you...

Thx

--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/20f4b60a-7983-4f3d-9345-659ab0387259n%40googlegroups.com.

Fabio Lenzarini

unread,
Jun 28, 2021, 10:16:03 AM6/28/21
to Jam.py Users Mailing List
Hi Drazen

so..

create Item "language_translation" as the follow:
2021-06-28 16_14_01-Application builder.png

then update language_table.py

def translator(item, original, src, tgt, tgtid):
    translation = ''
    language_translation = item.task.language_translation.copy()
    language_translation.set_where(text = original, language = tgtid)
    language_translation.open()
    
    
    if not language_translation.record_count():
        translation = deep_translator(item, original, src, tgt)
        
        language_translation.append()
        language_translation.translation.value = translation
        language_translation.text.value = original
        language_translation.language.value = tgtid
        language_translation.apply()
        
    else:         
        if language_translation.translation.value:
            translation = language_translation.translation.value
            print(original, ' Transation found ', translation)
        else:
            translation = deep_translator(item, original, src, tgt)
            
            language_translation.append()
            language_translation.translation.value = translation
            language_translation.text.value = original
            language_translation.language.value = tgtid
            language_translation.post()
            language_translation.apply()
            
    return translation
    
def deep_translator(item, original, src, tgt):
    from deep_translator import GoogleTranslator
    translated = GoogleTranslator(source=src, target=tgt).translate(original)
    return translated


then:
2021-06-28 15_26_32-Soft up Enterprise Manager.png

Fabio Lenzarini

unread,
Jun 28, 2021, 10:17:14 AM6/28/21
to Jam.py Users Mailing List
The table is like a "cache" if I've the same label more than 1 time.

Drazen D. Babic

unread,
Jun 29, 2021, 2:27:21 AM6/29/21
to Jam.py Users Mailing List
Thanks Fabio

looks like it is working. The only thing is it is taking vary long time and because of it the Page is showing this:

Sem02.png

What I do not understand is also:
- if I add one Language, for example "ru" - and than change it to something else, like "de", the translator will still translate to "ru" for like half of the strings.

Because I could not find the reason for this, I deleted "ru" and content of SEM_FIELD_TRANSLATION, SEM_ITEM_TRANSLATION and SEM_GROUP_TRANSLATION, and zapped (as per Original SEM has this option), and "Updated item tree".

Than started translation. Took about 20 minutes. The "Group Translation" table has 59 pages (about 25 rows per page), "Item Translation" has 10 pages. This is only for 3 languages (it, fr, es).
After that I added "ru", hit "translate" and in about 6mins the Russian was there.

SEm03.png

Fantastic job! Not sure why the main menu is not picking up the translation, as well as this form (Sales Order).

Andrew, is there anything Jam can do with a long running jobs on the server side like this one? The Page is BLANK for 20 minutes or so, and if interrupted I think the server side is stopped.

Would some kind of progress bar be better? But than, do we really care when and how the Server Side finishes the job? Because there is no visibility in success just like in Demo/Mail.

Thoughts?

Fabio Lenzarini

unread,
Jun 29, 2021, 2:39:37 AM6/29/21
to Jam.py Users Mailing List
Hi Drazen
I'm glad you were able to translate your work.
The slowness is due to the fact that for each string to be translated, the google translator API is called and this takes a long time.

My developments are just experiments... as you know I work with MS Dynamics AX and this is just a hobby for now :-)

When I have decided how to manage the SQL views ... I will see whether to develop a "real" ERP.
After the translator and the menu tree and, I hope, the SQL views, the next steps will be:
add an APP table.
Each item will be attributed to an APP.
When I open the main page, I want to show a tab with all apps.
When I select an app, I open a tab with the app's menu.
In this way we can have a DB with many, many tables and create individual APPs:
Customer app, Sales APP, Vendor app, Production APP etc..
All modern applications provide this (see Lianja and many others).

ciao
Fabio

Drazen D. Babic

unread,
Jun 29, 2021, 8:02:31 AM6/29/21
to Jam.py Users Mailing List
Hi Phabio ;)
As I see it you joined Lianja in 2012 :) Huge time difference! 

Plus, as you know, they have excellent Public Relations (PR). Beautifully organised Forum. This is everything Jam does not have, I'm afraid. 
One example is that there are no sites at all about Jam. Ok, I have one, but have no visibility at all, almost zero visitors. Which could be fixed in like 30 seconds.
I can't do it though. And the time is just passing.
End of rant.

D.

Fabio Lenzarini

unread,
Jun 29, 2021, 8:34:49 AM6/29/21
to Jam.py Users Mailing List
If Andrew help me and add my view custom to jam.py... i can try to add some page to my website.. :-)

Now I've installed V6 and imported my project, so.. now I try to extend V6 for SQL View..

Drazen D. Babic

unread,
Jul 1, 2021, 12:37:11 AM7/1/21
to Jam.py Users Mailing List
Sorry, missed one thing, I did NOT translate my work at all. It is your App with an language added :)

To be fair I do not know where to even start with adding stuff for translations. I mean, I might spend hours or days with 
studying your App, but have no time. Your advice would be welcomed. 


Also, the App is actually HUGE. Just one example, if searching for "task" on Find, there are more than 80 lines only in Server Module!!!!

I would really encourage people to have a look what you actually did, for example "Export CSV File", plus "Action":
Sem04.png

Great stuff.

Just one note, Jam v112 does not create static/files folder for some reason, so "Export csv file" fails with "No such file or directory"

D.
Reply all
Reply to author
Forward
0 new messages