Skip to content

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:

  1. Select a supplier from the existing database.
  2. The Supplier GSTIN (Goods and Services Tax Identification Number) of the selected supplier will auto-populate.
  3. Enter the Invoice Number and Invoice Date.
  4. Choose the Purchase Type whether it is 'Cash' or 'Credit' in this dropdown.
  5. Add items one by one, providing details such as:
  6. Item Name
  7. MRP (Maximum Retail Price)
  8. Quantity
  9. Free Quantity (if applicable)
  10. Batch Number
  11. Expiry Date
  12. Purchase Rate
  13. Discount (if applicable)
  14. GST (auto-populates from the Item model)

  15. The form will have an Add Item button to add multiple items to the purchase entry.

  16. On clicking Submit, all details will be saved to the database.

Purchase Entry screen in purchase module

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

  1. Clone the Repository: Fork and clone the OpenRxERP repository to your local machine.
  2. Create a Branch: Make a new branch for your contribution. bash git checkout -b feature/purchase-module
  3. Develop the Module: Implement the backend and integrate the frontend according to the guidelines provided.
  4. 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!