-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] stock_manual_transfer: rename group's external ID
Rename group's external ID, from: `group_stock_manual_transferp` → `group_user` to follow usual naming conventions. The reason for the old name is first implementation of this was not as a standalone module. In addition, IDs and names of model access rights are also modified to follow conventions.
- Loading branch information
Showing
6 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
stock_manual_transfer/migrations/17.0.1.0.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate(cr, version): | ||
rename_external_ids(cr) | ||
|
||
|
||
def rename_external_ids(cr): | ||
"""Rename group's external ID, from group_stock_manual_transfer → group_user | ||
This to follow usual naming conventions. The reason for the old name is first implementation | ||
of this was not as a standalone module. | ||
""" | ||
cr.execute( | ||
""" | ||
UPDATE | ||
ir_model_data | ||
SET | ||
name = 'group_user', | ||
write_uid = 1, | ||
write_date = NOW() at time zone 'UTC' | ||
WHERE | ||
module = 'stock_manual_transfer' | ||
AND name = 'group_stock_manual_transfer'; | ||
""" | ||
) | ||
if cr.rowcount: | ||
_logger.info( | ||
"Group's external ID renamed: stock_manual_transfer.group_stock_manual_transfer -> stock_manual_transfer.group_user" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_stock_can_stock_manual_transfer,stock_can_stock_manual_transfer,model_stock_manual_transfer,group_stock_manual_transfer,1,1,1,1 | ||
access_stock_can_stock_manual_transfer_line,stock_can_stock_manual_transfer_line,model_stock_manual_transfer_line,group_stock_manual_transfer,1,1,1,1 | ||
access_stock_manual_transfer,access_stock_manual_transfer,model_stock_manual_transfer,group_user,1,1,1,1 | ||
access_stock_manual_transfer_line,access_stock_manual_transfer_line,model_stock_manual_transfer_line,group_user,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters