Coder Social home page Coder Social logo

odoo-patches's Introduction

A curated and organized collection of functional odoo patches. ("Good bye OCB")

Quickstart

$ curl -fsSL https://git.io/vhzBk -o /tmp/install.sh

$ cd ~  # or to wherever you want this repo to live

# Always read convenience scripts downloaded from the internet
$ cat /tmp/install.sh

# All good?
$ bash /tmp/install.sh

Naming Convention

For this to work as intended, we rely on the following naming convention:

Regex in pcre (php) flavor

>> Regex101 Playground <<

^((?:\d|F)\d\d\d)(?:(-\[(?:(?:|[a-zA-Z_]*?:)(?:\d|F)\d\d\d,)*(?:(?:|[a-zA-Z_]*?:)(?:\d|F)\d\d\d)\])|)::([a-zA-Z-_]*?)\.patch$

Explanation

  • The first token is made of 4 digits is a consecutive number within a given module scope or of a capital letter "F" followed by 3 digits within a global scope. "F" stands for "federated" and represents patches that span multiple modules.
  • Dependencies are expressed by an optional -[...] after the first token. Normally, a dependency is indentified by it's first token (eg. 0001 or F001). If there is a dependency which reaches out to a patch in another module, prepend it with the module name: [module_name/0001] or [module_name/F001]

Patch creation

To generate a diff (in theory):

https://wiki.postgresql.org/wiki/Creating_Clean_Patches Just have a look at the gen-odoo-path script.

To generate a diff (in practice): Essentialy, this is what the quick-start script does.

cd ~
git clone [email protected]:xoes/odoo-patches.git
cd odoo-patches

# Do yourself a favour
echo "export odoo_patch_folder=$(pwd)/patches" >> ~/.bashrc \
&& chmod +x $(pwd)/gen-odoo-patch \
&& cp $(pwd)/gen-odoo-patch /usr/local/bin/ \
&& bash

Check out the version branch you want to submit your patch to and:

# Then, to generate your patch:
gen-odoo-patch [<commit>] [<subpath of your workdir>]

Consider adding some useful description:

This may be some useful description of this patch that
will be ignored by the diff/patch utility. USE IT!

--- a/foo  2002-02-21 23:30:39.942229878 -0800
+++ b/foo  2002-02-21 23:30:50.442260588 -0800
@@ -1,7 +1,6 @@
-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+

Patch application

# Get the patch and try it
payload="$(curl -sL https://raw.githubusercontent.com/xoes/odoo-patches/11.0/patches/module_name/####::Description.patch)"
echo "${payload}" | patch -p1 --dry-run

# Happy?
echo "${payload"} | patch -p1

Credits & License

Based on stewardship by:

License: LGPL-3

TODOs

  • Integrate with hub to fully automate initialization and patch-PRs
  • PR-TEMPLATE -> hub - flow
  • Do always try to pull before generating a patch & detect/imply next patch number
  • Travis
    • Patches apply ceteris paribus cleanly in their order taking the database of last successful general run
    • Generate a new general run with the latest Odoo Upstream code - also - from time-to-time
    • Apply patch only with it's declared dependency tree -> Missing dependency

odoo-patches's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

yelizariev mjabuz

odoo-patches's Issues

Travis CI/CD automated patch validation

  • Regularly triggered
  • Validating clean vs red patches against upstream changes
  • Report on red patches in an easy way. / Open an automated issue for red patches?

gen-odoo-patch in 12 branch doesn't generate correct name

$ gen-odoo-patch HEAD odoo
Patch number ####               : 0001
Patch dependencies (csv, ####)  : 
Patch description [a-zA-Z-]     : support-group-by-week-sunday

	0001::support-group-by-week-sunday.patch

You'd better comply with the naming scheme!

regex: '^((?:\d|F)\d\d\d)-(?:(\[(?:(?:|[a-zA-Z_]*?:)(?:\d|F)\d\d\d,)*(?:(?:|[a-zA-Z_]*?:)(?:\d|F)\d\d\d)\])|)::([a-zA-Z-]*?)\.patch$'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.