繁体   English   中英

Python找不到模块名称

[英]Python cannot find Module name

以下代码是它的阻止位置:

def xmlid_lookup(self, xmlid):
"""Low level xmlid lookup
Return (id, res_model, res_id) or raise ValueError if not found
"""
module, name = xmlid.split('.', 1)
xid = self.search([('module', '=', module), ('name', '=', name)])
if not xid:
raise ValueError('External ID not found in the system: %s' % xmlid)
# the sql constraints ensure us we have only one result
res = xid.read(['model', 'res_id'])[0]
if not res['res_id']:
raise ValueError('External ID not found in the system: %s' % xmlid)
return res['id'], res['model'], res['res_id']

它说:在系统中找不到外部ID:edx_analytics_list_schedule。 它找不到它的模块。

The following is list_schedule:
<!-- LIST -->
<record model="ir.ui.view" id="list_schedule">
<field name="name">Schedule List</field>
<field name="model">partnername.schedule</field>
<field name="priority">100</field>
<field name="arch" type="xml">
<tree>
<field name="product_id"/>
<field name="date"/>
<field name="date2"/>
<field name="quantity"/>
<field name="variation_value"/>
<field name="variation_percent"/>
<field name="variation_trend" fg_color="white:variation_trend=='change' or variation_trend=='up' or variation_trend=='stable' or variation_trend=='far'" bg_color="red:variation_trend=='up';yellow:variation_trend=='down';purple:variation_trend=='change';green:variation_trend=='stable';orange:variation_trend=='na';grey:variation_trend=='far'"/>
<button type="object" name="product_history_action" string="Product history"/>
</tree>
</field>
</record>

这个文件:def release_last_schedules_action(self):self.ensure_one()

result = {
"type": "ir.actions.act_window",
"res_model": "partnername.schedule",
"view_mode": "tree,form",
"views": [[self.env.ref('edx_analytics.list_schedule').id, "tree"], [False, "form"]],
"domain": [["partner_id", "=", self.id],["filename", "=", self.release_last_filename]],
"context": {"create": False, "search_default_group_by_product": 1},
"name": "Schedules " + self.display_name[:15] + " " + self.ref or '' + " " + self.release_last_name or '',
}

非常感谢!!!

我发现了问题,这是因为我的模块名称不是文件夹名称,这就是为什么它不起作用的原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM