Reputation: 1043
I created new module but can't install it from Odoo app store. When trying to do that I got an error:
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">
My xml part:
<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 code:
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')
On action_order_cancel button click I am calling wizard.
My model structure:
__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
I can't find where the problem is.
Upvotes: 1
Views: 278
Reputation: 980
it seems that action_sale_order_cancel
is not available in your module.
If you use action of some other module you have to give a reference of that module
<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"/>
Upvotes: 0
Reputation: 7630
The order of the XML does matter as its parsing the XML from Top to Bottom, you are referring to an action that is not yet parsed/declared
Upvotes: 2