尝试安装 Odoo 应用程序时出错
Error when trying to intall Odoo app
我创建了新模块,但无法从 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
找不到问题所在
XML 的顺序很重要,因为它从上到下解析 XML,您指的是尚未 parsed/declared
的操作
似乎 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"/>
我创建了新模块,但无法从 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
找不到问题所在
XML 的顺序很重要,因为它从上到下解析 XML,您指的是尚未 parsed/declared
的操作似乎 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"/>