0
votes

I'm using OpenERP V7,need some basic helps. Added a new icon in POLine

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

add.xml code:

<openerp>
<data>
    <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">                  
                <footer>
                    <button name="add_info" string="Add" type="object" class="oe_highlight"/>
                    or
                    <button string="Cancel" class="oe_link" special="cancel" />
                </footer>
            </form>             
        </field>
    </record>       
    <record id="add_slab_action" model="ir.actions.act_window">

    </record>               
</data>

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"/>

add.py

 def add_slab_action(self, cr, uid, ids, context=None):
    return {
          'type': 'ir.actions.act_window',

}  

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?

2

2 Answers

1
votes

Do check this whether you have added your wizard file in openerp.py file.

0
votes

What is code you written in the button function?

for your information i show you one example here :

Like

<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"/>

Here in the button code you can see in the name of button is the action of wizard to open form to get data, so you have to define some thing like that to open a form or from button function you have to return some other object form action to open from to get data like

return {
                'name': _('Distribution Model Saved'),
                'view_type': 'form',
                'view_mode': 'tree,form',
                'res_model': 'analytic.plan.create.model',
                'views': [(resource_id,'form')],
                'type': 'ir.actions.act_window',
                'target': 'new',
            }

Hope this help