Odoo Help

0

AttributeError: 'account.invoice' object has no attribute 'init_fields'

Op
Niko H
op 03-01-18 13:08 123 weergaven

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.

1
--Niyas Raphy--

Odoo Techno Functionalist

Graduation : B-Tech in Computer Science & Engineering from Calicut University (2012 - 2016)

Niyas Raphy
Op 03-01-18 22:50

Hi,

As you have given written the function in the account.invoice model,  what we have to do next is that , check and ensure that the py file contain the function is called in the init file.

Thanks

Over deze community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Vraag hulpmiddelen

1 volger(s)

Statistieken

Gevraagd: 03-01-18 13:08
Gezien: 123 tijden
Laatst bijgewerkt: 03-01-18 22:50