Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] cetmix_tower_server: implement UI updates #185

Open
wants to merge 2 commits into
base: 14.0-dev
Choose a base branch
from

Conversation

tendil
Copy link
Collaborator

@tendil tendil commented Jan 17, 2025

This commit implements the following UI updates:

  1. Sort Flight Plan Log and Command Log by "Started" (newest first).

    • Added default_order="start_date desc, id desc" in tree views for both logs.
  2. Show related Flight Plan Log line in the Command Log form.

    • Added related fields in the Command Log model and updated the form view.
  3. Update the "Code" field in the Flight Plan Line form.

    • Implemented a computed field command_code to display:
    • File template code for the action "Upload File from Template".
    • Related flight plan lines for the action "Execute Flight Plan".
  4. Display the number of servers in the Server Template Kanban view.

    • Used the server_count computed field to show the count as a numeric value in Kanban cards.
  5. Add a pre-defined "Flight Plan" filter to the Command search view.

    • Added a filter for the action='plan' in the search view of the Command model.

Task ID: 4263

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced command log tracking with new fields for flight plan details.
    • Added dynamic command code generation in plan lines.
    • Introduced new search filter for commands related to flight plans.
    • Added server count display in the kanban view for server templates.
  • Improvements

    • Updated default sorting for command logs and plan logs to prioritize start dates.
    • Removed reference field from the kanban view to streamline information display.
  • User Interface

    • Updated form and tree views with additional plan-related fields.
    • Modified visibility of fields in the command preview based on action type.

@tendil tendil requested a review from ivs-cetmix January 17, 2025 01:51
Copy link

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request introduces several enhancements to the Cetmix Tower Server models and views. The changes primarily focus on expanding the CxTowerCommandLog model with new fields related to flight plan tracking, modifying the CxTowerPlanLine model's command_code to be a computed field, and updating various XML views to improve data presentation and searchability. Additionally, new filters and visibility logic have been implemented to enhance user interaction with the command and flight plan data.

Changes

File Change Summary
cetmix_tower_server/models/cx_tower_command_log.py Added new related fields: plan_start_date, plan_finish_date, plan_status, and plan_is_running to the CxTowerCommandLog model.
cetmix_tower_server/models/cx_tower_plan_line.py Changed command_code from a related field to a computed field using _compute_command_code; added new computed field plan_line_ids and corresponding methods.
cetmix_tower_server/views/cx_tower_command_log_view.xml Added new fields to form view and updated tree view default ordering.
cetmix_tower_server/views/cx_tower_command_view.xml Added new "Run Flight Plan" filter to search view.
cetmix_tower_server/views/cx_tower_plan_log_view.xml Updated tree view default ordering.
cetmix_tower_server/views/cx_tower_server_template_view.xml Added server_count field to kanban view, removed reference field, and updated display logic.
cetmix_tower_server/views/cx_tower_plan_line_view.xml Added action field, replaced visibility logic for command_code, and added visibility logic for plan_line_ids.

Possibly related PRs

Suggested Labels

approved, ready to merge

Suggested Reviewers

  • ivs-cetmix
  • Aldeigja

Finishing Touches

  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
cetmix_tower_server/models/cx_tower_plan_line.py (1)

95-111: Enhance code quality with constants and improved documentation.

Consider the following improvements:

  1. Define constants for action types and default messages
  2. Enhance docstring with parameter and return type documentation
+ # Constants
+ ACTION_FILE_TEMPLATE = "file_using_template"
+ ACTION_PLAN = "plan"
+ DEFAULT_TEMPLATE_MSG = "No template code available"
+ DEFAULT_PLAN_MSG = "No related lines available"
+ DEFAULT_PREVIEW_MSG = "No preview available"

 @api.depends("command_id", "action")
 def _compute_command_code(self):
     """
     Compute the preview of the command based on its action.
+
+    Computes a preview text based on the command's action type:
+    - For file_using_template: Shows the template code
+    - For plan: Shows a list of flight plan line names
+    - For other actions: Shows a default message
+
+    Dependencies:
+        - command_id: The related command record
+        - action: The type of action to be performed
     """
     for line in self:
