Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
9047 Vizualizări

Hello,

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

Imagine profil
Abandonează

Do you mean a custom module ?

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.

Autor

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.

Yes, so you need a custom module.

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

Cel mai bun răspuns

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 :

MyFolderName

-i18n

-security

--ir.model.access.csv

--security.xml

-__init__.py

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

-__openerp__.py

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

    """,
    "test": [
    ],
    "js": [
    ],
    "css": [
    ],
    "qweb": [
    ],
    "demo_xml": [
    ],
    "images": [
    ],
    "init_xml": [
    ],
    "update_xml": [
        "security/ir.model.access.csv",
        "security/security.xml",
    ],
    "auto_install": False,
    "installable": True,
    "application": False,
}

-nameOfMyPyFile.py

He inherit the base .py and contains your code.

Imagine profil
Abandonează

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

Good question, i don't know.

For me, you need to edit the core code.

Related Posts Răspunsuri Vizualizări Activitate
12
aug. 18
16506
7
iul. 17
4306
2
mai 24
6514
0
sept. 23
1817
1
aug. 23
2902