Skip to content

Instantly share code, notes, and snippets.

Field JS

odoo.define('academy.field', (require) => {

    const registry = require('web.field_registry');
    const Widget = require('web.AbstractField');

Pos order py

    @api.model
    def _order_fields(self, ui_order):
        res = super()._order_fields(ui_order)
        res['carrier_id'] = ui_order.get('carrier_id', False)
        return res

Models js

/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@JCGit2018
JCGit2018 / expected_exception_testRPC_and_geth.js
Created May 6, 2019 22:15 — forked from xavierlepretre/expected_exception_testRPC_and_geth.js
When TestRPC and Geth throw, they behave in a different manner. This Gist is an example on how to cover such a situation.
"use strict";
/**
* @param {!Function.<!Promise>} action.
* @param {!Number | !string | !BigNumber} gasToUse.
* @returns {!Promise} which throws unless it hit a valid error.
*/
module.exports = function expectedExceptionPromise(action, gasToUse) {
return new Promise(function (resolve, reject) {
try {
@JCGit2018
JCGit2018 / ejercicios.md
Created February 8, 2019 12:51 — forked from a0viedo/ejercicios.md
Ejercicios para el repaso de estructuras en JavaScript.

#Strings

Ejercicio 1

Hacer una función que reciba dos parámetros del tipo string. La función deberá retornar la cantidad de apariciones que tiene el segundo parámetro en el primer parámetro. Ejemplo:

console.log(contarOcurrencias("sarasa", "a")); // imprime 3
console.log(contarOcurrencias("sarasa", "z")); // imprime 0

Ejercicio 2

Hacer una función que reciba una string y retorne la misma string pero agregando después de cada caracter su í­ndice correspondiente. Es decir, que retorne la misma string transformada de la siguiente forma:

# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby