Make column syntax definition easier and shorter
The aim of the wrapper is to made the code more simple for new comming user.
Wrapper will add those helping functions:
- Automatic object naming: don't need the "_name"
- Automatic column detection in class attribute: don't need the "_columns = {}"
- Automatic labeling: label = attribute name, '_' converted to ' '
- Automatic many2one and many2many resolution: scan the other object
- Automatic retrieve object name from a class model: Don't need to type all the
object name
Note:
The implementation of 'column_G' is not done for now, it's a special case
of many2many: equal2equal, see the blueprint "many2many-
Object implementation (NOW):
-------
class my_object(osv.osv):
_name = 'my_module.
_columns = {
'col_a': fields.
'col_b': fields.char('column B', size=44),
'col_c': fields.
'col_d': fields.
'column_E': fields.
'column_F': fields.char('column F', size=44),
'column_G': fields.
}
class other_object(
_name = 'my_module.
_columns = {
'ocol_a': fields.
'ocol_b': fields.
'ocol_c': fields.
}
Object implementation (TARGET of this blueprint):
That will generate the same thing !
-------
class my_object(osv.osv):
col_a = field.integer(
col_b = field.char(44, 'column B')
col_c = field.many2one(
col_d = field.many2many
column_E = field.integer()
column_F = field.char(44)
column_G = field.many2many()
class other_object(
ocol_a = field.integer()
ocol_b = field.one2many(
Explanation:
- Automatic label: column_E, column_F, ocol_a, ocol_b
- Automatic retrieve object name from a class model: col_d, ocol_b
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by