vault backup: 2025-11-17 20:40:56
This commit is contained in:
2 files changed
+20
-18
No files matched your search
@@ -49,7 +49,7 @@ ssh "$SERVER" docker stop "$ODOO_CONTAINER"
|
||||
Drop the target database.
|
||||
|
||||
```bash
|
||||
ssh -p "$PORT" "$SERVER" docker-postgres-drop -c "$POSTGRES_CONTAINER" -d "$TARGET_DATABASE"
|
||||
ssh -p "$PORT" "$SERVER" docker-postgres-drop -c "$TARGET_POSTGRES_CONTAINER" -d "$TARGET_DATABASE"
|
||||
```
|
||||
|
||||
Run upgrade script in **test** mode.
|
||||
|
||||
@@ -179,24 +179,26 @@ task update-with-llm addons/$REPO/$MODULE/views/*.xml $task
|
||||
|
||||
```bash
|
||||
task=$(cat << EOF
|
||||
Migrate model fields state definitions:
|
||||
For example:
|
||||
READONLY_STATES = {
|
||||
"draft": [("readonly", False)],
|
||||
"initialized": [("readonly", True)],
|
||||
"connected": [("readonly", True)],
|
||||
"deleted": [("readonly", False)],
|
||||
}
|
||||
name = fields.Char(required=True, states=READONLY_STATES)
|
||||
key = fields.Char(
|
||||
states={"draft": [("readonly", False)], "assigned": [("deleted", False)]},
|
||||
tracking=True,
|
||||
)
|
||||
Migrate model fields state definitions.
|
||||
Replace this kind of conditions:
|
||||
|
||||
READONLY_STATES = {
|
||||
"draft": [("readonly", False)],
|
||||
"initialized": [("readonly", True)],
|
||||
"connected": [("readonly", True)],
|
||||
"deleted": [("readonly", False)],
|
||||
}
|
||||
name = fields.Char(states=READONLY_STATES)
|
||||
key = fields.Char(
|
||||
readonly=True
|
||||
states={"draft": [("readonly", False)], "assigned": [("deleted", False)]},
|
||||
)
|
||||
|
||||
With a form view definitions of the respective model:
|
||||
|
||||
<field name="name" readonly="state in ['initialized', 'connected']"/>
|
||||
<field name="key" readonly="state not in ['draft', 'deleted']"/>
|
||||
|
||||
To a single function:
|
||||
def _is_readonly(self):
|
||||
self.ensure_one()
|
||||
return self.state in ['initialized', 'connected']
|
||||
EOF
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user