Spaces:
Running
Running
Aktraiser
commited on
Commit
·
0cb8341
1
Parent(s):
390d6bf
đ MCP Server Odoo prĂȘt pour dĂ©ploiement
Browse files- .gitignore +25 -0
- config.py +45 -0
.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Logs et fichiers temporaires
|
| 2 |
+
logs.md
|
| 3 |
+
*.log
|
| 4 |
+
__pycache__/
|
| 5 |
+
*.pyc
|
| 6 |
+
*.pyo
|
| 7 |
+
*.pyd
|
| 8 |
+
.Python
|
| 9 |
+
|
| 10 |
+
# Configuration locale (ne pas déployer)
|
| 11 |
+
odoo_config.json
|
| 12 |
+
.env
|
| 13 |
+
|
| 14 |
+
# IDE
|
| 15 |
+
.vscode/
|
| 16 |
+
.idea/
|
| 17 |
+
*.swp
|
| 18 |
+
*.swo
|
| 19 |
+
|
| 20 |
+
# OS
|
| 21 |
+
.DS_Store
|
| 22 |
+
Thumbs.db
|
| 23 |
+
|
| 24 |
+
# Gradio temporaire
|
| 25 |
+
flagged/
|
config.py
CHANGED
|
@@ -94,6 +94,51 @@ class SimpleOdooClient:
|
|
| 94 |
{'fields': fields, 'limit': limit}
|
| 95 |
)
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def create(self, model: str, values: Dict) -> int:
|
| 98 |
"""Crée un enregistrement"""
|
| 99 |
if not self.is_connected():
|
|
|
|
| 94 |
{'fields': fields, 'limit': limit}
|
| 95 |
)
|
| 96 |
|
| 97 |
+
def search_count(self, model: str, domain: List = None) -> int:
|
| 98 |
+
"""Compte les enregistrements"""
|
| 99 |
+
if not self.is_connected():
|
| 100 |
+
raise Exception("Non connecté à Odoo")
|
| 101 |
+
|
| 102 |
+
domain = domain or []
|
| 103 |
+
|
| 104 |
+
return self.models.execute_kw(
|
| 105 |
+
self.db, self.uid, self.password,
|
| 106 |
+
model, 'search_count',
|
| 107 |
+
[domain]
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
def read_group(self, model: str, domain: List = None, fields: List = None, groupby: List = None) -> List[Dict]:
|
| 111 |
+
"""Groupe et agrÚge les données"""
|
| 112 |
+
if not self.is_connected():
|
| 113 |
+
raise Exception("Non connecté à Odoo")
|
| 114 |
+
|
| 115 |
+
domain = domain or []
|
| 116 |
+
fields = fields or []
|
| 117 |
+
groupby = groupby or []
|
| 118 |
+
|
| 119 |
+
return self.models.execute_kw(
|
| 120 |
+
self.db, self.uid, self.password,
|
| 121 |
+
model, 'read_group',
|
| 122 |
+
[domain, fields, groupby]
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
def search(self, model: str, domain: List = None, limit: int = None) -> List[int]:
|
| 126 |
+
"""Recherche des IDs d'enregistrements"""
|
| 127 |
+
if not self.is_connected():
|
| 128 |
+
raise Exception("Non connecté à Odoo")
|
| 129 |
+
|
| 130 |
+
domain = domain or []
|
| 131 |
+
options = {}
|
| 132 |
+
if limit:
|
| 133 |
+
options['limit'] = limit
|
| 134 |
+
|
| 135 |
+
return self.models.execute_kw(
|
| 136 |
+
self.db, self.uid, self.password,
|
| 137 |
+
model, 'search',
|
| 138 |
+
[domain],
|
| 139 |
+
options
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
def create(self, model: str, values: Dict) -> int:
|
| 143 |
"""Crée un enregistrement"""
|
| 144 |
if not self.is_connected():
|