The Zendrian Flectra Product Inactivity Archiver is a Python-based tool designed to help businesses manage their product catalog in Flectra (a fork of Odoo 11). The primary goal is to identify and archive products that have shown no significant activity over a specified period. By archiving inactive products, businesses can keep their product listings clutter-free and up-to-date, improving both customer experience and inventory management.
-
Authentication and Connection 🔒
- The app authenticates and connects to the Flectra server using credentials securely stored in a
.env
file. - Custom XML-RPC transport with connection timeout handling.
- The app authenticates and connects to the Flectra server using credentials securely stored in a
-
Product Inactivity Check 🕵️♂️
- Retrieves a list of active products from the Flectra server.
- For each product, checks if it has had any sales or purchase orders in the last two years.
- Confirms if the product was created at least one year ago.
- Ensures the product has no stock available in internal locations.
-
Reordering Rules Management 🔄
- Identifies and archives any active reordering rules associated with the product before archiving the product itself.
- Outputs IDs for reordering rules found to facilitate debugging and verification.
-
Archiving Products 🗃️
- Archives products meeting the inactivity criteria by marking them as inactive in the database.
-
CSV Report Generation 📊
- Generates a CSV report of products that meet the inactivity criteria, listing product names and default codes.
- Saves the report to a file named
products_with_no_recent_activity.csv
.
-
Graceful Termination ✋
- Handles termination signals (
SIGINT
andSIGTERM
) to save progress before exiting gracefully. - Ensures that no data is lost during unexpected interruptions.
- Handles termination signals (
-
Run the Script:
- The script authenticates with the Flectra server and retrieves a list of active products.
-
Check Each Product:
- For each product, the script checks for recent sales and purchase activities, creation date, and stock availability.
-
Manage Reordering Rules:
- If a product meets the inactivity criteria, the script identifies and archives any associated reordering rules.
-
Archive the Product:
- The product is archived in the Flectra database by marking it as inactive.
-
Generate Report:
- A CSV report of archived products is generated and saved for review.
- The script provides detailed console output for debugging purposes, including the IDs of reordering rules found and any issues encountered during archiving.
- Python 3.x
- Flectra 1.7 (forked from Odoo 11)
python-dotenv
library for loading credentials from the.env
file.
-
Clone the Repository:
git clone https://github.com/ZenDevMaster/zendrian_flectra_tools.git
-
Install Dependencies:
pip install -r requirements.txt
-
Create a
.env
file:URL=https://flectra.domain DB=*** FLECTRA_USERNAME=*** FLECTRA_PASSWORD=***
-
Run the Script:
python unsold_products.py
The Zendrian Flectra Product Inactivity Archiver is an essential tool for businesses using Flectra, helping them maintain a clean and efficient product catalog by automatically archiving inactive products and generating insightful reports.