-        if line.action == "file_using_template":
+        if line.action == ACTION_FILE_TEMPLATE:
             line.command_code = (
-                line.command_id.code or "No template code available"
+                line.command_id.code or DEFAULT_TEMPLATE_MSG
             )
-        elif line.action == "plan":
+        elif line.action == ACTION_PLAN:
             flight_plan_lines = line.command_id.flight_plan_id.line_ids
             preview_lines = [line.name for line in flight_plan_lines]
-            line.command_code = "\n".join(preview_lines) if preview_lines else "No related lines available"
+            line.command_code = "\n".join(preview_lines) if preview_lines else DEFAULT_PLAN_MSG
         else:
-            line.command_code = "No preview available"
+            line.command_code = DEFAULT_PREVIEW_MSG
🧰 Tools
🪛 Ruff (0.8.2)

108-108: Line too long (111 > 88)

(E501)

🪛 GitHub Actions: pre-commit

[error] 108-108: Line too long (111 > 88 characters)

cetmix_tower_server/views/cx_tower_server_template_view.xml (1)

59-63: Consider UX enhancements for the server count display.

The implementation follows Odoo patterns and provides clear visibility of the count. Consider these UX improvements:

 <div attrs="{'invisible': [('server_count', '=', False)]}">
     <strong>Servers:</strong>
-    <span class="badge badge-primary">
+    <span class="badge badge-primary" 
+          t-att-title="'Number of servers using this template'">
         <t t-esc="record.server_count.value" />
     </span>
 </div>
🧰 Tools
🪛 GitHub Actions: pre-commit

[warning] File was modified by prettier formatting hook

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65a1c7a and 280b587.

