update project structure
This commit is contained in:
parent
43760c6565
commit
422b142d90
0
__init__.py
Normal file
0
__init__.py
Normal file
@ -2,12 +2,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
from services.odoo.manager import OdooModuleManager
|
||||||
# Add the 'services' directory to sys.path before importing
|
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../services")))
|
|
||||||
|
|
||||||
# # Use absolute import from the services module
|
|
||||||
from odoo_manager import OdooModuleManager
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
@ -1,4 +0,0 @@
|
|||||||
from . import config
|
|
||||||
# from . import git
|
|
||||||
from . import odoo_manager
|
|
||||||
from . import connection
|
|
0
services/git/__init__.py
Normal file
0
services/git/__init__.py
Normal file
0
services/odoo/__init__.py
Normal file
0
services/odoo/__init__.py
Normal file
@ -1,10 +1,7 @@
|
|||||||
from odoorpc import ODOO
|
from odoorpc import ODOO
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from utility.services.config import Config
|
||||||
# Adjust the path to import config from the service directory
|
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
||||||
from config import Config
|
|
||||||
|
|
||||||
|
|
||||||
class OdooConnection:
|
class OdooConnection:
|
||||||
@ -77,7 +74,7 @@ class OdooConnection:
|
|||||||
def get_instances(self):
|
def get_instances(self):
|
||||||
"""Return the list of configured instances."""
|
"""Return the list of configured instances."""
|
||||||
return self.instances
|
return self.instances
|
||||||
|
|
||||||
def execute(self, instance_name, model, method, *args, **kwargs):
|
def execute(self, instance_name, model, method, *args, **kwargs):
|
||||||
"""Execute a method on a model for a specific instance."""
|
"""Execute a method on a model for a specific instance."""
|
||||||
odoo = self.get_connection(instance_name)
|
odoo = self.get_connection(instance_name)
|
||||||
@ -90,4 +87,4 @@ class OdooConnection:
|
|||||||
return result
|
return result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error executing {method} on {model} for {instance_name}: {e}")
|
print(f"Error executing {method} on {model} for {instance_name}: {e}")
|
||||||
raise
|
raise
|
@ -1,5 +1,5 @@
|
|||||||
from git_handler import GitHandler
|
from utility.services.git.handler import GitHandler
|
||||||
from odoo_connection import OdooConnection
|
from utility.services.odoo.connection import OdooConnection
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
@ -14,15 +14,7 @@ class OdooModuleManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def update_and_upgrade(self, instance_name=None):
|
def update_and_upgrade(self, instance_name=None):
|
||||||
"""Update Git repo and upgrade multiple modules for the specified instance(s)."""
|
"""Update and upgrade multiple modules for the specified instance(s)."""
|
||||||
# old_commit = self.git.get_current_commit()
|
|
||||||
# updated = self.git.pull_updates()
|
|
||||||
# new_commit = self.git.get_current_commit()
|
|
||||||
|
|
||||||
# if not updated or old_commit == new_commit:
|
|
||||||
# print("No new changes to apply.")
|
|
||||||
# return False
|
|
||||||
|
|
||||||
self.config.connect(instance_name) # Connect to the target instance(s)
|
self.config.connect(instance_name) # Connect to the target instance(s)
|
||||||
for instance in self.config.get_instances():
|
for instance in self.config.get_instances():
|
||||||
if instance_name and instance["name"] != instance_name:
|
if instance_name and instance["name"] != instance_name:
|
Loading…
Reference in New Issue
Block a user