Go to file
2025-11-27 10:02:32 +07:00
__pycache__ first commit 2025-11-27 10:00:38 +07:00
models first commit 2025-11-27 10:00:38 +07:00
tests first commit 2025-11-27 10:00:38 +07:00
__init__.py first commit 2025-11-27 10:00:38 +07:00
__manifest__.py fix manifest file 2025-11-27 10:02:32 +07:00
README.md first commit 2025-11-27 10:00:38 +07:00

Quality Check Lot Preserve

Overview

This module modifies the standard Odoo 18 quality check behavior for receipt operations to preserve quality check states when lot numbers are assigned after quality checks have been completed.

Problem Statement

In standard Odoo, when a quality check is completed before a lot number is assigned, the quality check automatically resets to "Todo" state when the lot number is later assigned. This creates inefficiency in warehouse operations where:

  1. Quality checks are performed immediately upon receipt
  2. Lot numbers are generated or assigned later in the process
  3. Quality checks must be re-done unnecessarily

Solution

This module provides the following functionality:

1. State Preservation

  • Quality check states (Pass, Fail, In Progress) are preserved when lot numbers are assigned
  • Applies only to receipt operations (incoming shipments)
  • Other operation types (manufacturing, internal transfers, delivery) continue with standard Odoo behavior

2. Automatic Lot Number Synchronization

  • Lot numbers assigned to stock move lines are automatically copied to related quality checks
  • Lot number changes are synchronized in real-time
  • Maintains traceability between inventory and quality records

3. Selective Application

  • Custom behavior applies only to receipt operations
  • Standard Odoo workflows remain unchanged for other operation types
  • Seamless integration with existing quality control processes

Installation

  1. Copy this module to your Odoo addons directory (e.g., customaddons/quality_check_lot_preserve)
  2. Update the apps list in Odoo
  3. Install the "Quality Check Lot Preserve" module

Dependencies

  • stock - Odoo Inventory Management
  • quality_control - Odoo Quality Control (Enterprise module)

Note: This module requires Odoo Enterprise edition as it depends on the quality_control module.

Usage

Typical Workflow

  1. Receive Products: Create a purchase order and validate the receipt
  2. Perform Quality Checks: Complete quality checks immediately upon receipt (before lot assignment)
  3. Assign Lot Numbers: Generate or manually assign lot numbers to the stock move lines
  4. Result: Quality check states remain unchanged, and lot numbers are automatically copied to quality checks

Example Scenario

Before this module:

  • Receive 100 units of Product A
  • Complete quality check → Status: "Pass"
  • Assign lot number "LOT001"
  • Quality check resets → Status: "Todo"
  • Must re-do quality check

With this module:

  • Receive 100 units of Product A
  • Complete quality check → Status: "Pass"
  • Assign lot number "LOT001"
  • Quality check remains → Status: "Pass" ✓
  • Lot number automatically copied to quality check ✓

Technical Details

Extended Models

stock.move.line

  • Monitors lot_id and lot_name field changes
  • Identifies related quality checks for receipt operations
  • Triggers quality check lot number updates

quality.check

  • Prevents state resets during lot assignment for receipt operations
  • Accepts lot number updates from stock move lines
  • Maintains standard behavior for non-receipt operations

Operation Type Detection

The module identifies receipt operations by checking:

  • picking_type_code == 'incoming'
  • Fallback to picking_id.picking_type_id.code

Data Flow

Stock Move Line (Lot Assigned)
    ↓
Detect Change (write method)
    ↓
Find Related Quality Checks
    ↓
Check Operation Type (Receipt?)
    ↓ Yes
Copy Lot Number + Preserve State
    ↓
Update Quality Check

Security and Access Rights

This module extends existing Odoo models (stock.move.line and quality.check) without creating new models or data structures. Therefore:

  • No new access rights are required
  • Access rights are inherited from the base modules (stock and quality_control)
  • Users with existing quality control and inventory permissions can use this module
  • The security/ir.model.access.csv file is present but empty (only contains the header row)

The module respects all existing Odoo security rules and group permissions.

Configuration

No additional configuration is required. The module works automatically once installed.

Compatibility

  • Odoo Version: 18.0
  • Edition: Enterprise (requires quality_control module)
  • Database: PostgreSQL

Limitations

  • Only applies to receipt operations (incoming shipments)
  • Requires the quality_control Enterprise module
  • Does not modify historical quality check records

Support

For issues, questions, or feature requests, please contact your Odoo implementation partner or system administrator.

License

LGPL-3

Author

Your Company

Version History

1.0.0 (Initial Release)

  • State preservation for quality checks during lot assignment
  • Automatic lot number synchronization
  • Receipt operation filtering
  • Full integration with standard Odoo quality control workflows