Python无法找到模块名称

时间:2018-05-02 14:41:44

标签: python

以下代码是阻止的地方:

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 '',
}

非常感谢!!!

1 个答案:

答案 0 :(得分:0)

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