Odoo Help


fields.function storing problem

on 6/14/13, 9:45 PM 2,814 views

Hi all,

Here is my idea,

i would like to store a value of " if a sale.order.line is taxed or not" in char.

before, i used store = false since i didnt need the value, but now i would like to store the value.

it worked before when store=false

def _is_taxed(self, cr, uid, ids, field_name, arg, context=None):
        val = {}
        for record in self.browse(cr, uid, ids):
            if record.tax_id:
                val[record.id] = 'T'
                val[record.id] = 'N/T'
        return val

'tax_mark': fields.function(_is_taxed, type='char', size='64', string=" 'T' for taxed, and 'N/T' for non taxable", store=False, method=True,),

but when i change store = True; or store = { 'sale.order.line':(some_function_name,['tax_id', 'product_id'], 10) }),

this error pops up when i upgrade the module

OpenERP Server Error Client Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/common/http.py", line 180, in dispatch response["result"] = method(controller, self, *self.params) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1052, in call_button action = self.call_common(req, model, method, args, domain_id, context_id) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 996, in call_common return self._call_kw(req, model, method, args, {}) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1010, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/opt/openerp/server/openerp/addons/web/common/openerplib/main.py", line 250, in proxy args, kw) File "/opt/openerp/server/openerp/addons/web/common/openerplib/main.py", line 117, in proxy result = self.connector.send(self.service_name, method, *args) File "/opt/openerp/server/openerp/addons/web/common/http.py", line 608, in send raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)

Server Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/common/http.py", line 593, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/opt/openerp/server/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/opt/openerp/server/openerp/service/web_services.py", line 586, in dispatch res = fn(db, uid, params) File "/opt/openerp/server/openerp/osv/osv.py", line 186, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper return f(self, dbname, args, *kwargs) File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/opt/openerp/server/openerp/addons/base/module/wizard/base_module_upgrade.py", line 101, in upgrade_module _db, pool = pooler.restart_pool(cr.dbname, update_module=True) File "/opt/openerp/server/openerp/pooler.py", line 39, in restart_pool registry = RegistryManager.new(db_name, force_demo, status, update_module, True) File "/opt/openerp/server/openerp/modules/registry.py", line 202, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/opt/openerp/server/openerp/modules/loading.py", line 334, in load_modules processed = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules) File "/opt/openerp/server/openerp/modules/loading.py", line 253, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules) File "/opt/openerp/server/openerp/modules/loading.py", line 170, in load_module_graph init_module_models(cr, package.name, models) File "/opt/openerp/server/openerp/modules/module.py", line 378, in init_module_models result = obj._auto_init(cr, {'module': module_name}) File "/opt/openerp/server/openerp/osv/orm.py", line 2997, in _auto_init cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, get_pg_type(f)[1])) File "/opt/openerp/server/openerp/osv/orm.py", line 585, in get_pg_type pg_type = get_pg_type(f, getattr(fields, f._type)) File "/opt/openerp/server/openerp/osv/orm.py", line 574, in get_pg_type pg_type = ('varchar', pg_varchar(f.size)) File "/opt/openerp/server/openerp/osv/orm.py", line 539, in pg_varchar % type(size)) TypeError: VARCHAR parameter should be an int, got <type 'str'="">

Thanks for the help


Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 6/15/13, 12:06 AM

The error message TypeError: VARCHAR parameter should be an int, got <type 'str'=""> is giving you a clue:


should be


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

0 follower(s)


Asked: 6/14/13, 9:45 PM
Seen: 2814 times
Last updated: 3/16/15, 8:10 AM