Odoo Help

Welcome!

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

0

AttributeError: 'product.template' object has no attribute

By
MoayadRayyan
on 11/16/14, 8:43 AM 2,364 views

Greetings,

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):
      _name='product.rolls'
      _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 = {
            'product_rolls_id':'000'
        }
        return {'value': val}

product_rolls()

.xml

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

0
Anand
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):

0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--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.

Odoo
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?

Odoo
on 11/17/14, 10:39 AM

Hiw to acheive this task ..need a help

Odoo
on 11/17/14, 10:39 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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