Skip to content

Instantly share code, notes, and snippets.

View oerp-odoo's full-sized avatar

Andrius Laukavičius oerp-odoo

  • Lithuania
View GitHub Profile
@oerp-odoo
oerp-odoo / rpc_odoo_module.py
Last active November 28, 2022 12:32
Install/Upgrade/Uninstall modules via Odoo RPC
#!/usr/bin/env python3
"""Install/update/uninstall specified odoo module."""
import odoorpc
import argparse
USER = 'admin'
PASSWORD = 'admin'
HOST = '127.0.0.1'
PORT = '8069'
@oerp-odoo
oerp-odoo / keybase.md
Created January 6, 2021 15:06
keybase with github

Keybase proof

I hereby claim:

  • I am oerp-odoo on github.
  • I am andriusl (https://keybase.io/andriusl) on keybase.
  • I have a public key ASCl2vbdquiVcHo_odMUiXWbWGt4ElLUaVGhkOLLqdhXFAo

To claim this, I am signing this object:

@oerp-odoo
oerp-odoo / odoo-transfer-to-new-loc.py
Last active August 24, 2018 15:07
Move available stock to new location (that is created)
# flake8: noqa
"""
This module must be run when Odoo environment is started using shell, otherwise variables won't be recognized.
"""
# Models.
StockLocation = env['stock.location']
StockQuant = env['stock.quant']
IrModelData = env['ir.model.data']
# Locations to do transfer.
@oerp-odoo
oerp-odoo / delete_git_submodule.md
Created August 16, 2018 08:12 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@oerp-odoo
oerp-odoo / regex_sample_1.txt
Created August 14, 2018 14:28
regex - match text between other text or elements
(?<=name="name">)(.*)(?=<)
Would match content inside tags like (would match "some content"):
<field name="name">some content</field>
@oerp-odoo
oerp-odoo / recompute_odoo_field.py
Last active August 11, 2018 11:36
Recompute Odoo field from shell
# python3 odoo-bin shell -c odoo.conf -d <database>
model = env['some.model']
env.add_todo(model._fields['field_name'], model.search([]))
model.recompute()
env.cr.commit()
git submodule update --recursive --remote --merge --init
@http.route('/web/excel.report/xls', type='http', auth="user")
def download_xls_report(self, model, id):
"""Handle download for XLS reports."""
# Prepare report wizard
Model = request.registry[model]
cr, uid, context = request.cr, request.uid, request.context
id = int(id)
wizard = Model.browse(cr, uid, id, context=context)
# Get filename
filename = wizard.get_filename()