transport_account_id -> field exist in the model 'project.events'
-> 'transport_account_id': fields.many2one('account.account','Tranport Account'),
Code:
from openerp.osv import fields, osv
from openerp.tools.translate import _
class project_events_configuration(osv.osv_memory):
_name = 'project.events.config.settings'
_inherit = 'res.config.settings'
_columns = {
'default_transport_account_id': fields.many2one('account.account','Tranport Account', required=True, default_model='project.events'),
}
XML
<record id="view_config_events_settings" model="ir.ui.view">
<field name="name">project events settings</field>
<field name="model">project.events.config.settings</field>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<form string="Configure Project" version="7.0" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<separator string="Event Management"/>
<group>
<div name="other_cofing">
<div>
<label for="default_transport_account_id"/>
<field name="default_transport_account_id" class="oe_inline"/>
</div>
</div>
</group>
</form>
</field>
</record>
When saving the default value I get a the following error:
Traceback (most recent call last):
File "/opt/openerp/server/8.0/upstairs/openerp/http.py", line 369, in dispatch
response["result"] = self._call_function(**self.params)
File "/opt/openerp/server/8.0/upstairs/openerp/http.py", line 230, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/openerp/server/8.0/upstairs/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/openerp/server/8.0/upstairs/openerp/http.py", line 227, in checked_call
return self.endpoint(*a, **kw)
File "/opt/openerp/server/8.0/upstairs/openerp/http.py", line 570, in __call__
return self.method(*args, **kw)
File "/opt/openerp/server/8.0/upstairs/openerp/http.py", line 273, in response_wrap
response = f(*args, **kw)
File "/opt/openerp/env/8.0/upstairs/web/addons/web/controllers/main.py", line 1230, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/openerp/env/8.0/upstairs/web/addons/web/controllers/main.py", line 1218, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/openerp/server/8.0/upstairs/openerp/addons/base/res/res_config.py", line 509, in execute
ir_values.set_default(cr, SUPERUSER_ID, model, field, config[name])
File "/opt/openerp/server/8.0/upstairs/openerp/addons/base/ir/ir_values.py", line 248, in set_default
'value': pickle.dumps(value),
File "/usr/lib/python2.7/pickle.py", line 1374, in dumps
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.7/pickle.py", line 224, in dump
self.save(obj)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 419, in save_reduce
save(state)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 649, in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/lib/python2.7/pickle.py", line 663, in _batch_setitems
save(v)
File "/usr/lib/python2.7/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.7/pickle.py", line 401, in save_reduce
save(args)
File "/usr/lib/python2.7/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python2.7/pickle.py", line 562, in save_tuple
save(element)
File "/usr/lib/python2.7/pickle.py", line 300, in save
self.save_global(obj)
File "/usr/lib/python2.7/pickle.py", line 748, in save_global
(obj, module, name))
PicklingError: Can't pickle <class 'openerp.osv.orm.account.account'>: it's not found as openerp.osv.orm.account.account
hi, how did you solve this ?