[17.0][OU-ADD] base_automation: migration to 17.0#5028
Conversation
|
/ocabot migration base_automation |
|
The migration issue (#4124) has not been updated to reference the current pull request because a previous pull request (#4459) is not closed. |
MiquelRForgeFlow
left a comment
There was a problem hiding this comment.
I understand only create column with Null values should do the trick, any advices welcomes
_new_columns = [
("base.automation", "trg_field_ref", "many2one_reference"),
("base.automation", "trg_selection_field_id", "many2one"),
]
openupgrade.add_columns(env, _new_columns)I'm wondering what's wrong moving forwards ? it is to gives more times to sub modules to change code as well and take care new values ?
I don't know. That's something only @pedrobaeza should answer, as he made that comment.
|
/ocabot migration base_automation |
|
@MiquelRForgeFlow thanks for review and advices.
Here my question was not how to create those empty fields, but: if I only create those fields leaving them empty is it enough in this specific case ? As far I understand, generally we do that for performance reason by populate the field using SQL query re-implementing the business python code in SQL. here the python code that compute @api.depends('trigger', 'trigger_field_ids')
def _compute_trg_selection_field_id(self):
to_reset = self.filtered(lambda a: a.trigger not in ['on_priority_set', 'on_state_set'] or len(a.trigger_field_ids) != 1)
to_reset.trg_selection_field_id = False
for automation in (self - to_reset):
# always re-assign to an empty value to make sure we have no discrepencies
automation.trg_selection_field_id = self.env['ir.model.fields.selection']as far I understand the value is False or an empty recordset which is also a falsy value or I missed interpret the following instruction ? also when I read the doc
And seen only 4 records in my database I was thinking should I take this risks ! |
Yeah, in this specific case, leaving them empty is fine 😊 (it's a new functionality, they are supposed to be filled using the form view) |
0b785c1 to
2d3653c
Compare
2d3653c to
13cd53e
Compare
|
And please reduce the commit history to one commit. |
|
Well, 2 commits, the other and yours, but don't put so many commits of your authorship. |
* move m2o_to_x2m in post migration * move action server base automation name as end script * rotate webhook uuid * create trg_field_ref/trg_selection_field_id at pre-migration step * revert _base_automation_update_deprecate_trigger to keep deprecated until next version
13cd53e to
8b29020
Compare
|
I've squashed commits ! (I kept it in the mean time with the hope to help reviews) |
attempt to take care some reviews from #4459