ValueError: No such external ID currently defined in the system 求解决方案。
-
OpenERP Server Error
Client Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/http.py", line 204, in dispatch
response["result"] = method(self, **self.params)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/controllers/main.py", line 1133, in call_button
action = self._call_kw(req, model, method, args, {})
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/controllers/main.py", line 1121, in _call_kw
return getattr(req.session.model(model), method)(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/session.py", line 43, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/session.py", line 31, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/session.py", line 104, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/web/session.py", line 90, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/netsvc.py", line 293, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/osv/osv.py", line 188, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/osv/osv.py", line 131, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/osv/osv.py", line 197, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/osv/osv.py", line 185, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/magento_integration-develop/wizard/import_websites.py", line 91, in import_websites
return self.open_websites(cursor, user, ids, instance, context)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/magento_integration-develop/wizard/import_websites.py", line 107, in open_websites
cursor, user, 'magento_integration', 'instance_website_tree_view'
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/base/ir/ir_model.py", line 868, in get_object_reference
data_id = self._get_id(cr, uid, module, xml_id)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130501_232419-py2.6.egg/openerp/addons/base/ir/ir_model.py", line 861, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: magento_integration.instance_website_tree_view -
-- coding: UTF-8 --
'''
magento-integration
(c) 2013 by Openlabs Technologies & Consulting (P) LTD
:license: AGPLv3, see LICENSE for more details
'''
from openerp.osv import osv
from openerp.tools.translate import _
from ..api import Core, OrderConfig
class ImportWebsites(osv.TransientModel):
"Import websites from magentp"
_name = 'magento.instance.import_websites'
_description = doc
def import_websites(self, cursor, user, ids, context):
"""
Import the websites and their stores/view from magento
:param cursor: Database cursor
:param user: ID of current user
:param ids: Record IDs
:param context: Application context
"""
Pool = self.pool
instance_obj = Pool.get('magento.instance')
website_obj = Pool.get('magento.instance.website')
store_obj = Pool.get('magento.website.store')
store_view_obj = Pool.get('magento.store.store_view')
magento_order_state_obj = Pool.get('magento.order_state')
instance = instance_obj.browse(
cursor, user, context.get('active_id'), context
)
context.update({
'magento_instance': instance.id
})
# Import order states
with OrderConfig(
instance.url, instance.api_user, instance.api_key
) as order_config_api:
magento_order_state_obj.create_all_using_magento_data(
cursor, user, order_config_api.get_states(), context
)
# Import websites
with Core(
instance.url, instance.api_user, instance.api_key
) as core_api:
website_ids = []
store_ids = []
mag_websites = core_api.websites()
# Create websites
for mag_website in mag_websites:
website_ids.append(website_obj.find_or_create(
cursor, user, instance.id, mag_website, context
))
for website in website_obj.browse(
cursor, user, website_ids, context=context):
mag_stores = core_api.stores(
{'website_id': {'=': website.magento_id}}
)
# Create stores
for mag_store in mag_stores:
store_ids.append(store_obj.find_or_create(
cursor, user, website.id, mag_store, context
))
for store in store_obj.browse(
cursor, user, store_ids, context=context):
mag_store_views = core_api.store_views(
{'group_id': {'=': store.magento_id}}
)
# Create store views
for mag_store_view in mag_store_views:
store_view_obj.find_or_create(
cursor, user, store.id, mag_store_view, context
)
return self.open_websites(cursor, user, ids, instance, context)
def open_websites(self, cursor, user, ids, instance, context):
"""
Opens view for websites for current instance
:param cursor: Database cursor
:param user: ID of current user
:param ids: Record IDs
:param instance: Browse record of magento.instance
:param context: Application context
:return: The websites tree view to be rendered
"""
ir_model_data = self.pool.get('ir.model.data')
tree_res = ir_model_data.get_object_reference(
cursor, user, 'magento_integration', [b][glow=red,2,300]'instance_website_tree_view[/glow]'[/b]
)
tree_id = tree_res and tree_res[1] or False
return {
'name': _('Magento Instance Websites'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'magento.instance.website',
'views': [(tree_id, 'tree')],
'context': context,
'type': 'ir.actions.act_window',
'domain': [('instance', '=', instance.id)]
}
ImportWebsites() -
我知道那定义了, 但是怎么改啊?