PackageTemplates icon indicating copy to clipboard operation
PackageTemplates copied to clipboard

Feature Request / Question of File Templates and Images

Open renzo1974 opened this issue 8 years ago • 4 comments

Hi

Images It would be very nice to add images into generated package. As example we have to add our company logo and a base product logo into every odoo module which is generated. And this is forgotten to many times...

File generation Another problem that I have is to generate the __init__.py files based on selected folders.

An odoo Module has the following structure:

  • /module
    • __init__.py
    • /models/__init__.py
    • /controllers/__init__.py
    • /wizards/__init__.py

Now when I do not need e.g. the wizards folder, I disable this folder in package template Popup. But in root __init__.py I have to add (or remove) all (not) needed imports for sub packages. Is there a possibility to automize the generation of __init__.py in root by selected folders?

Regards Renzo

renzo1974 avatar Jul 28 '17 07:07 renzo1974

Hi, thx for feedback. I will try to develop some features for your request. P.S. What you mean by imports for sub packages, TextInjections?

InsaneDoggo avatar Jul 28 '17 08:07 InsaneDoggo

I mean the root __init__.py file should look like:

import models
import controllers
import wizards

or when e.g. controllers folder is not used:

import models
import wizards

Something like a live template which can loop over subfolders...

renzo1974 avatar Jul 28 '17 13:07 renzo1974

Oh.. i miss this feature too and already have some ideas about possible solution. Currently you can use dummy variables + Velocity engine (Supported in FileTemplates by default) as temporary solution. e.g. global var ADD_WIZZARD

then in FileTemplate check value of variable:

#if (${ADD_WIZZARD} && ${ADD_WIZZARD} != "")import wizards#end

If ADD_WIZZARD isn't empty import will be added, but approach with variables still independent from selecting folders, so you should manually control both conditions.

InsaneDoggo avatar Jul 28 '17 14:07 InsaneDoggo

Oh nice to read that you already have some ideas...

The usage of variables is a solution but not not realy one that I will use... I don't like to set twice to not use a folder...

So I will wait for another solution of you ;-)))

Thanks a lot for this time saving plugin!

renzo1974 avatar Jul 28 '17 15:07 renzo1974