âš¡ Developing stock inventory âš¡

60 views
Skip to first unread message

Dean D. Babic

unread,
Feb 18, 2025, 1:50:15 AM2/18/25
to Jam.py Users Mailing List
Thanks to Danijel 
who is kindly updating the Northwind2 v7 application.
This is what he came about:
- check the Stock level and warn the user to raise a Purchase Order first:

This is the empty form before Quantity is entered:
Nwt_order_01.JPG

The server side log:
{'product_id': 99, 'product_name': 'Northwind Traders Chicken Soup', 'quantity_on_back_order': 0, 'quantity_purchased': 0, 'quantity_on_hand': 0, 'quantity_sold': 0, 'quantity_on_hold': 0, 'quantity_on_order': 0, 'target_level': 200}

with the message:

Nwt_order.JPG

This example demonstrates Form DETAIL on_field_changed executing the server side code:

function on_field_changed(field, lookup_item) {
    let item = field.owner;
   
    if (field.field_name ==='product_id' && lookup_item) {
        item.unit_price.value = lookup_item.standard_cost.value;
    }
   
    if (field.field_name ==='quantity') {
        if (field.value) {
            calc(item);
            item.edit_form.find('.quantity db-input').focus();
       
            let product_inv_data = item.server('check_product', [item.product_id.value]);
            console.log(product_inv_data.quantity_on_hold);
           
            if (product_inv_data.quantity_on_hold > 0) {
                calc(item);
                item.status_id.value = 1;
                item.status_id.lookup_value = 'Allocated';
                item.edit_form.find('#product_stock_info').show().text('Product is allocated with: '+ product_inv_data.quantity_on_hold + ' quantity on hold!');
            }
           
            else if (product_inv_data.quantity_on_hold === 0) {
                item.status_id.value = 5;
                item.status_id.lookup_value = 'No Stock';
                item.edit_form.find('#product_stock_info').show().append('<b>' + product_inv_data.quantity_on_hold + '</b>.<br> Product has insufficient inventory, you need to create a purchase order!');
                item.edit_form.find('#purchase_order_btn').show();
            }
        }
    }
   
    if (field.field_name === 'discount' && field.value) {
        calc(item);
    }
   
}

Cheers

Fabio Lenzarini

unread,
Feb 18, 2025, 3:14:48 AM2/18/25
to Dean D. Babic, Jam.py Users Mailing List
Very nice

thanks

--
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 visit https://groups.google.com/d/msgid/jam-py/2afeb3f8-ba08-458f-9ee2-ebab044127d3n%40googlegroups.com.

Nick Antonaccio

unread,
Feb 18, 2025, 8:55:16 AM2/18/25
to Jam.py Users Mailing List
Thank you 😎

Dean D. Babic

unread,
May 19, 2025, 12:57:13 AM5/19/25
to Jam.py Users Mailing List
Hi all, 

huge thank you to Danijel, who spent his free time on this.

The app is now running on:
https://northwind2.pythonanywhere.com/

The improvements are:
- optimised server code 
- Login Form and Reset password Form, with added Users and Roles FOR the app - the Manager Role
can approve the PO
- for New PO Submit, the email message is sent to user with the Manager Role:

northwind_traders_email_notification_jampy.PNG


- inventory list has XLS export and a filter for products Reorder!
- columns selection is nor available for ALL grids, with the XLS export (wip)
- the requirements.txt file is added to Export.
- Zebra datepicker is used

This is now quite a significant app.

Enjoy

northwind_traders_login_jampy.PNG

northwind_traders_login_reset_jampy.PNG

northwind_traders_notification_jampy.PNGnorthwind_traders_rows_export_jampy.PNG

Dean D. Babic

unread,
May 19, 2025, 9:43:07 PM5/19/25
to Jam.py Users Mailing List
Hi, 

please report some feedback here.
The app *should* install all dependencies automatically. 
If not, install dependencies manually:

pip install -r requirements.txt 

from the app folder.

As seen, there is a typo in "Reset you password here" :)
I will fix this.

Anything else?

Reply all
Reply to author
Forward
0 new messages