Odoo Help


Is there a beginners' guide to writing a patch?

on 8/7/13, 5:43 AM 2,947 views


I have not yet written a patch, but have been able to modify some bits of code to get the results I need.

I would like to be able to write these into a patch so that it is easy to apply the changes to files easily after an update. Is there a simple guide to explain how to do this? I notice the patch file works on a basis of removing ("-") and adding ("+") lines of code within the existing file. However I am not certain on how to specify the area where the code should be removed or inserted.

Any tips would be much appreciated!

Thanks, Lawrence

Do you mean a custom module ?

on 8/7/13, 6:36 AM

Hello, Use following on terminal : First reach to the folder using 'cd' command where you have made changes. (where addons,server,web files are there)

bzr diff >~/Desktop/patch

Here, /Desktop/test is path where we want to store our file. And patch is the name of file to give. Thanks.

Hiral Patel (hip)
on 8/7/13, 6:52 AM

Hi Xsias, hi Hiral. What I mean is a patch file to amend the code in an existing .py file (in my case I want to add a confirmation button - see http://help.openerp.com/question/8623/warn-user-before-cancelling-a-quotation/). This code is easy to add by manually editing the file with a text editor but is time consuming as I must copy and paste the code in each time I update.

on 8/7/13, 9:09 AM

Yes, so you need a custom module.

on 8/7/13, 9:23 AM

Eclipse is good for it. Select folder -> right click on it -> Team -> Apply Patch -> Select file(Patch file) -> Finish.

Hiral Patel (hip)
on 8/7/13, 9:31 AM
On 8/7/13, 9:34 AM

To create a custom module, you need to create a folder MyModuleName on your folder add-on. On this folder you creae folders/files like this :







-*- encoding: utf-8 -*-
import nameOfMyPyFile


# -*- encoding: utf-8 -*-
    "name": "MyModule",
    "version": "1.0",
    "author": "You",
    "website": "",
    "sequence": 0,
    "certificate": "",
    "license": "",
    "depends": [
    "category": "Generic Modules",
    "complexity": "easy",
    "description": """

    "test": [
    "js": [
    "css": [
    "qweb": [
    "demo_xml": [
    "images": [
    "init_xml": [
    "update_xml": [
    "auto_install": False,
    "installable": True,
    "application": False,


He inherit the base .py and contains your code.

How do you modify or change some .js lines without adding the whole .js again to the module?

Luis Leiva
on 9/13/13, 4:51 PM

Good question, i don't know.

For me, you need to edit the core code.

on 9/16/13, 12:51 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 8/7/13, 5:43 AM
Seen: 2947 times
Last updated: 3/16/15, 8:10 AM