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

Repairs module says "ProgrammingError: can't adapt type 'account.tax'" when try to add taxes

By
Rafa Merino
on 2/1/16, 4:06 AM 704 views

Steps to replicate error:

1.- Clic on "Repairs" > "Create"
2A.- Add some item in "Operations" WITH some taxes included and check "To invoice" marked. Click "Save"
OR
2B.- Add some item in "Invoicing" WITH some taxes included. No need to click "Save", error shows immediately after trying to select taxes.

System always show error (see below)

>> When whe make 2A step, this is the error message:

2016-02-01 00:47:03,710 20981 INFO infoab werkzeug: 127.0.0.1 - - [01/Feb/2016 00:47:03] "POST /web/dataset/call_kw/account.tax/name_get HTTP/1.1" 200 -
2016-02-01 00:47:03,901 20981 INFO infoab openerp.sql_db: Programming error: can't adapt type 'account.tax', in query SELECT "account_tax"."amount" as "amou as "price_include","account_tax"."company_id" as "company_id","account_tax"."create_uid" as "create_uid","account_tax"."active" as "active","account_tax"."s"account_tax"."create_date" as "create_date","account_tax"."account_id" as "account_id","account_tax"."tax_group_id" as "tax_group_id","account_tax"."descrip"name" as "name","account_tax"."amount_type" as "amount_type","account_tax"."include_base_amount" as "include_base_amount","account_tax"."write_uid" as "writccount_tax"
 WHERE "account_tax".id IN %s ORDER BY "account_tax"."sequence"
2016-02-01 00:47:03,902 20981 ERROR infoab openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/opt/odoo/openerp/http.py", line 643, in _handle_exception
 return super(JsonRequest, self)._handle_exception(exception)
 File "/opt/odoo/openerp/http.py", line 680, in dispatch
 result = self._call_function(**self.params)
 File "/opt/odoo/openerp/http.py", line 316, in _call_function
 return checked_call(self.db, *args, **kwargs)
 File "/opt/odoo/openerp/service/model.py", line 118, in wrapper
 return f(dbname, *args, **kwargs)
 File "/opt/odoo/openerp/http.py", line 309, in checked_call
 result = self.endpoint(*a, **kw)
 File "/opt/odoo/openerp/http.py", line 959, in __call__
 return self.method(*args, **kw)
 File "/opt/odoo/openerp/http.py", line 509, in response_wrap
 response = f(*args, **kw)
 File "/opt/odoo/addons/web/controllers/main.py", line 892, in call_kw
 return self._call_kw(model, method, args, kwargs)
 File "/opt/odoo/addons/web/controllers/main.py", line 884, in _call_kw
 return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 381, in old_api
 result = method(recs, *args, **kwargs)
 File "/opt/odoo/addons/mail/models/mail_thread.py", line 275, in write
 result = super(MailThread, self).write(values)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3819, in write
 self._write(old_vals)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 574, in new_api
 result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
 File "/opt/odoo/openerp/models.py", line 3970, in _write
 result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
 File "/opt/odoo/openerp/osv/fields.py", line 827, in set
 obj.write(cr, user, [act[1]], act[2], context=context)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 381, in old_api
 result = method(recs, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3819, in write
 self._write(old_vals)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 574, in new_api
 result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
 File "/opt/odoo/openerp/models.py", line 4075, in _write
 cr, user, todo, fields_to_recompute, context)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 4469, in _store_set_values
 result = column.get(cr, self, ids, f, SUPERUSER_ID, context=context)
 File "/opt/odoo/openerp/osv/fields.py", line 1494, in get
 result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
 File "/opt/odoo/addons/mrp_repair/mrp_repair.py", line 73, in _amount_total
 untax = self._amount_untaxed(cr, uid, ids, field_name, arg, context=context)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/addons/mrp_repair/mrp_repair.py", line 32, in _amount_untaxed
 res[repair.id] += line.price_subtotal
 File "/opt/odoo/openerp/fields.py", line 808, in __get__
 self.determine_value(record)
 File "/opt/odoo/openerp/fields.py", line 906, in determine_value
 record._prefetch_field(self)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3280, in _prefetch_field
 result = records.read([f.name for f in fs], load='_classic_write')
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3210, in read
 self._read_from_database(stored, inherited)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3401, in _read_from_database
 res2 = self._columns[f].get(cr, self._model, ids, f, user, context=context, values=result)
 File "/opt/odoo/openerp/osv/fields.py", line 1494, in get
 result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
 File "/opt/odoo/addons/mrp_repair/mrp_repair.py", line 549, in _amount_line
 taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, cur.id, line.product_uom_qty, line.product_id.id, line.repair_id.partner_id.id)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/addons/account/models/account.py", line 689, in compute_all
 return recs.compute_all(price_unit, currency, quantity, product, partner)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/addons/account/models/account.py", line 622, in compute_all
 company_id = self[0].company_id
 File "/opt/odoo/openerp/fields.py", line 808, in __get__
 self.determine_value(record)
 File "/opt/odoo/openerp/fields.py", line 906, in determine_value
 record._prefetch_field(self)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3280, in _prefetch_field
 result = records.read([f.name for f in fs], load='_classic_write')
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3210, in read
 self._read_from_database(stored, inherited)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 3348, in _read_from_database
 cr.execute(query_str, params)
 File "/opt/odoo/openerp/sql_db.py", line 139, in wrapper
 return f(self, *args, **kwargs)