📒 Files selected for processing (6)
  • cetmix_tower_server/models/cx_tower_command_log.py (1 hunks)
  • cetmix_tower_server/models/cx_tower_plan_line.py (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_log_view.xml (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_view.xml (1 hunks)
  • cetmix_tower_server/views/cx_tower_plan_log_view.xml (1 hunks)
  • cetmix_tower_server/views/cx_tower_server_template_view.xml (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: pre-commit
cetmix_tower_server/views/cx_tower_server_template_view.xml

[warning] File was modified by prettier formatting hook

cetmix_tower_server/models/cx_tower_plan_line.py

[error] 108-108: Line too long (111 > 88 characters)

🪛 Ruff (0.8.2)
cetmix_tower_server/models/cx_tower_plan_line.py

108-108: Line too long (111 > 88)

(E501)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test with OCB
🔇 Additional comments (7)
cetmix_tower_server/models/cx_tower_plan_line.py (1)

47-51: LGTM! Field declaration follows Odoo conventions.

The change from a related field to a computed field is well-structured and aligns with the requirement to show dynamic content based on the action type.

cetmix_tower_server/models/cx_tower_command_log.py (1)

63-83: LGTM! Well-structured related fields implementation.

The new related fields for plan_log_id tracking are well-implemented with:

  • Proper field types matching the related model
  • Appropriate store=True for query optimization
  • Clear string labels for UI display
cetmix_tower_server/views/cx_tower_plan_log_view.xml (1)

84-84: LGTM! Sorting implementation matches requirements.

The default ordering by start_date desc, id desc aligns with the PR objective to sort Flight Plan Logs by "Started" date in descending order.

cetmix_tower_server/views/cx_tower_command_log_view.xml (2)

77-83: LGTM! Well-structured form view group for plan log tracking.

The new group of fields provides clear visibility of related Flight Plan Log details, matching the PR objective.


109-109: LGTM! Consistent sorting implementation.

The default ordering matches the Flight Plan Log view, maintaining consistency across the application.

cetmix_tower_server/views/cx_tower_command_view.xml (1)

253-257: LGTM! Search filter enhances command filtering capabilities.

The new filter for Run Flight Plan commands improves the search functionality by allowing specific filtering of flight plan related commands.

cetmix_tower_server/views/cx_tower_server_template_view.xml (1)

14-14: LGTM! Verify the computed field implementation.

The field declaration follows Odoo conventions and is properly positioned with related fields.

Run this script to verify the computed field implementation:

✅ Verification successful

✓ Computed field implementation verified and correct

The server_count field is properly implemented with a clean One2many relationship and follows Odoo best practices. The computation is lightweight and suitable for real-time display in views.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify server_count computed field implementation
# Expected: Find the compute method definition and dependencies

# Search for server_count compute method
ast-grep --pattern 'server_count = fields.$_($$$, compute="$_")'

# Search for potential dependencies in compute method
rg -A 10 "def _compute_server_count"

Length of output: 1293


Script:

#!/bin/bash
# Verify server_ids field definition and related performance settings
ast-grep --pattern 'server_ids = fields.$_($$$)'

# Check for potential performance impact by finding server count usage
rg "server_count" -A 2

Length of output: 5385

🧰 Tools
🪛 GitHub Actions: pre-commit

[warning] File was modified by prettier formatting hook

cetmix_tower_server/models/cx_tower_plan_line.py Outdated Show resolved Hide resolved
This commit implements the following UI updates:

1. Sort Flight Plan Log and Command Log by "Started" (newest first).
   - Added `default_order="start_date desc, id desc"` in tree views for both logs.

2. Show related Flight Plan Log line in the Command Log form.
   - Added related fields in the Command Log model and updated the form view.

3. Update the "Code" field in the Flight Plan Line form.
   - Implemented a computed field `command_code` to display:
     - File template code for the action "Upload File from Template".
     - Related flight plan lines for the action "Execute Flight Plan".

4. Display the number of servers in the Server Template Kanban view.
   - Used the `server_count` computed field to show the count as a numeric value in Kanban cards.

5. Add a pre-defined "Flight Plan" filter to the Command search view.
   - Added a filter for the `action='plan'` in the search view of the Command model.

Task ID: 4263
@tendil tendil force-pushed the 14.0-t4263-cetmix_tower_server-ui-updates branch from 280b587 to 54fcb67 Compare January 17, 2025 01:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
cetmix_tower_server/models/cx_tower_plan_line.py (1)

102-103: Consider optimizing memory usage for large flight plans.

For large flight plans, building the preview list could be memory intensive. Consider limiting the number of lines shown.

-                flight_plan_lines = line.command_id.flight_plan_id.line_ids
-                preview_lines = [line.name for line in flight_plan_lines]
+                # Limit preview to first 10 lines for better performance
+                flight_plan_lines = line.command_id.flight_plan_id.line_ids[:10]
+                preview_lines = [line.name for line in flight_plan_lines]
+                if len(line.command_id.flight_plan_id.line_ids) > 10:
+                    preview_lines.append("... and more lines")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 280b587 and 54fcb67.

📒 Files selected for processing (6)
  • cetmix_tower_server/models/cx_tower_command_log.py (1 hunks)
  • cetmix_tower_server/models/cx_tower_plan_line.py (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_log_view.xml (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_view.xml (1 hunks)
  • cetmix_tower_server/views/cx_tower_plan_log_view.xml (1 hunks)
  • cetmix_tower_server/views/cx_tower_server_template_view.xml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • cetmix_tower_server/views/cx_tower_command_view.xml
  • cetmix_tower_server/views/cx_tower_plan_log_view.xml
  • cetmix_tower_server/views/cx_tower_command_log_view.xml
  • cetmix_tower_server/models/cx_tower_command_log.py
  • cetmix_tower_server/views/cx_tower_server_template_view.xml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test with OCB
🔇 Additional comments (1)
cetmix_tower_server/models/cx_tower_plan_line.py (1)

47-49: LGTM! Field declaration follows best practices.

The change from a related field to a computed field is well-structured and follows Odoo field declaration conventions.

Comment on lines 93 to 111
@api.depends("command_id", "action")
def _compute_command_code(self):
"""
Compute the preview of the command based on its action.
"""
for line in self:
if line.action == "file_using_template":
line.command_code = line.command_id.code or "No template code available"
elif line.action == "plan":
flight_plan_lines = line.command_id.flight_plan_id.line_ids
preview_lines = [line.name for line in flight_plan_lines]
line.command_code = (
"\n".join(preview_lines)
if preview_lines
else "No related lines available"
)
else:
line.command_code = "No preview available"

Copy link

@coderabbitai coderabbitai bot Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation checks for better error handling.

The compute method should validate the existence of required related records to prevent potential errors.

     @api.depends("command_id", "action")
     def _compute_command_code(self):
         """
         Compute the preview of the command based on its action.
         """
         for line in self:
+            if not line.command_id:
+                line.command_code = "No command selected"
+                continue
+
             if line.action == "file_using_template":
                 line.command_code = line.command_id.code or "No template code available"
             elif line.action == "plan":
+                if not line.command_id.flight_plan_id:
+                    line.command_code = "No flight plan selected"
+                    continue
+
                 flight_plan_lines = line.command_id.flight_plan_id.line_ids
                 preview_lines = [line.name for line in flight_plan_lines]
                 line.command_code = (
                     "\n".join(preview_lines)
                     if preview_lines
                     else "No related lines available"
                 )
             else:
                 line.command_code = "No preview available"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@api.depends("command_id", "action")
def _compute_command_code(self):
"""
Compute the preview of the command based on its action.
"""
for line in self:
if line.action == "file_using_template":
line.command_code = line.command_id.code or "No template code available"
elif line.action == "plan":
flight_plan_lines = line.command_id.flight_plan_id.line_ids
preview_lines = [line.name for line in flight_plan_lines]
line.command_code = (
"\n".join(preview_lines)
if preview_lines
else "No related lines available"
)
else:
line.command_code = "No preview available"
@api.depends("command_id", "action")
def _compute_command_code(self):
"""
Compute the preview of the command based on its action.
"""
for line in self:
if not line.command_id:
line.command_code = "No command selected"
continue
if line.action == "file_using_template":
line.command_code = line.command_id.code or "No template code available"
elif line.action == "plan":
if not line.command_id.flight_plan_id:
line.command_code = "No flight plan selected"
continue
flight_plan_lines = line.command_id.flight_plan_id.line_ids
preview_lines = [line.name for line in flight_plan_lines]
line.command_code = (
"\n".join(preview_lines)
if preview_lines
else "No related lines available"
)
else:
line.command_code = "No preview available"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, don't as part of this task.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tendil Understood, I'll skip the validation checks for now. Would you like me to create a follow-up issue to track this improvement for future implementation?

@@ -60,6 +60,20 @@ class CxTowerCommandLog(models.Model):
plan_log_id = fields.Many2one(comodel_name="cx.tower.plan.log", ondelete="cascade")
triggered_plan_log_id = fields.Many2one(comodel_name="cx.tower.plan.log")

# -- Related fields for plan_log_id
plan_start_date = fields.Datetime(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to show all these fields. Just show the related flight_plan_line.

<field name="plan_log_id" attrs="{'invisible': [('plan_log_id', '=', False)]}"/>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending.

@@ -44,7 +44,9 @@ class CxTowerPlanLine(models.Model):
help="Actions trigger based on command result."
" If empty next command will be executed",
)
command_code = fields.Text(related="command_id.code", readonly=True)
command_code = fields.Text(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach doesn't allow to check those lines if required.
So we need to add a compute o2m field for lines and hide/show it based on the command action.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54fcb67 and 5111416.

📒 Files selected for processing (3)
  • cetmix_tower_server/models/cx_tower_plan_line.py (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_log_view.xml (2 hunks)
  • cetmix_tower_server/views/cx_tower_plan_line_view.xml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cetmix_tower_server/views/cx_tower_command_log_view.xml
🔇 Additional comments (3)
cetmix_tower_server/views/cx_tower_plan_line_view.xml (1)

42-50: LGTM! Well-structured visibility rules.

The visibility rules for command_code and plan_line_ids fields are correctly implemented based on the action field value, following the feedback from the previous review.

cetmix_tower_server/models/cx_tower_plan_line.py (2)

110-120: LGTM! Well-implemented plan lines computation.

The _compute_plan_line_ids method correctly:

  • Handles the 'plan' action case
  • Includes proper null check for flight_plan
  • Sets False for non-plan actions

47-55: LGTM! Field definitions are clear and well-structured.

The computed fields are properly defined with correct parameters and string labels.

cetmix_tower_server/views/cx_tower_plan_line_view.xml Outdated Show resolved Hide resolved
cetmix_tower_server/models/cx_tower_plan_line.py Outdated Show resolved Hide resolved
@tendil tendil force-pushed the 14.0-t4263-cetmix_tower_server-ui-updates branch from 5111416 to 8fec17f Compare January 17, 2025 14:43
@tendil tendil force-pushed the 14.0-t4263-cetmix_tower_server-ui-updates branch from 8fec17f to 76d5c23 Compare January 17, 2025 14:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
cetmix_tower_server/models/cx_tower_plan_line.py (1)

99-111: Simplify the command code computation logic.

The condition elif line.action != "plan" is redundant since we already handle the 'plan' action in the previous condition.

     @api.depends("command_id", "action")
     def _compute_command_code(self):
         """
         Compute the preview of the command based on its action.
         """
         for line in self:
             if line.action == "file_using_template":
                 line.command_code = line.command_id.code or "No template code available"
             elif line.action == "plan":
                 line.command_code = False
-            elif line.action != "plan":
+            else:
                 line.command_code = "No preview available"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5111416 and 76d5c23.

📒 Files selected for processing (3)
  • cetmix_tower_server/models/cx_tower_plan_line.py (2 hunks)
  • cetmix_tower_server/views/cx_tower_command_log_view.xml (2 hunks)
  • cetmix_tower_server/views/cx_tower_plan_line_view.xml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • cetmix_tower_server/views/cx_tower_plan_line_view.xml
  • cetmix_tower_server/views/cx_tower_command_log_view.xml
🔇 Additional comments (2)
cetmix_tower_server/models/cx_tower_plan_line.py (2)

47-55: LGTM! Field declarations are well-structured.

The computed fields command_code and plan_line_ids are properly defined with appropriate field types and compute methods.


112-123: 🛠️ Refactor suggestion

Add validation for command_id in plan line computation.

The method could raise an AttributeError if command_id is False. Add validation to handle this case gracefully.

     @api.depends("command_id", "action")
     def _compute_plan_line_ids(self):
         """
         Compute the related plan lines if the action is "plan".
         """
         for line in self:
-            if line.action == "plan":
+            if not line.command_id:
+                line.plan_line_ids = False
+            elif line.action == "plan":
                 flight_plan = line.command_id.flight_plan_id
                 line.plan_line_ids = flight_plan.line_ids if flight_plan else []
             else:
                 line.plan_line_ids = False

Likely invalid or redundant comment.

@@ -60,6 +60,20 @@ class CxTowerCommandLog(models.Model):
plan_log_id = fields.Many2one(comodel_name="cx.tower.plan.log", ondelete="cascade")
triggered_plan_log_id = fields.Many2one(comodel_name="cx.tower.plan.log")

# -- Related fields for plan_log_id
plan_start_date = fields.Datetime(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending.

@@ -88,6 +96,31 @@ def _check_command_id(self):
visited_plans = set()
self._check_recursive_plan(line.command_id, visited_plans)

@api.depends("command_id", "action")
def _compute_command_code(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to compute anything. Just hide this field if command action is not SSH or Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants