Odoo Help


AttributeError: 'product.template' object has no attribute

on 11/16/14, 8:43 AM 3,358 views


i created my own module which will add extra fields to product.template

am trying to add on_change to my fields but i get this error


Traceback (most recent call last): File "/opt/odoo/odoo-server/openerp/http.py", line 500, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/odoo-server/openerp/http.py", line 517, in dispatch result = self._call_function(**self.params) File "/opt/odoo/odoo-server/openerp/http.py", line 283, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/service/model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/http.py", line 280, in checked_call return self.endpoint(*a, **kw) File "/opt/odoo/odoo-server/openerp/http.py", line 733, in __call__ return self.method(*args, **kw) File "/opt/odoo/odoo-server/openerp/http.py", line 376, in response_wrap response = f(*args, **kw) File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 948, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 940, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/api.py", line 360, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/odoo-server/openerp/models.py", line 5722, in onchange record._onchange_eval(name, field_onchange[name], result) File "/opt/odoo/odoo-server/openerp/models.py", line 5656, in _onchange_eval method_res = getattr(self._model, method)(*args) AttributeError: 'product.template' object has no attribute 'onchange_product_rolls_id'


check my code bellow .

.Py file

from openerp.osv import fields, osv

class product_rolls(osv.osv):
      _inherit = "product.template"

      _columns = {
        'product_rolls_id': fields.integer('Product Pices', size=11)

      _defaults ={
        'product_rolls_id': 0

      def onchange_product_rolls_id(self, cr, uid, ids , context=None):
         val = {
        return {'value': val}



<field name="product_rolls_id" on_change="onchange_product_rolls_id()" string="Pices" />

On 11/17/14, 12:09 AM

You havent meant the product_rolls_id in your onchenage function please refer it....

def onchange_product_rolls_id(self, cr, uid, ids ,product_rolls_id, context=None):


Med Said BARA

--Med Said BARA--

| 5 5 7
--Med Said BARA--
Med Said BARA
On 11/16/14, 2:27 PM

Could you try with: def onchange_product_rolls_id(self, cr, uid, ids , product_rolls_id, context=None):

and in the view:

<field name="product_rolls_id" on_change="onchange_product_rolls_id(product_rolls_id)" .......



Hi med I have one daught.

on 11/17/14, 10:39 AM

How to implement automatically signout in odoo 8 or openerp 7 human resource module , if the PC is idle(or sleep) condition Hi all, I want to implement automatically signout feature from HR module in odoo 8 or openerp 7 version. Currently the attendance system shows last sign in message and click for signout and sign in alert .But I want to do signout steps automatically ,if the user is in idle(sleep ,based on our PC) condition for a particular time period.How can I achievee this task?

on 11/17/14, 10:39 AM

Hiw to acheive this task ..need a help

on 11/17/14, 10:39 AM

About This 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.


Odoo Training Center

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

Test it now

Question tools

2 follower(s)


Asked: 11/16/14, 8:43 AM
Seen: 3358 times
Last updated: 3/16/15, 8:10 AM