update project structure

This commit is contained in:
KaySar12 2025-04-03 15:58:08 +07:00
parent 43760c6565
commit 422b142d90
8 changed files with 7 additions and 27 deletions

0
__init__.py Normal file
View File

View File

@ -2,12 +2,7 @@
import sys
import os
import argparse
# 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
from services.odoo.manager import OdooModuleManager
def main():

View File

@ -1,4 +0,0 @@
from . import config
# from . import git
from . import odoo_manager
from . import connection

0
services/git/__init__.py Normal file
View File

View File

View File

@ -1,10 +1,7 @@
from odoorpc import ODOO
import os
import sys
# 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
from utility.services.config import Config
class OdooConnection:
@ -77,7 +74,7 @@ class OdooConnection:
def get_instances(self):
"""Return the list of configured instances."""
return self.instances
def execute(self, instance_name, model, method, *args, **kwargs):
"""Execute a method on a model for a specific instance."""
odoo = self.get_connection(instance_name)
@ -90,4 +87,4 @@ class OdooConnection:
return result
except Exception as e:
print(f"Error executing {method} on {model} for {instance_name}: {e}")
raise
raise

View File

@ -1,5 +1,5 @@
from git_handler import GitHandler
from odoo_connection import OdooConnection
from utility.services.git.handler import GitHandler
from utility.services.odoo.connection import OdooConnection
import subprocess
@ -14,15 +14,7 @@ class OdooModuleManager:
)
def update_and_upgrade(self, instance_name=None):
"""Update Git repo 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
"""Update and upgrade multiple modules for the specified instance(s)."""
self.config.connect(instance_name) # Connect to the target instance(s)
for instance in self.config.get_instances():
if instance_name and instance["name"] != instance_name: