【问题标题】:Error when trying to intall Odoo app尝试安装 Odoo 应用程序时出错
【发布时间】:2018-02-24 08:23:12
【问题描述】:

我创建了新模块,但无法从 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

我找不到问题出在哪里。

【问题讨论】:

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


    【解决方案1】:

    XML 的顺序确实很重要,因为它从上到下解析 XML,您指的是尚未解析/声明的操作

    【讨论】:

    • 抱歉,我不明白我需要做什么。
    • 您正试图在加载之前访问 my_model.action_order_cancel。包括所有的 XML,它会更容易帮助..
    • 我已经检查了我的 openerp.py 文件 "data": [ ......... "views/my_module_view.xml", "wizard/ reason_view.xml", ......... ],更改了这些视图和 vuolia 的位置 :)
    • 很高兴它为您工作 :) .. 不要忘记接受答案!
    【解决方案2】:

    您的模块中似乎没有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"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-30
      • 1970-01-01
      • 2016-04-23
      • 1970-01-01
      • 1970-01-01
      • 2020-05-08
      • 1970-01-01
      相关资源
      最近更新 更多