2017-09-15 101 views
1

我创建了新模块,但无法从Odoo应用程序商店安装。当尝试这样做,我得到了一个错误:尝试安装Odoo应用程序时出错

 File "/opt/odoo/openerp/addons/base/ir/ir_model.py", line 950, in xmlid_lookup 
     raise ValueError('External ID not found in the system: %s' % (xmlid)) 
    ParseError: "External ID not found in the system: my_model.action_order_cancel" while parsing /home/pruf/addons/my_model/views/my_model_view.xml:6, near 
    <record model="ir.ui.view" id="view_my_model_form"> 

我的XML部分:

<record model="ir.ui.view" id="view_my_model_form"> 
       <field name="name">my.model.form</field> 
       <field name="model">my.model</field> 
       <field name="arch" type="xml"> 
        <form> 
        <header> 
         <button name="%(action_order_cancel)d" attrs="{'invisible': [('state','not in', ('to_approve_first', 'create_order'))]}" string="Cancel" groups="my_model.group_my__manager" type="action"/> 
         <button name="button_to_approve_first" states="draft" string="Request approval" type="object" class="oe_highlight" groups="my_model.group_my_model_user"/> 
         <button name="button_approved" states="to_approve_first" string="Approve" type="object" class="oe_highlight" groups="my_model.group_my_model_manager"/> 

Python代码:

class PurchaseRequest(models.Model): 
    _name = 'my.model' 
    _inherit = ['mail.thread', 'ir.needaction_mixin'] 
    cancel_id = fields.One2many('order.cancel', 'my_model_id') 



class OrderCancel(models.TransientModel): 
    _name = 'order.cancel' 
    my_model_id = fields.Many2one('my.model') 

在action_order_cancel按钮点击我打电话向导。

我的模型结构:

__init__.py 
__openerp__.py 
models 
----__init__.py 
----my_model.py 
security 
----ir.model.access.csv 
----my_model.xml 
views 
----my_model_view.xml 
wizard 
----__init__.py 
----order.py 
----order_view.xml 

我无法找到问题的所在。

回答

2

的XML的顺序不事作为其解析XML从上到下,你指的是尚未解析动作/宣称

+0

对不起的参考,我不明白,我需要做的。 – fueggit

+0

您正试图在加载之前访问my_model.action_order_cancel。包括所有的XML,它会更容易帮助.. – StefanE

+0

我更新了一些代码我的问题 – fueggit

0

似乎action_sale_order_cancel是不是你的模块中使用。 如果你使用一些其他模块的作用,你必须给该模块

<button name="%(other_module_name.action_sale_order_cancel)d" attrs="{'invisible': [('state','not in', ('to_approve_first', 'create_order'))]}" string="Cancel" groups="my_model.group_my__manager" type="action"/>