Hello there,
We are on Odoo 8.
The field 'report_type' of the class account_account_type is a functional field. His type is 'selection'. We want to add an option to this selection.
The original class :
class account_account_type(osv.osv):
_name = "account.account.type"
_description = "Account Type"_columns = {
'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category', store=True,
selection= [('none','/'),
('income', _('Profit & Loss (Income account)')),
('expense', _('Profit & Loss (Expense account)')),
('asset', _('Balance Sheet (Asset account)')),
('liability', _('Balance Sheet (Liability account)'))], help="This field is used to generate legal reports: profit and loss, balance sheet.", required=True),
}
Our override code :
class account_account_type(osv.osv):
_inherit = "account.account.type"
def __init__(self, cr, uid, name, context=None):
super(account_account_type, self).__init__(cr, uid, name, context=context)
option = ('personnal expense', _('Profit & Loss (Personnal expense account)'))
type_selection = self._columns['report_type'].selection
if option not in type_selection:
type_selection.append(option)
We get this error :
TypeError: __init__() takes at least 4 arguments (3 given)
Is this the good way to add an option to the field 'report_type'? How could we fix our error?
Thanks to help