from openerp import models, fields, api, _
class MyModel(models.Model):
_name = 'mymodule.mymodel'
# Fields are declared as class attributes:
char = fields.Char('Char', 64) # name, size
text = fields.Text('Text')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmlrpclib | |
host, port, db = "localhost", 8069, "demo" | |
user, pwd = "demo", "demo" | |
url = "http://%s:%d/xmlrpc/common" % (host, port) | |
sock = xmlrpclib.ServerProxy(url) | |
uid = sock.login(db, user, pwd) | |
url = "http://%s:%d/xmlrpc/object" % (host, port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
lp_url=lp:project-service | |
bzrdir=bzr-repo | |
gitdir=git-repo | |
rm -rf $bzrdir | |
rm -rf $gitdir | |
bzr init-repo $bzrdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dr@uwebtec:~/work/oca$ git clone [email protected]:guewen/connector-magento.git | |
Cloning into 'connector-magento'... | |
Enter passphrase for key '/home/dr/.ssh/id_rsa': | |
remote: Counting objects: 8438, done. | |
remote: Compressing objects: 100% (2786/2786), done. | |
remote: Total 8438 (delta 5621), reused 8438 (delta 5621) | |
Receiving objects: 100% (8438/8438), 13.37 MiB | 1.63 MiB/s, done. | |
Resolving deltas: 100% (5621/5621), done. | |
dr@uwebtec:~/work/oca$ cd connector-magento/ | |
dr@uwebtec:~/work/oca/connector-magento$ git remote add 7.0-update-stock-1330450 bzr::lp:~camptocamp/openerp-connector-magento/7.0-update-stock-1330450 |
may be written as:
env = Env(cr, uid, context) # cr, uid, context wrapped in env
recs = env[MODEL] # retrieve an instance of MODEL
recs = recs.search(DOMAIN) # search returns a recordset
for rec in recs: # iterate over the records
print rec.name
recs.write(VALUES) # update all records in recs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git add remote odoo https://github.com/odoo/odoo.git | |
# git fetch odoo 8.0 | |
dropdb v8mig0 | |
createdb v8mig0 | |
#pg_restore -d v8mig -O ./v8mig-at-v7.sql | |
git checkout 7.0 | |
./openerp-server --stop-after-init -d v8mig0 --addons-path="addons/" -i crm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install python-virtualenv python-dev postgresql-client libldap2-dev libsasl2-dev libssl-dev libpq-dev | |
# python-virtualenv - virtualenv | |
# python-dev - compile python | |
# libldap2-dev libsasl2-dev libssl-dev - for python-ldap | |
# libpq-dev - psycopg2 | |
../ootest-env/bin/python setup.py develop | |
../ootest-env/bin/pip install pypdf # https://github.com/odoo/odoo/pull/1757 | |
$ sudo apt-get install postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqRGX9b3ZNl4x14sOnxU1C3z0ijcffp9z9cUvRgzDiuHzKkZ8CA+KkLuqpBom/kFbb6kc3fW37KQ0bFhEhKfbbU4JN7TnjPidmnoDz667p3FQUUKQzUSqqhURTwYtx4TA/4JNFvEuXFKmONskG2BVrSNzKi+bQvNWl91luOExA/oZ4/71KBI+VSPXXnEihqISGYTkU63FN2Kq8/ZDo8LkmZqqWBRUtM4m5DBIpCeV2PWkbrBNxVtllCfL3s0fHWMBd/Ell3Imvl/4wFD5OrVcUC4SIHeOGned+yF5KVA/eGzqepJZdeSqoKSoNSYBmLGfkFucXifmgX69/sXIWGYnN [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Setup: | |
Assuming Odoo 8.0 sources at ~/odoo: | |
$ cp odoo-sh.py ~/odoo | |
$ cd ~/odoo | |
$ python -i odoo-sh.py | |
Usage example: | |
>>> env = connect('my-db-name') | |
>>> Users = env['res.users'] |
Use Odoo CLI commands. Work dir is the one for the current odoo.py.