Skip to content

Commit 73294c4

Browse files
git commit --no-gpg-sign
1 parent c86772c commit 73294c4

File tree

8 files changed

+75
-245
lines changed

8 files changed

+75
-245
lines changed

Dockerfile

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,15 @@
11
# Odoo 8.0 Dockerfile (Python 2.7)
22
FROM python:2.7-slim
33

4-
# Install system dependencies
5-
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends \
7-
git \
8-
build-essential \
9-
python-dev \
10-
libxml2-dev \
11-
libxslt1-dev \
12-
zlib1g-dev \
13-
libsasl2-dev \
14-
libldap2-dev \
15-
libssl-dev \
16-
libjpeg-dev \
17-
libpq-dev \
18-
postgresql-client \
19-
node-less \
20-
npm \
21-
wget \
22-
gdebi \
23-
ca-certificates \
24-
fonts-dejavu-core \
25-
fonts-dejavu-extra \
26-
gsfonts \
27-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/*
4+
# Set the working directory
5+
WORKDIR /app
286

29-
# Install Python dependencies
30-
RUN pip install --no-cache-dir \
31-
psycopg2==2.7.7 \
32-
babel==1.3 \
33-
passlib==1.6.2 \
34-
werkzeug==0.9.4 \
35-
decorator==3.4.0 \
36-
python-dateutil==2.2 \
37-
pytz==2014.10 \
38-
six==1.8.0 \
39-
lxml==3.4.1 \
40-
mako==1.0.1 \
41-
jinja2==2.7.3 \
42-
PyPDF2==1.26.0 \
43-
pyparsing==2.0.1 \
44-
reportlab==3.1.44 \
45-
requests==2.6.0 \
46-
docutils==0.12 \
47-
feedparser==5.1.3 \
48-
gevent==1.0.2 \
49-
greenlet==0.4.5 \
50-
html2text==2014.4.5 \
51-
psutil==2.2.0 \
52-
psycogreen==1.0 \
53-
pydot==1.0.2 \
54-
pyldap==2.4.28 \
55-
vobject==0.6.6 \
56-
xlwt==0.7.5 \
57-
xlrd==0.9.3 \
58-
xlutils==1.7.1 \
59-
num2words==0.5.4 \
60-
pillow==2.6.1 \
61-
simplejson==3.17.6
7+
# Copy your application files into the container
8+
COPY . /app
629

63-
# Clone Odoo 8.0 from the official repository
64-
ARG ODOO_COMMIT=9e8f70e4849b0eeaca8b5cf51372ecfa23dc561b
65-
RUN git clone --branch 8.0 https://www.github.com/odoo/odoo /odoo \
66-
&& cd /odoo \
67-
&& git checkout ${ODOO_COMMIT}
10+
# Install any required Python dependencies
11+
RUN pip install --no-cache-dir -r requirements.txt
12+
RUN pip install flask==1.1.2 requests==2.25.1
6813

69-
# Use bash as the default shell
70-
SHELL ["/bin/bash", "-c"]
71-
72-
# Add entrypoint script
73-
COPY ./entrypoint.sh /entrypoint.sh
74-
RUN chmod +x /entrypoint.sh
75-
76-
# Set the entrypoint
77-
ENTRYPOINT ["/entrypoint.sh"]
78-
79-
# Expose Odoo port
80-
EXPOSE 8069
81-
82-
# Odoo version
83-
LABEL version="8.0.1.0"
84-
85-
# Add SSH agent setup for persistent Git operations
86-
RUN apt-get update && apt-get install -y --no-install-recommends openssh-client \
87-
&& mkdir -p /root/.ssh && chmod 0700 /root/.ssh
88-
89-
# Ensure SSH agent is started
90-
RUN echo 'eval $(ssh-agent -s)' >> /root/.bashrc
14+
# Set the default command to run your application
15+
CMD ["python", "your_script.py"]

Python-2.7.18.tgz

16.7 MB
Binary file not shown.

import openerplib

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import openerplib
2+
3+
# Establish a connection to the OpenERP server
4+
connection = openerplib.get_connection(
5+
hostname="localhost", # Replace with your server's hostname or IP
6+
protocol="jsonrpc", # Use JSON-RPC protocol
7+
port=6080, # Replace with the correct port
8+
database="my_database", # Replace with your database name
9+
login="admin", # Replace with your username
10+
password="admin" # Replace with your password
11+
)
12+
13+
# Access the 'res.users' model
14+
user_model = connection.get_model("res.users")
15+
16+
# Search for a user with login 'admin'
17+
ids = user_model.search([("login", "=", "admin")])
18+
19+
# Read the user's information
20+
if ids:
21+
user_info = user_model.read(ids[0], ["name"])
22+
print(f"User Name: {user_info['name']}") # Output: "Administrator"
23+
else:
24+
print("No user found with login 'admin'.")

odoo.py

100644100755
Lines changed: 0 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,161 +0,0 @@
1-
#!/usr/bin/env python
2-
#----------------------------------------------------------
3-
# odoo cli
4-
#
5-
# To install your odoo development environement type:
6-
#
7-
# wget -O- https://raw.githubusercontent.com/odoo/odoo/8.0/odoo.py | python
8-
#
9-
# The setup_* subcommands used to boostrap odoo are defined here inline and may
10-
# only depends on the python 2.7 stdlib
11-
#
12-
# The rest of subcommands are defined in odoo/cli or in <module>/cli by
13-
# subclassing the Command object
14-
#
15-
#----------------------------------------------------------
16-
import os
17-
import re
18-
import sys
19-
import subprocess
20-
21-
GIT_HOOKS_PRE_PUSH = """
22-
#!/usr/bin/env python2
23-
import re
24-
import sys
25-
if re.search('github.com[:/]odoo/odoo.git$', sys.argv[2]):
26-
print "Pushing to /odoo/odoo.git is forbidden, please push to odoo-dev, use --no-verify to override"
27-
sys.exit(1)
28-
"""
29-
30-
def printf(f,*l):
31-
print "odoo:" + f % l
32-
33-
def run(*l):
34-
if isinstance(l[0], list):
35-
l = l[0]
36-
printf("running %s", " ".join(l))
37-
subprocess.check_call(l)
38-
39-
def git_locate():
40-
# Locate git dir
41-
# TODO add support for os.environ.get('GIT_DIR')
42-
43-
# check for an odoo child
44-
if os.path.isfile('odoo/.git/config'):
45-
os.chdir('odoo')
46-
47-
path = os.getcwd()
48-
while path != os.path.abspath(os.sep):
49-
gitconfig_path = os.path.join(path, '.git/config')
50-
if os.path.isfile(gitconfig_path):
51-
release_py = os.path.join(path, 'openerp/release.py')
52-
if os.path.isfile(release_py):
53-
break
54-
path = os.path.dirname(path)
55-
if path == os.path.abspath(os.sep):
56-
path = None
57-
return path
58-
59-
def cmd_setup_git():
60-
git_dir = git_locate()
61-
if git_dir:
62-
printf('git repo found at %s',git_dir)
63-
else:
64-
run("git", "init", "odoo")
65-
os.chdir('odoo')
66-
git_dir = os.getcwd()
67-
if git_dir:
68-
# push sane config for git < 2.0, and hooks
69-
#run('git','config','push.default','simple')
70-
# alias
71-
run('git','config','alias.st','status')
72-
# merge bzr style
73-
run('git','config','merge.commit','no')
74-
# pull let me choose between merge or rebase only works in git > 2.0, use an alias for 1
75-
run('git','config','pull.ff','only')
76-
run('git','config','alias.pl','pull --ff-only')
77-
pre_push_path = os.path.join(git_dir, '.git/hooks/pre-push')
78-
open(pre_push_path,'w').write(GIT_HOOKS_PRE_PUSH.strip())
79-
os.chmod(pre_push_path, 0755)
80-
# setup odoo remote
81-
run('git','config','remote.odoo.url','https://github.com/odoo/odoo.git')
82-
run('git','config','remote.odoo.pushurl','git@github.com:odoo/odoo.git')
83-
run('git','config','--add','remote.odoo.fetch','dummy')
84-
run('git','config','--unset-all','remote.odoo.fetch')
85-
run('git','config','--add','remote.odoo.fetch','+refs/heads/*:refs/remotes/odoo/*')
86-
# setup odoo-dev remote
87-
run('git','config','remote.odoo-dev.url','https://github.com/odoo-dev/odoo.git')
88-
run('git','config','remote.odoo-dev.pushurl','git@github.com:odoo-dev/odoo.git')
89-
run('git','remote','update')
90-
# setup 8.0 branch
91-
run('git','config','branch.8.0.remote','odoo')
92-
run('git','config','branch.8.0.merge','refs/heads/8.0')
93-
run('git','checkout','8.0')
94-
else:
95-
printf('no git repo found')
96-
97-
def cmd_setup_git_dev():
98-
git_dir = git_locate()
99-
if git_dir:
100-
# setup odoo-dev remote
101-
run('git','config','--add','remote.odoo-dev.fetch','dummy')
102-
run('git','config','--unset-all','remote.odoo-dev.fetch')
103-
run('git','config','--add','remote.odoo-dev.fetch','+refs/heads/*:refs/remotes/odoo-dev/*')
104-
run('git','config','--add','remote.odoo-dev.fetch','+refs/pull/*:refs/remotes/odoo-dev/pull/*')
105-
run('git','remote','update')
106-
107-
def cmd_setup_git_review():
108-
git_dir = git_locate()
109-
if git_dir:
110-
# setup odoo-dev remote
111-
run('git','config','--add','remote.odoo.fetch','dummy')
112-
run('git','config','--unset-all','remote.odoo.fetch')
113-
run('git','config','--add','remote.odoo.fetch','+refs/heads/*:refs/remotes/odoo/*')
114-
run('git','config','--add','remote.odoo.fetch','+refs/tags/*:refs/remotes/odoo/tags/*')
115-
run('git','config','--add','remote.odoo.fetch','+refs/pull/*:refs/remotes/odoo/pull/*')
116-
117-
def setup_deps_debian(git_dir):
118-
debian_control_path = os.path.join(git_dir, 'debian/control')
119-
debian_control = open(debian_control_path).read()
120-
debs = re.findall('python-[0-9a-z]+',debian_control)
121-
debs += ["postgresql"]
122-
proc = subprocess.Popen(['sudo','apt-get','install'] + debs, stdin=open('/dev/tty'))
123-
proc.communicate()
124-
125-
def cmd_setup_deps():
126-
git_dir = git_locate()
127-
if git_dir:
128-
if os.path.isfile('/etc/debian_version'):
129-
setup_deps_debian(git_dir)
130-
131-
def setup_pg_debian(git_dir):
132-
cmd = ['sudo','su','-','postgres','-c','createuser -s %s' % os.environ['USER']]
133-
subprocess.call(cmd)
134-
135-
def cmd_setup_pg():
136-
git_dir = git_locate()
137-
if git_dir:
138-
if os.path.isfile('/etc/debian_version'):
139-
setup_pg_debian(git_dir)
140-
141-
def cmd_setup():
142-
cmd_setup_git()
143-
cmd_setup_deps()
144-
cmd_setup_pg()
145-
146-
def main():
147-
# regsitry of commands
148-
g = globals()
149-
cmds = dict([(i[4:],g[i]) for i in g if i.startswith('cmd_')])
150-
# if curl URL | python2 then use command setup
151-
if len(sys.argv) == 1 and __file__ == '<stdin>':
152-
cmd_setup()
153-
elif len(sys.argv) == 2 and sys.argv[1] in cmds:
154-
cmds[sys.argv[1]]()
155-
else:
156-
import openerp
157-
openerp.cli.main()
158-
159-
if __name__ == "__main__":
160-
main()
161-

odoo_authenticate.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import xmlrpc.client
2+
3+
# Define the OpenERP server connection details
4+
url = "http://localhost:8069"
5+
db = "my_database" # Replace with your database name
6+
username = "admin" # Replace with your username
7+
password = "admin" # Replace with your password
8+
9+
# Authenticate with the OpenERP server
10+
common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common")
11+
uid = common.authenticate(db, username, password, {})
12+
if uid:
13+
print(f"Successfully authenticated. User ID: {uid}")
14+
else:
15+
print("Authentication failed.")

openerp_connection.py

Whitespace-only changes.

openerp_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import xmlrpc.client
2+
3+
# Configuration
4+
url = "http://localhost:8069"
5+
db = "my_database" # Replace with your database name
6+
username = "admin" # Replace with your username
7+
password = "admin" # Replace with your password
8+
9+
# Authenticate
10+
common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common")
11+
uid = common.authenticate(db, username, password, {})
12+
13+
if uid:
14+
print(f"Authenticated to Odoo as {username} (uid: {uid})")
15+
# Example: search for partners
16+
models = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object")
17+
partners = models.execute_kw(
18+
db, uid, password,
19+
'res.partner', 'search_read',
20+
[[]], {'fields': ['name'], 'limit': 5}
21+
)
22+
print("First 5 partners:", partners)
23+
else:
24+
print("Failed to authenticate to Odoo. Check your credentials.")

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
flask==1.1.2
2+
requests==2.25.1
3+
requests==2.25.1

0 commit comments

Comments
 (0)