Se usará Ubuntu 16.04 como sistema base
sudo apt-get update
sudo apt-get install git python-dev libpq-dev python-pip python-virtualenv libsasl2-dev libldap2-dev libssl-dev \| #!/usr/bin/env python | |
| # | |
| # Very basic example of using Python and IMAP to iterate over emails in a | |
| # gmail folder/label. This code is released into the public domain. | |
| # | |
| # RKI July 2013 | |
| # http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/ | |
| # | |
| import sys | |
| import imaplib |
| import os | |
| def split(filehandler, delimiter=',', row_limit=10000, | |
| output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
| """ | |
| Splits a CSV file into multiple pieces. | |
| A quick bastardization of the Python CSV library. | |
| Arguments: |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Script to bootstrap an Odoo database (8.0).""" | |
| import odoorpc | |
| # Odoo connection | |
| SUPER_PWD = 'admin' | |
| HOST = 'localhost' | |
| PORT = 8069 | |
| DB = 'my_db' |
| # -*- coding: utf-8 -*- | |
| from odoo import http | |
| from odoo.http import request | |
| from odoo.addons.web.controllers.main import serialize_exception,content_disposition | |
| import base64 | |
| class Binary(http.Controller): | |
| @http.route('/web/binary/download_document', type='http', auth="public") |
| # This came up with a huge problem for days, but i resolve it. | |
| # The main problem is the limitation in form in odoo. Mostly of this are not in the official documentation, | |
| # so maybe you will feel a bit blind sometimes, but I feel you bro. | |
| # Basically works for partner_id relation for many2one | |
| # PART ONE | |
| # Create a class res_partner.py | |
| class ResPartner(models.Model): | |
| """This part is the easy part, @api.model overrides to name_get (optional) and name_search.""" | |
| _inherit = 'res.partner' |
| import xmlrpc.server as Server | |
| import ssl | |
| class Utils(object): | |
| def __init__(self, host, db_name, user, password): | |
| ssl.match_hostname = lambda cert, hostname: True | |
| self._host = host | |
| self._db = db_name |
| quants = env['stock.quant'].search([]) | |
| move_line_ids = [] | |
| warning = '' | |
| for quant in quants: | |
| move_lines = env["stock.move.line"].search([ | |
| ('product_id', '=', quant.product_id.id), | |
| ('location_id', '=', quant.location_id.id), | |
| ('lot_id', '=', quant.lot_id.id), | |
| ('package_id', '=', quant.package_id.id), | |
| ('owner_id', '=', quant.owner_id.id), |
| class TestCustom(Test): | |
| def __init__(self, methodName='runTest'): | |
| super(TestCustom, self).__init__(methodName) | |
| # Skip original test from inherited class | |
| custom_attributes = set(dir(TestCustom)) - set(dir(Test)) | |
| custom_test_methods = [ | |
| name for name in custom_attributes | |
| if name.startswith('test_') and callable(getattr(self, name))] | |
| if methodName not in custom_test_methods: | |
| method = getattr(self, methodName) |
| OE_USER="odoo" | |
| OE_PORT="8069" | |
| WEBSITE_NAME="_" | |
| LONGPOLLING_PORT="8072" | |
| ADMIN_EMAIL="test@example.com" | |
| OE_CONFIG="${OE_USER}-server" | |
| #-------------------------------------------------- | |
| # Install Nginx if needed | |
| #-------------------------------------------------- |