Add Sefere Basla button and fix GPS cache issue
This commit is contained in:
31
addons/mymach_fleet_intelligence/scratch_fix_groups.py
Normal file
31
addons/mymach_fleet_intelligence/scratch_fix_groups.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
|
||||
def fix_files():
|
||||
for root, dirs, files in os.walk('.'):
|
||||
if '.git' in root or '__pycache__' in root:
|
||||
continue
|
||||
for file in files:
|
||||
if file.endswith(('.xml', '.csv', '.py', '.js')):
|
||||
filepath = os.path.join(root, file)
|
||||
try:
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
if 'group_fleet_user_v2' in content or 'group_fleet_manager_v2' in content:
|
||||
# In CSV, we want to replace the exact strings with the fully qualified ones
|
||||
if file == 'ir.model.access.csv':
|
||||
content = content.replace('group_fleet_user_v2', 'mymach_fleet_intelligence.group_fleet_user_v2')
|
||||
content = content.replace('group_fleet_manager_v2', 'mymach_fleet_intelligence.group_fleet_manager_v2')
|
||||
else:
|
||||
# In XML/PY/JS, if it already has mymach_fleet_intelligence. it will become mymach_fleet_intelligence.group_fleet_user_v2
|
||||
content = content.replace('group_fleet_user_v2', 'group_fleet_user_v2')
|
||||
content = content.replace('group_fleet_manager_v2', 'group_fleet_manager_v2')
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write(content)
|
||||
print(f"Fixed: {filepath}")
|
||||
except Exception as e:
|
||||
print(f"Error processing {filepath}: {e}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
fix_files()
|
||||
Reference in New Issue
Block a user