TypeScript Vue Tour Part 1

1. The Plan

This is the first part of a series of tours exploring progressive Web applciation (PWA) deveopmenet using TypeScript and Vue. The goal is to re-implemente the Google’s exemplary Weather PWA described in https://developers.google.com/web/fundamentals/getting-started/codelabs/your-first-pwapp/.

Read More

VS Code notes

1. Introduction

VS is a code editor at its heart. You can open up to three editors side by side.

Read More

Bootstrap v4 Study Note

1. Setup

Bootstrap requires jQuery, Tether and its JavaScript plugin to work. It uses H5 doctype and viewport meta tag. A sample template is as the following (based on https://v4-alpha.getbootstrap.com/getting-started/introduction/):

Read More

React Ecosystem

There are many pieces in the react ecosystem, either direcly or indirectly needed to build a great web application.

Read More

Querydsl Note

This is a note summurizing the key concepts and practices of QueryDSL. It is based on http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/ and https://leanpub.com/opinionatedjpa/read.

Read More

GraphQL Java Note

The GraphQL Java implementation https://github.com/graphql-java/graphql-java is not documented well. Its source code is not documented at all. We have to learn it from its source code.

Read More

GraphQL Explained

GraphQL is a query language created by Facebook in 2012. It describes the schema and operations of a hierarchical data model for client-server applications. It is a specification lanuaged describing the type system and interactions between a server application and its clients. It publishes server capabilities with type valication and let client specify the returned data at field-level granularity. GraphQL is rather new and good documents are desired. Here we try to understand and summary the concepts and usage patterns of GraphQL.

Read More

Chakram REST API testing

1. Chakram Introduction

Chakram is a framework to test JSON REST endpoint. It use promises and offers a BDD testing style. It is built on node.js, mocha test framework and chai BDD assertion library. It use the request lib to provide comprehensive REST request capaiblities.

Read More

Product Design

1. Overview

In any e-commerce application, the product, product variant and category are core entities that define many features of a Web site. This article describes the product-related design of http://dev.commercetools.com/.

Read More

Product Price Design

1. Price Calculation

In http://dev.commercetools.com/, a product variant can have a set of prices represented as an array of Price values. A price is defined with a scope (customer group, channel and country) and/or an optional period (valid from and/or valid to). A price has a regular value and an optional discounted price. When calculate a price, there are two steps: price selection and discount checking.

Read More

Basic Kubernetes

K8s Architecture

First we need a set of computers, physic or virtual, to urn K8s, these computers are called node in K8s. Nodes are often organized as a cluster to provide high availability and scalability. In each node there is a kubelet node agent, a kube-proxynetwork proxy and a docker daemon to run one or more pods. In K8s, a pod consists of a set of docker containers. A pod is the minimum management unit to create, run and schedule.

Read More

Spring Security with OAuth2

For a cloud-native application, security is a big concern and brings new challenges. Luckily, the “silver bullet”, i.e, the open source software, makes life so easy. This time, it’s Spring security and OAuth2.

Read More

Application Logging Tips

为什么需用Logging

理解了logging的目的,那么所有的Tips都不难理解了。当软件变得复杂,尤其是分布式异步并行计算程序比如Cloud Native程序成为主流是,基于IDE单步执行的Debug无法工作。而且多数的bug通常发生在用户现场的生产系统,这时候能够像单步执行那样清晰的给出程序执行各个重要节点的完整状态就非常宝贵。我的经验证明,有了好的application logging,多数的debug工作就变得轻而易举:如果所有的关键步骤的状态数据都有记录,错误的原因也就清楚了。

Read More

简单看板开发流程

1. 需要简化

看板的使用有一个学习和适应过程,多层看板流程的想法比较理想,缺点是层次带来了复杂性。在启动阶段我们希望流程管理和流程工具尽可能简单。我们跳过比较正式复杂的看板系统比如JIRA,其中的一个主要考量就是希望看板工具简单、好用。采用Trello这个极简的看板系统可以达到开发流程可视化的主要目的。同时在开始阶段,我们只采用一层看板,看板把每个人近期几个月内的工作放在一个标准化的简单流程里面。

Read More

用看板管理软件开发流程

1. Scrum or Kanban?

做了多年软件,感觉软件开发的过程是没办法“管理”的。软件开发从本质上讲是一种理想的逻辑思维工作, 高水平的软件开发很大程度上取决于程序员个人的主动性、工作能力和学习能力。可是实际工作中又需要产品开发过程的可视化。可视化意味着:

  1. 做基本的产品功能计划。计划包括任务分解和时间估算。
  2. 了解产品开发过程中任务的完成状态。其中最主要的是工作量、开发速率和开发瓶颈。
Read More

Python Docstring Using Sphinx and reStructuredText

Introduction

Python is a dynamic script programming language that has no static type checking. For Python, documentation becomes very important for developers to understand and use Python components such as modules, classes, functions and methods.

Read More

Odoo Start Process

The Boot Code

In Odoo 8.0, odoo.py, openerp-gevent and openerp-server execute import openerp and openerp.cli.main() method to boot the Odoo backend services.

Read More

How Does Odoo Load Addons and Modules

Method load_addons in http.py

Odoo starts loading addons when it receives the first HTTP request. In the __call__ method of http.py file, it calls load_addons to load all addons in the specified addon paths.

Read More

Odoo Cron Job

Odoo makes running a background job easy: simply insert a record to ir.cron table and Odoo will execute it as defined. The ir.cron table is defined in openerp/addons/base/ir/ir_cron.py file. It has the following columns:

Read More

Understand Odoo Model Part 3

1 Old-style Fields

Because most Odoo addons still use old-style field definition. It is necessary for a developer to understand the old old-style field definitions. These fields are in openerp/osv/field.py file.

Read More

Odoo Product Model

1 Overview

The core Odoo addon for product is called product (“Products & Pricelists”). The followings are features listed in the module description:

Read More

Understand Odoo Model Part 2

1 Fields in Odoo Model

A model represents a business entity that is stored in a database. Fields represent entity properties and the corresponding table columns in the database. Odoo also uses fields representing entity relationships. Odoo 8.0 introduces a new field syntax but keeps the old syntax for backward compatibility. Here we focus on the new syntax defined in openerp/fields.py.

Read More

Understand Odoo Model Part 1

1 Not An Easy Task

Model is the core concept in Odoo. A model is a Python class that represents a business entity and related operations. All Odoo business entities are implemented as models that are stored in a backend PostgreSQL database. Understanding how it works is a must for an Odoo developer.

Read More

Understand Odoo Environment

In Odoo 8.0, openerp/api.py defines two classes managing “environments” of a database access for a client request: the Environments class and the Environment class.

Read More

Replacing Decorated Methods in Python

The Question

In my application, I need to replace a decorated class method using a new function that performs some actions before and after the replaced method but still keep the same replaced method interface, i.e., taking same input and return the same output. In general programming terms, I implement a decorator pattern for some “decorated” Python methods.

Read More

Guide to Odoo Community Association Quality Tools Part 2

In the [Guide to Odoo Community Association Quality Tools Part 1] (http://www.mindissoftware.com/2014/10/28/guide-Odoo-OCA-QA-tools-part1/), we discussed how to link a GitHub repository with the OCA quality tools to run tests and code coverage. Here we investigate the implementation details of the Odoo test framework and the OCA quality tools.

Read More

Guide to Odoo Community Association Quality Tools Part 1

Choices of Odoo 8.0 Testing Services

Odoo 8.0 has a new test framework/platform called runbot. It looks good but is evolving and lack of documents. On the other hand, Odoo Community Association (OCA) has a Maintainer Quality Tools project that helps to ensure the quality of Odoo addons. It can run module unit tests and report test coverage. It uses Travis CI continuous integration service and Coveralls code coverage reporting service. Both are free services for open source projects. Both services support GitHub integration and automatically run test and report results to GitHub projects. This article describe the the setup of these two service for an Odoo addon project.

Read More

Guide to boto Amazon MWS Python package

Overview

boto is a Python package for Amazon web service APIs. It makes it easy to use Amazon marketplace web service (MWS) APIs by providing supporting functions such as connection pool, auto-retry, response parsing and iterative calls for extra data. However, there is no document and the Python code is not well commented. Below is an attempt to summarize boto implementation and usage.

Read More

How to save and load module configuration in Odoo

Finding a Solution

Often a custom Odoo module needs some parameters to run. However, [my previous analysis of Odoo’s own implementation] (http://www.mindissoftware.com/2014/10/16/Odoo-Module-configuration-settings/) doesn’t give me an obvious answer on how to implement a configuration function for a custom module. Nonetheless, the analysis helps me to evaluate answers I found online today.

Read More

Create Odoo 8.0 Ubuntu Docker Image

Overview

Odoo 8 was released on 09/18/2014. We created a self-contained [Odoo 8.0 Docker image] (https://registry.hub.docker.com/u/yingliu4203/odoo8nightly/) that was installed from [the latest Odoo 8.0 nightly build] (http://nightly.openerp.com/8.0/nightly/deb/). The Docker image building source code is in [a GitHub repository] (https://github.com/YingLiu4203/odoo-v8-nightly-docker).

Read More

Run and Debug Odoo using PyCharm in Ubuntu

As a beginner, being able to debug through the Odoo source code is a great learning experience. PyCharm Professional Edition is a wonderful tool to develop/debug Python applications. The following are steps to run/debug Odoo using PyCharm in Ubuntu. Though not officially stated, running Odoo in Windows is not a good idea. I started with a freshly installed Ubuntu 14.04.1 LTS desktop.

Read More

Python Package and Import

In Python, a module is a file that contains Python code. The first time a module is imported, all statements in the module are executed from top to bottom. The variables, functions, and classes declared in the module become accessible to other modules. Later imports, unless using reload(), use the already-imported module without executing the module code again. The module concept is easy to understand.

A project usually has many modules. A package is a directory that contains modules and a __init__.py file. The package concept means two things in Python:

Read More

Odoo connector events

Odoo Connector (https://github.com/OCA/connector) is a framework used to integrate Odoo with other systems. It makes development of bi-direction data synchronization easier. Among other functions, it hooks into Odoo data model to intercept record creation, update and deletion calls and raise corresponding events that can be subscribed by an integration application. In this blog we look at the implementation details of its event mechanism.

Read More

Python Decorator Tutorial

Decorator is widely used in Python programs. As a beginner Python developer, I am curious about the theories and typical uses of a decorator. This blog summarizes what I learned about decorator.

Read More

Build a new addon in Odoo V8 part 2

This is the second part of the Open Adademy example. In part one we created a simple module layout. This part demonstrates model relationships, default values and the use of onchange api. All code are listed at the end of this blog. When making a change of an addon code, you may need to re-start Odoo or update the addon or do both.

Read More

Create Odoo V8 Docker image from GitHub source code using shell script

The following steps are based on [ANDRÉ SCHENKELS’s installation script.] (https://github.com/aschenkels-ictstudio/openerp-install-scripts/blob/master/odoo-v8/ubuntu-14-04/odoo_install.sh) with below changes. Some changes such as local settings are necessary because we starts from a base Ubuntu operating system.

Read More

Install Odoo V8 in Ubuntu from GitHub source code

This blog is based on [ANDRÉ SCHENKELS’s post.] (http://www.schenkels.nl/2014/07/install-odoo-v8-0-from-github-ubuntu-14-04-lts-formerly-openerp/) The whole process can be fully automated by download and run [his installation script.] (http://www.schenkels.nl/2014/07/odoo-v8-install-script-github-ubuntu-14-04-lts/)

Read More