Purchase Module Development Guidelines¶
The Purchase Module is a key part of the OpenRxERP system. This module allows users to manage and record all purchase transactions from suppliers, including details like invoice number, purchase date, item details, and prices. The module needs to be developed using Django, following the guidelines below.
Overview¶
When a purchase is made, the user will:
- Select a supplier from the existing database.
- The Supplier GSTIN (Goods and Services Tax Identification Number) of the selected supplier will auto-populate.
- Enter the Invoice Number and Invoice Date.
- Choose the Purchase Type whether it is 'Cash' or 'Credit' in this dropdown.
- Add items one by one, providing details such as:
- Item Name
- MRP (Maximum Retail Price)
- Quantity
- Free Quantity (if applicable)
- Batch Number
- Expiry Date
- Purchase Rate
- Discount (if applicable)
-
GST (auto-populates from the Item model)
-
The form will have an Add Item button to add multiple items to the purchase entry.
- On clicking Submit, all details will be saved to the database.
Key Requirements¶
- Auto-populate Previous Purchase Data: If an item has been purchased in the past, its last purchase rate and MRP should automatically populate when the item is selected.
- Auto-populate GST Value: When an item is selected, its GST percentage value should also auto-populate from the Item model.
- Django Form: The Django form for purchase entry has already been created (as shown in the attached screenshot). Contributors need to implement the backend logic to handle form submission, validation, and data storage.
Steps to Develop the Purchase Module¶
1. Backend Development¶
- Implement the view to handle the purchase entry form submission.
- Develop a function to fetch and display the Supplier GSTIN based on the selected supplier.
- Create a mechanism to auto-populate:
- The last purchase rate and MRP of an item if it has been purchased before.
- The GST percentage of the selected item from the Item model.
- Handle all form data validation and error handling to ensure smooth operation.
2. Database Schema¶
Ensure that the following fields are correctly set up in the database:
- Supplier Name (Foreign key referencing the Supplier model)
- Supplier GSTIN
- Invoice Number
- Invoice Date
- Purchase Type
- Item Details (Include MRP, Quantity, Batch Number, Expiry Date, Purchase Rate, Discount, GST percentage)
- Discount on Invoice
3. Frontend Integration¶
- Integrate the Django form with the frontend to handle user interactions smoothly.
- Use JavaScript or Django templates to dynamically update fields, such as:
- Auto-filling the last purchase rate and MRP when an item is selected.
- Auto-filling the GST percentage of the item from the Item model.
Expected Outcome¶
- A fully functional Purchase Module that allows users to record purchase details efficiently.
- Data consistency with correct auto-fill behavior for previously purchased items and GST percentages.
- A user-friendly interface that aligns with the existing design of OpenRxERP.
How to Contribute¶
- Clone the Repository: Fork and clone the OpenRxERP repository to your local machine.
- Create a Branch: Make a new branch for your contribution.
bash git checkout -b feature/purchase-module
- Develop the Module: Implement the backend and integrate the frontend according to the guidelines provided.
- Test Your Changes: Ensure your changes pass all tests and add new tests as needed. Submit a Pull Request: Push your branch and create a pull request to the main repository.
Additional Information
For any questions or guidance, please reach out to the project maintainer at chirag740@gmail.com. We look forward to your contribution in building a robust Purchase Module for OpenRxERP!