I'm trying to expand the account.invoice model with functions and fields but seem to be unable because I keep getting this error.
Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 544, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 581, in dispatch result = self._call_function(**self.params) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 317, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 314, in checked_call return self.endpoint(*a, **kw) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 810, in __call__ return self.method(*args, **kw) File "/usr/local/lib/python2.7/dist-packages/odoo-8.0-py2.7.egg/openerp/http.py", line 410, in response_wrap response = f(*args, **kw) File "/opt/odoo/odoo_server/addons/web/controllers/main.py", line 948, in call_button action = self._call_kw(model, method, args, {}) File "/opt/odoo/odoo_server/addons/web/controllers/main.py", line 936, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) AttributeError: 'account.invoice' object has no attribute 'init_fields'
I have this in my models.py:
class invoice_fields(models.Model):
_inherit = "account.invoice";
def init_fields(self):
self.ExtendModel();
.....
I try to call that function from the templates.xml file with a button using type="object" and name="init_fields".
As you can see I have inherited account.invoice but for some reason my function isn't working. What could be the problem?
I'm using Odoo 8.0.