Most Powerful Open Source ERP

Guideline Use Methods To Access Properties In ERP5

ERP5 is method based.
  • Last Update:2017-04-05
  • Version:001
  • Language:en

Use Methods To Access Properties In ERP5

Always use accessors. Never access properties directly. ERP5 design is method oriented. All accessors can be automatically overloaded to support different data access schemes or extend a static property into a dynamic property (ex. price). All methods can also act in ERP5 as events through interaction workflows. This allows for implementing complex interactions and constraints. Not using accessors would lead to non generic code and potential inconsistencies with the general ERP5 system. Only the core of ERP5 may in some case access properties directly.

Good Example:

getter = self.getTitle()
setter = self.setTitle("foo")

Bad Example:

self.title