Most Powerful Open Source ERP

Guideline Never Hardcode Category In Scripts Or Classes

Reduces code flexibility and portability.
  • Last Update:2019-07-15
  • Version:001
  • Language:en

Never Hardcode Category In Scripts Or Classes

Each time a category was hardcoded in a script or a class, it was found later on that it was a mistake because it prevented flexibility in configuration from one ERP5 site to another. Also, it makes the code and configuration quite unreadable. The solution is quite simple: either select category values in a ListField in the dialogue which is presented before running the script or define those categories as preferences. Use preferences if this choice of categories is really general allover the application. Last word: ERP5 was designed based on the principle that for maximum flexibility, all categories should be defined (or definable) for each ERP5 site.