django_webapps_fullstack.dashboard.forms

This module provides the core business functionality forms for managing personal belongings through the dingx logistics platform. It enables users to track, organize, and manage physical objects across different locations (storage, home, disposal, transfer) with visual product management and comprehensive user profile administration.

Business Context:

The dashboard app is the central hub of the dingx platform where users interact with their registered objects (products). The system tracks physical belongings across four main locations:

  • Storage: Items kept in long-term storage facilities

  • Home: Items currently at the user’s residence

  • Disposal: Items marked for disposal or donation

  • Transfer: Items currently in transit between locations

Users can visualize their inventory with product images from multiple perspectives (front, right, back, left), organize items through drag-and-drop functionality, and manage order baskets for logistics operations.

Key Business Processes:

  1. Product Overview & Management:

  • OverviewForm: Visual dashboard showing all user products with filtering by location
    • Product cards with images, descriptions, and location badges

    • Color-coded system for quick location identification

    • Drag-and-drop interface for organizing products into baskets

    • Real-time product count by location

    • Caching mechanism for performance optimization

  1. Product Editing:

  • Edit_ObjectForm: Update product names and descriptions
    • View multi-perspective product images

    • Manage product attributes (volume, weight, location)

    • Cache invalidation after updates to ensure data consistency

  1. Basket Management:

  • BasketForm: Create transfer orders by selecting products
    • Organize logistics operations through basket system

    • Support for bulk product selection and movement

  1. User Profile Management:

  • Account_ProfileForm: Complete profile editing (name, contact, language preferences)
    • Multi-language support with dynamic title selection

    • Real-time validation against Odoo database

    • Phone number formatting with international support

  1. Address Management:

  • Delivery_AddressForm: Manage delivery address details

  • Invoice_AddressForm: Manage billing address information
    • Country and state selection with localization

    • Support for Swiss cantons with multi-language names

    • Integration with Odoo partner address system

Technical Features:

  • Dynamic form field generation based on user language

  • Integration with Bootstrap design system for color coding

  • Odoo XMLRPC backend synchronization

  • Django caching framework for performance

  • Multi-language support via Django i18n

  • Image handling with base64 encoding

Integration:

All forms communicate with the Odoo ERP backend via Twisted XMLRPC server, ensuring synchronized data across inventory management, order processing, and user administration systems.

Classes

Account_ProfileForm(*args, **kwargs)

Create a form for the "account_profile" template and create the corresponding functions of the form.

BasketForm(*args, **kwargs)

Create the "dashboard_basket" form.

Delivery_AddressForm(*args, **kwargs)

Create the delivery form for the "account_address" template and create the corresponding functions of the form.

Edit_ObjectForm(*args[, product])

Create the "edit_object" form.

Invoice_AddressForm(*args, **kwargs)

Create the invoice form for the "account_address" template and create the corresponding functions of the form.

OverviewForm(*args, **kwargs)

Create the "overview" form.

class django_webapps_fullstack.dashboard.forms.Account_ProfileForm(*args, **kwargs)[source]

Bases: Form

Create a form for the “account_profile” template and create the corresponding functions of the form.

base_fields = {}
clean()[source]

Validation of the entered values during the update of the user values.

declared_fields = {}
get_user_profile_values(user_id)[source]

get the profile values for a user from the Odoo system

property media

Return all media required to render the widgets on this form.

update(user_id, login, email, name, title, language, phone_number, mobile_number)[source]

Update the user profile values in the Odoo Database.

class django_webapps_fullstack.dashboard.forms.BasketForm(*args, **kwargs)[source]

Bases: Form

Create the “dashboard_basket” form. The ordered objects of the customer will be shown.

base_fields = {}
declared_fields = {}
get_ordered_products(basketPlace, BasketElements)[source]

Get the details from the ordered products including pictures and colors.

property media

Return all media required to render the widgets on this form.

class django_webapps_fullstack.dashboard.forms.Delivery_AddressForm(*args, **kwargs)[source]

Bases: Form

Create the delivery form for the “account_address” template and create the corresponding functions of the form.

base_fields = {}
clean()[source]

Validation of the entered values during the update of the user values.

declared_fields = {}
get_user_address_values(partner_id)[source]

get the address values for a user from the Odoo system

property media

Return all media required to render the widgets on this form.

update(partner_id, type, delivery_street, delivery_street_2, delivery_zip, delivery_city, delivery_state, delivery_country)[source]

Update the user address values in the Odoo Database.

class django_webapps_fullstack.dashboard.forms.Edit_ObjectForm(*args, product=None, **kwargs)[source]

Bases: Form

Create the “edit_object” form. The selected object will be shown including the pictures. Some fields of the object could be edited.

base_fields = {}
clean()[source]

Validation of the entered values when changes are made.

declared_fields = {}
get_product(product_id)[source]

Get the details for the selected product and add badgecolor to the product.

get_product_pictures(product_id)[source]

Get the pictures from all perspectives for the selected product.

property media

Return all media required to render the widgets on this form.

update(partner_id, product_id, name, description)[source]

Update the product in the Odoo Database.

class django_webapps_fullstack.dashboard.forms.Invoice_AddressForm(*args, **kwargs)[source]

Bases: Form

Create the invoice form for the “account_address” template and create the corresponding functions of the form.

base_fields = {}
clean()[source]

Validation of the entered values during the update of the user values.

declared_fields = {}
get_user_address_values(partner_id)[source]

get the address values for a user from the Odoo system

property media

Return all media required to render the widgets on this form.

update(partner_id, type, invoice_street, invoice_street_2, invoice_zip, invoice_city, invoice_state, invoice_country)[source]

Update the user address values in the Odoo Database.

class django_webapps_fullstack.dashboard.forms.OverviewForm(*args, **kwargs)[source]

Bases: Form

Create the “overview” form. All products of the user will be shown.

base_fields = {}
count_product_place(partner_id, card_place)[source]

Get the number of article belonging to the specific place.

declared_fields = {}
get_card_classes(card_place, place)[source]

Set the ‘CSS’ classes of the card places (= card_place) for a dedicated place. This is done by building dictionaries for each card place.

Explanation of the different classes:

  • “basket_enabled”: enables the ‘basket’ function for that card place,

    objects can be dragged on that place

  • “select_enabled”: enables the ‘select’ function for that card place,

    dashboard view with only objects of that the place can be selected

  • “lift”: lift up a card place,

    place is enabled for dragging objects

  • “link_enabled”: dashboard link of that place is enabled,

    dashboard view with only objects of that the place is enabled

get_header_background_color(place)[source]

Get the background color of the header corresponding to the selected place. The colors come form the section “bootstrap_colors” of the parameter file “parameter_design.ini”.

get_product_list(partner_id, place)[source]

Get all products from the dedicated partner including pictures. In addition the individual CSS classes will be added to products based on the place of the product.

property media

Return all media required to render the widgets on this form.