File "/opt/odoo/openerp/sql_db.py", line 218, in execute
 res = self._obj.execute(query, params)
 File "/usr/local/lib/python2.7/dist-packages/psycopg2/extensions.py", line 129, in getquoted
 pobjs = [adapt(o) for o in self._seq]
ProgrammingError: can't adapt type 'account.tax'


  >> When whe make 2B step, this is the error message:  

2016-02-01 00:58:31,863 20981 INFO infoab werkzeug: 127.0.0.1 - - [01/Feb/2016 00:58:31] "POST /longpolling/poll HTTP/1.1" 200 -
2016-02-01 00:58:34,723 20981 ERROR infoab openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
 File "/opt/odoo/openerp/http.py", line 643, in _handle_exception
 return super(JsonRequest, self)._handle_exception(exception)
 File "/opt/odoo/openerp/http.py", line 680, in dispatch
 result = self._call_function(**self.params)
 File "/opt/odoo/openerp/http.py", line 316, in _call_function
 return checked_call(self.db, *args, **kwargs)
 File "/opt/odoo/openerp/service/model.py", line 118, in wrapper
 return f(dbname, *args, **kwargs)
 File "/opt/odoo/openerp/http.py", line 309, in checked_call
 result = self.endpoint(*a, **kw)
 File "/opt/odoo/openerp/http.py", line 959, in __call__
 return self.method(*args, **kw)
 File "/opt/odoo/openerp/http.py", line 509, in response_wrap
 response = f(*args, **kw)
 File "/opt/odoo/addons/web/controllers/main.py", line 892, in call_kw
 return self._call_kw(model, method, args, kwargs)
 File "/opt/odoo/addons/web/controllers/main.py", line 884, in _call_kw
 return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 354, in old_api
 result = method(recs, *args, **kwargs)
 File "/opt/odoo/addons/account/models/account.py", line 551, in name_search
 taxes = self.search(expression.AND([domain, args]), limit=limit)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/addons/account/models/account.py", line 569, in search
 return super(AccountTax, self).search(args, offset, limit, order, count=count)
 File "/opt/odoo/openerp/api.py", line 248, in wrapper
 return new_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/api.py", line 490, in new_api
 result = method(self._model, cr, uid, *args, **old_kwargs)
 File "/opt/odoo/openerp/models.py", line 1658, in search
 return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper 
 return old_api(self, *args, **kwargs)
 File "/opt/odoo/openerp/models.py", line 4745, in _search
 query = self._where_calc(cr, user, args, context=context)
 File "/opt/odoo/openerp/api.py", line 250, in wrapper
 return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/models.py", line 4516, in _where_calc
 e = expression.expression(cr, user, domain, self, context)
 File "/opt/odoo/openerp/osv/expression.py", line 644, in __init__
 self.parse(cr, uid, context=context)
 File "/opt/odoo/openerp/osv/expression.py", line 840, in parse
 raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field u'parent_id' in leaf "<osv.ExtendedLeaf: (u'parent_id', u'=', False) on account_tax (ctx: )>"


What can I do to repair this? Thank you!

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

1 follower(s)

Stats

Asked: 2/1/16, 4:06 AM
Seen: 704 times
Last updated: 2/1/16, 4:32 AM