Skip to content

Instantly share code, notes, and snippets.

View ryanc-me's full-sized avatar

Ryan Cole ryanc-me

View GitHub Profile
@ryanc-me
ryanc-me / fix.ps
Created July 17, 2022 06:39
An attempt was made to access a socket in a way forbidden by its access permissions.
# run this in an Administrator PowerShell session
reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f
net stop hns
net start hns
@ryanc-me
ryanc-me / fix-parent-path.py
Last active January 20, 2022 20:51
Cleanup
# this script fixes `parent_path` issues on the stock.location table
# the parent_path field should store a slash-delimited list of parent
# locations.
#
# e.g. if we have "Physical Locations (1) / WH (2) / Stock (3)", where
# (id), then the parent_path should be:
# - 1/2/3/
#
# USAGE:
# run this script in an Odoo shell (normally /opt/odoo-scripts/odoo-shell.sh
@ryanc-me
ryanc-me / update_quant_reservation.md
Last active April 15, 2024 03:22
Update to support multiple Odoo versions, bugfixes and tweaks

Update Quant Reservation

"It is not possible to unreserve more products of <product name> than you have in stock"


Sometimes, the reserved_quantity on the stock.quant record for a product becomes out-of-sync with the sum of the reserved quantity in stock.move.lines for that product.

For example, consider:

  • Product A (quant): on-hand = 50, reserved = 10
@ryanc-me
ryanc-me / using_res_config_settings.md
Last active March 27, 2024 19:42
Using res.config.settings in Odoo
@ryanc-me
ryanc-me / criticalcss-bookmarklet-devtool-snippet.js
Created November 2, 2016 07:22 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@ryanc-me
ryanc-me / searchrule.js
Created October 28, 2016 08:53
Pure JavaScript function to find a CSS rule by it's selector string
function findCssRule(selectorString) {
// helper function searches through the document stylesheets looking for @selectorString
// will also recurse through sub-rules (such as rules inside media queries)
function recurse(node, selectorString) {
if (node.cssRules) {
for (var i = 0; i < node.cssRules.length; i++) {
if (node.cssRules[i].selectorText == selectorString) {
return node.cssRules[i].style;
}
if (node.cssRules[i].cssRules) {
@ryanc-me
ryanc-me / odoo.conf
Last active September 26, 2020 22:51
Sample Odoo/Nginx Config (with dbfilter_from_header support)
# Author: Ryan Cole
# Website: https://ryanc.me
# GitHub: https://github.com/MGinshe
# Usage:
# Place this file in /etc/nginx/sites-enabled/
# Make sure you edit the DOMAIN_HERE and SSL_CERTIFICATE, and DB_FILTER sections
#
# Note: This config file is designed to be used with the Odoo dbfilter_from_header module
# https://apps.openerp.com/apps/modules/9.0/dbfilter_from_header/