Odoo Help


OpenERPV7:Button Action in PO - Error:No such external ID currently defined in the system

on 1/3/14, 4:19 AM 1,385 views

I'm using OpenERP V7,need some basic helps. Added a new icon in POLine ,When Click on this icon , need to display the popup screen for entering data.

Created new Xml,py file under Wizard in Purchase Module.

add.xml code:

    <record id="add_slab_form" model="ir.ui.view">
        <field name="name">Add Slab</field>
        <field name="model">add.slab</field>
        <field name="arch" type="xml">
            <form string="Add Slab" version="7.0">
                <group col="4" colspan="4">                                                                 
                    <field name="block_no"/>
                    <field name="product_id"/>
                    <field name="slab_qty"/>
                    <field name="price"/>
                    <field name="other_charges"/>
                <separator string="Slab Dimensions"/>
                <group col="6" colspan="4">
                    <field name="length"/>
                    <field name="width"/>
                    <field name="uom"/>                     
                    <field name="sequence" invisible="1"/>
                    <button name="add_slab_info" string="Add" type="object" class="oe_highlight"/>
                    <button string="Cancel" class="oe_link" special="cancel" />
    <record id="add_slab_action" model="ir.actions.act_window">
        <field name="name">Add Slab</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">add.slab</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
        <field name="view_id" ref="add_slab_form"/>

</openerp> Form view get installed and i cant see the action view.

Button Action Code called in purchase_view.xml file

<button name="%(add_slab_action)d" icon="gtk-add"  string="Add Slab" type="action"/>


 def add_slab_action(self, cr, uid, ids, context=None):
    return {
           'type': 'ir.actions.act_window',
           'name': 'Add Slab',
           'view_mode': 'form',
           'view_type': 'form',
           'res_model': 'add.slab',
           'nodestroy': True,
           'context': context,

I got an error : ValueError: No such external ID currently defined in the system: purchase.add_slab_action

Button Action is not performing ,How do i resolve?


Pinakin Nayi (pna)

--Pinakin Nayi (pna)--
| 2 2 5
Ahmedabad, India
--Pinakin Nayi (pna)--

He has good skills in problem identification and implementation of effective solutions. He is working in RD India validation team.

Skype: pinakinerp

LinkedIn : https://www.linkedin.com/in/pinakin-nayi-2a33103a/


Pinakin Nayi (pna)
On 1/3/14, 4:55 AM


There are three kinds of types for button:

  • Types
    • object,
    • action &
    • workflow.

Now let's understand the meaning of these three types:

object is used if you want to call a method which is written in .py file.

action is used if you want to call any action which is written in .xml file. Let say if you want to open a wizard from button click then you can use type="action".

workflow (the default) is used if you want to call workflow.

<button name="%(add_slab_action)d" icon="gtk-add" string="Add Slab" type="action"/> , requesting about my error

on 1/3/14, 6:31 AM

Actually you are using type="action" that means action is used if you want to call any action which is written in .xml file. in your code you are using "add_slab_action" so system will try to find related named xml id and there is no any xml id present so its give you error.

Pinakin Nayi (pna)
on 1/3/14, 8:14 AM

You can do it by simply , <button name="add_slab_action" icon="gtk-add" string="Add Slab" type="object"/>

Pinakin Nayi (pna)
on 1/3/14, 8:16 AM

I changed to Object , throws AttributeError: 'purchase.order.line' object has no attribute 'add_slab_action'

on 1/3/14, 8:32 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 1/3/14, 4:19 AM
Seen: 1385 times
Last updated: 3/16/15, 8:10 AM