尝试安装Odoo应用程序时出错

时间:2017-09-15 07:56:12

标签: python python-2.7 openerp odoo-9 wizard

我创建了新模块但无法从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 个答案:

答案 0 :(得分:2)

XML的顺序确实很重要,因为它从顶部到底部解析XML,你指的是尚未解析/声明的动作

答案 1 :(得分: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"/>