Skip to content

Commit 2e7a447

Browse files
committed
[IMP] cetmix_tower_yaml Add new fields
- Waypoint template and jet action template fields - Custom variable values for scheduled tasks Task 5309
1 parent 4c12e40 commit 2e7a447

5 files changed

Lines changed: 57 additions & 18 deletions

File tree

cetmix_tower_yaml/models/cx_tower_command.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ def _get_fields_for_yaml(self):
1919
"tag_ids",
2020
"path",
2121
"file_template_id",
22+
"if_file_exists",
23+
"disconnect_file",
2224
"flight_plan_id",
25+
"jet_template_id",
26+
"jet_action_id",
27+
"waypoint_template_id",
28+
"fly_here",
2329
"code",
30+
"no_split_for_sudo",
2431
"server_status",
2532
"variable_ids",
2633
"secret_ids",
27-
"no_split_for_sudo",
28-
"if_file_exists",
29-
"disconnect_file",
3034
]
3135
return res

cetmix_tower_yaml/models/cx_tower_scheduled_task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,13 @@ def _get_fields_for_yaml(self):
1919
"interval_type",
2020
"next_call",
2121
"last_call",
22+
"monday",
23+
"tuesday",
24+
"wednesday",
25+
"thursday",
26+
"friday",
27+
"saturday",
28+
"sunday",
29+
"custom_variable_value_ids",
2230
]
2331
return res
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (C) 2025 Cetmix OÜ
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
from odoo import models
4+
5+
6+
class CxTowerScheduledTaskCv(models.Model):
7+
_name = "cx.tower.scheduled.task.cv"
8+
_inherit = ["cx.tower.scheduled.task.cv", "cx.tower.yaml.mixin"]
9+
10+
def _get_fields_for_yaml(self):
11+
res = super()._get_fields_for_yaml()
12+
res += ["variable_value_id"]
13+
return res

cetmix_tower_yaml/tests/test_command.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ def setUpClass(cls, *args, **kwargs):
2727
tag_ids: false
2828
path: false
2929
file_template_id: false
30+
if_file_exists: skip
31+
disconnect_file: false
3032
flight_plan_id: false
33+
jet_template_id: false
34+
jet_action_id: false
35+
waypoint_template_id: false
36+
fly_here: false
3137
code: |-
3238
cd /home/{{ tower.server.ssh_username }} \\
3339
&& ls -lha
40+
no_split_for_sudo: false
3441
server_status: false
3542
variable_ids: false
3643
secret_ids: false
37-
no_split_for_sudo: false
38-
if_file_exists: skip
39-
disconnect_file: false
4044
"""
4145

4246
# YAML content translated into Python dict
@@ -265,14 +269,18 @@ def test_command_with_action_file_template(self):
265269
tag_ids: false
266270
path: false
267271
file_template_id: my_custom_test_template
272+
if_file_exists: skip
273+
disconnect_file: false
268274
flight_plan_id: false
275+
jet_template_id: false
276+
jet_action_id: false
277+
waypoint_template_id: false
278+
fly_here: false
269279
code: false
280+
no_split_for_sudo: false
270281
server_status: false
271282
variable_ids: false
272283
secret_ids: false
273-
no_split_for_sudo: false
274-
if_file_exists: skip
275-
disconnect_file: false
276284
"""
277285
# Add file template
278286
file_template = self.env["cx.tower.file.template"].create(
@@ -330,14 +338,18 @@ def test_command_with_action_file_template(self):
330338
code: false
331339
variable_ids: false
332340
secret_ids: false
341+
if_file_exists: skip
342+
disconnect_file: false
333343
flight_plan_id: false
344+
jet_template_id: false
345+
jet_action_id: false
346+
waypoint_template_id: false
347+
fly_here: false
334348
code: false
349+
no_split_for_sudo: false
335350
server_status: false
336351
variable_ids: false
337352
secret_ids: false
338-
no_split_for_sudo: false
339-
if_file_exists: skip
340-
disconnect_file: false
341353
"""
342354
command_with_template.invalidate_recordset(["yaml_code"])
343355
self.assertEqual(

cetmix_tower_yaml/tests/test_yaml_export_wizard.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ def test_yaml_export_wizard_yaml_generation(self):
103103
allow_parallel_run: false
104104
note: false
105105
path: false
106-
code: echo 'Test Command From Yaml'
107-
server_status: false
108-
no_split_for_sudo: false
109106
if_file_exists: skip
110107
disconnect_file: false
108+
fly_here: false
109+
code: echo 'Test Command From Yaml'
110+
no_split_for_sudo: false
111+
server_status: false
111112
- cetmix_tower_model: command
112113
access_level: manager
113114
reference: test_command_from_yaml_2
@@ -116,11 +117,12 @@ def test_yaml_export_wizard_yaml_generation(self):
116117
allow_parallel_run: false
117118
note: false
118119
path: false
119-
code: echo 'Test Command From Yaml 2'
120-
server_status: false
121-
no_split_for_sudo: false
122120
if_file_exists: skip
123121
disconnect_file: false
122+
fly_here: false
123+
code: echo 'Test Command From Yaml 2'
124+
no_split_for_sudo: false
125+
server_status: false
124126
"""
125127

126128
# -- 1 --

0 commit comments

Comments
 (0)