Skip to content

Instantly share code, notes, and snippets.

@nvn-odoo
nvn-odoo / odoo_upgrade_request.sh
Created July 19, 2019 11:29 — forked from olilau/odoo_upgrade_request.sh
Creates an Odoo upgrade request and uploads the database dump using SFTP.
#!/bin/bash
set -e
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq but it's not installed. Aborting."; exit 1; }
MAX_CMD_TRIES=100
BASE_WORK_DIR=${HOME}/odoo_upgrade_request
DO
$do$
declare
v_product_product_id int;
v_product_category_id int;
v_product_name varchar;
v_stock_valuation_account int;
v_company_id int;
v_stock_qty_with_date float;
@nvn-odoo
nvn-odoo / check_diffs.sql
Last active February 7, 2019 12:46
check differences between two databases
-- CHECK DIFF BEWEEN TWO DATABASES (A and B)
-----------------------------------------------
/*********************************************
* 1.0 CREATE THE APPROPRIATE CONFIGURATION
*********************************************/
-- create a new database AB (from terminal)
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),
quants = env['stock.quant'].search([])
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),
@olilau
olilau / odoo_upgrade_request.sh
Last active October 1, 2021 09:40
Creates an Odoo upgrade request and uploads the database dump using SFTP.
#!/bin/bash
set -e
VERSION="0.3"
MAX_CMD_TRIES=30
MAX_SFTP_TRIES=100
# check sftp has the "put -a" command:
if man sftp | grep ' put.*local-path.*remote-path' | grep -q afPpr ;