Advanced Questions in Jam-py

128 views
Skip to first unread message

Maxwell Morais

unread,
Dec 3, 2021, 6:48:20 AM12/3/21
to Jam.py Users Mailing List
Hi everyone, I expect everyone is doing well!

I'm writing because I have a set of questions I would like to ask you, about your opinion!

  1. How to handle initial data in Jam-py? [For example here in Brazil, any electronic invoice system needs to handle some standard tables that change every year, some tables are quite simple, but others have hundreds of thousands of records, like the NCM table, so, what's the best approach to deal with these datas? There's a way to flag a table as "Exportable", and it's contents will get exported on the Meta-data of the project? ]
  2. How can I get the field list of a table from sql? [I'm a lazy busy guy, and I'm building a product on top of Jam-py, for the mass, so I know really well that my customers will ask me, silly things all the time, like "how to change the color of the account to red when the balance is below 0", "how to create an purchase order automatically when the stock level reaches a minimum of 5 units?", all of these questions are important for my customers, but, will constantly remove myself from the focus of my product, that's develop an simplified solution on a complex market. So, I'm building a visual business rule engine, that I, the customer, or my support assistant, can configure these kinds of rules for the customer in seconds, instead of waiting for me, I spend time coding it for the customer! With all that explained, I would like to get a list of all fields, given the database connection, the table name I'm seeking for, I would like access to the jam-py fields, not the database columns. So, which SQL query should I run to get that? ]
  3. How can I change the report engine in Jam-py? [As part of being lazy, I need to reduce the complexity of building reports (I really love the approach of Jam-py using Libreoffice, but customers, will have problems with that), so, as an addition, I would like to work to include report-bro (https://www.reportbro.com/), (https://www.reportbro.com/demo/invoice), available, not only for me, but also, for the whole Jam-py users], so, to do that integration also, I need get the answer 2 answered, and more than that, I need to know, where is in jam-py source code, the code that generate the reports!]
  4. How can I change properties of fields and ensure they will be applied?  [Some rules I'm implementing take into consideration just turn on/off the required option of a field, or change the label, given a certain condition. I'm able to do that, but I discovered, that these changes only apply on the event "on_edit_form_shown", but I would like try it on "on_field_change", I have the code working, but, it simply doesn't apply the required * on the field, or change the label, so, I'm wondering, if an extra step is required, like, ask the field, to rerender, or use a different jam-py event. In any of these two cases, my questions still, how to ensure that?]

Here is the video, of the Business Rule engine, I'm porting from another project to Jam-py


Here is the set of screenshots of the Test Automation Tool, I'm porting from the same project, to Jam-py

sample-manual-testcase.png
dashboard.png
tc.gif
td.gif
test-result.gif



--

Best Regards.

Maxwell Morais
Python Developer powered by Frappé frameworks <3

Andrew Yushev

unread,
Dec 4, 2021, 2:07:46 PM12/4/21
to Maxwell Morais, Jam.py Users Mailing List
Hi, Maxwell

1. Metadata file contains only metadata.
I don't know if it could help but there is an on_created event that I sometimes use when I need to do some actions after metadata import.
Import and export code is located in export_metadata.py and import_metadata.py in the the jam/admin/ folder of the package.
It would be interesting to create a visual interface for export and import so exporting and importing of selected changes would be possible 

2. You can get the jam fields of the item this way:

get_fields(task.customers)
 
def get_fields(item):
    admin = item.task.app.admin
    fields = admin.sys_fields.copy(handlers=False)
    fields.set_where(owner_rec_id=item.ID)
    fields.open()
    for f in fields:
        print(f.f_field_name.value)

admin is the task of the app builder and the app builder database is the admin.sqlite

3. I think changing the report engine in Jam.py is a very non-trivial task.
The Report class  is defined in items.py
class AbstrReport(AbstractItem):
and in server_classes.py
class Report(AbstrReport, ParamReport):

4. I'll write the code to fix this.
Now you can change, for example, the required attribute this way:

    item.taxrate.required = true;
    item.edit_form.find('label.taxrate').addClass('required');

Regards,
Andrew

пт, 3 дек. 2021 г. в 14:48, Maxwell Morais <max.mor...@gmail.com>:
--
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/CABK1YkOQ8VxH5b_ihfvfZEyqOKZ8bf83c1Hap0oLPJXK85s1iQ%40mail.gmail.com.

Maxwell Morais

unread,
Dec 6, 2021, 8:46:34 AM12/6/21
to Andrew Yushev, Jam.py Users Mailing List
Thank you so much Andrew for the hints!

I'll work on these things!
Reply all
Reply to author
Forward
0 new messages