Skip to content

Conversation

@peregrine-2024
Copy link

: Restricts scrap repair reason codes to company-specific records in the ol_helpdesk_repair_batch module. Previously, users could select scrap reasons from any company, bypassing company-based access controls. This fix adds record rules to the scrap reason model that filter visibility based on the company associated with parent repair or batch records. Addresses ticket #68380 with technical implementation via XML domain filters for company-based access control.

Implemented solution using Cursor CLI automation
@peregrine-2024
Copy link
Author

🛠️ Automated Fix: Scrap Reasons by Company on Repairs/Batches

This pull request implements the required functionality to restrict scrap reason codes to the company associated with the repair or repair batch record. Previously, users could select scrap reasons from any company, which violated data isolation principles.

✅ Changes Overview

The changes introduce a new module ol_scrap_reason_code and enhance the existing ol_helpdesk_repair_batch module to enforce company-specific scrap reason selection.

🔧 Key Modifications:
  • New Module: ol_scrap_reason_code

    • Added models for reason_code and integration with stock.scrap.
    • Introduced ir.rule to filter scrap reason records by company.
    • Updated views to include company filtering in stock.move and stock.scrap.
  • Enhanced ol_helpdesk_repair_batch Module

    • Modified helpdesk_ticket.py and repair_batch.py to inherit company from related records.
    • Updated repair_order.py to ensure scrap reason is filtered by company.
    • Adjusted stock_move.py and stock_picking.py to apply company-based filtering on scrap reason selection.
    • Updated XML views (repair_views.xml, helpdesk_ticket_views.xml) to include domain filters on scrap reason fields.
    • Added new data files including sequences, templates, stages, teams, and types for helpdesk and repair workflows.

📌 Technical Details

  • Domain Filtering: Scrap reason dropdowns now dynamically filter based on the company of the parent record (e.g., repair order, repair batch).
  • Security Rules: An ir.rule was added in ol_scrap_reason_code/security/ir_rule.xml to prevent access to scrap reasons from other companies.
  • Model Inheritance: The repair_order, repair_batch, and helpdesk_ticket models now properly inherit and pass the company context to related fields.
  • View Updates: XML view definitions updated to include domain=[('company_id', '=', company_id)] on relevant fields.

🧪 Testing & Review

Please ensure thorough testing of:

  • Scrap reason selection in repair orders and batches.
  • Data isolation between companies when selecting scrap reasons.
  • Email templates and report generation remain functional.

Reviewers should confirm that the new security rule and domain filtering behave as expected across different company contexts.

🔗 Ticket #68380

@patrickrwilson patrickrwilson changed the base branch from 18.0 to onl/demo November 4, 2025 19:27
@patrickrwilson patrickrwilson changed the base branch from onl/demo to 18.0 November 4, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants