Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
7 Trả lời
80137 Lượt xem

Hey,

i follow a odoo Moduldevelopment Tutorial, but on installation i go this error:

ParseError: "External ID not found in the system: daily_transaction.action_daily_transaction" while parsing /opt/odoo/custom/addons/daily_transaction/daily_transaction_view.xml:9, near <menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/>

 

why is that so?

Here is my daily_transaction_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Main Menu Related Info -->
<menuitem name="Daily Transaction" id="base.daily_transaction_root" sequence="60"/>
<!-- Sub Menu Related Info -->
<menuitem id="menu_daily_transaction_root" name="Daily Transaction" parent="base.daily_transaction_root" sequence="1" />
<!-- Action Menu Related info -->
<menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/>

<!-- Daily Transaction List View -->
<record id="view_daily_transaction_tree" model="ir.ui.view"> <!-- id is the external id for this tree view which must be unique and will be used for accessing this record -->
    <field name="name">daily.transaction.tree</field>
    <field name="model">daily.transaction</field>
    <field name="arch" type="xml">
        <!-- this will be our title of list/tree view -->
        <tree string="Daily Transaction">
            <!-- automatisches Mapping durch odoo -->
            <field name="name"/>
            <field name="date"/>
            <field name="type"/>
            <field name="amount"/>
        </tree>
    </field>
</record>

<!-- Daily Transaction Form View -->
<record id="view_daily_transaction_form" model="ir.ui.view">
    <field name="name">daily.transaction.form.view</field>
    <field name="model">daily.transaction</field>
    <field name="arch" type="xml">
        <!-- this will be our title of list/tree view -->
        <form string="Daily Transaction" version="7.0">
            <group>
                <field name="name"/>
                <field name="date" />
                <field name="type" />
                <field name="amount" />
                <field name="note" />
            </group>
        </form>
    </field>
</record>

<record id="action_daily_transaction" model="ir.actions.act_window">
    <field name="name">Daily Transaction</field> <!-- name of action -->
    <field name="res_model">daily.transaction</field> <!-- this action will be mapped to model-->
    <field name="view_type">form</field>
    <field name="view_mode">tree.form</field> <!-- these are type of view our module will show for our daily transaction mode -->
    <field name="search_view_id" eval="False"/> <!-- here we specily id of our search view -->
    <field name="context">{}</field>
    <field name="help">Create New daily transaction.</field> <!-- help text for our model -->
</record>
</data>
</openerp>

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Dear 

Please try move 

<record id="action_daily_transaction" model="ir.actions.act_window"> ...
Go up
<menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/> ...
Because the content in *.xml run sequentially,
I think it will work.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

just change the order of the definitions. 
Put the menuitems at the bottom of the file (before  </data></openerp> though) and that will do it.

OpenERP or Odoo for that matter, parse the xml files in a bottom-down fashion and at the moment that you are declaring the menuitem with id=menu_action_daily_transaction the action does not exists, it is defined later on the same file.

Hope I made myself clear!

Ảnh đại diện
Huỷ bỏ

this answer worked for me . thank you

Câu trả lời hay nhất

I had a similar issue when adding buttons to a header on a form view. Try declaring the report like this:   class="btn-info" name="%(report_id)d" type="action" string="Download Report".  If the report is in another module you need to declare the model also like this:  name="%(module_name.report_id)d"

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I was also getting this error.
I was creating another menu in my module, so I copy-paste the entire code.
But I forget to update the record id. After changing it, my code was executed.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

face same error in while creating a group for security i give id to my main menu like  groups="module_name.group_id"

but it still show the external id not found

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

The same error could appear if you call a undefined view in a view_id field.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Yes the order does matter, I had a similar issue I had to move definitions before/above before referring to them.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 22
14963
1
thg 11 21
5087
0
thg 1 21
2382
3
thg 7 20
3918
8
thg 5 20
7957