This question has been flagged
1 Reply
4102 Views

I want to add wizard in selection more list view in stock.production.lot refer to my new object wtc.permohonan.faktur but my wizard doesn't show up .

i am using this code

.py

    def action_button_permohonan(self,cr,uid,ids,context=None):
        print "============BUTTON==============",ids
        lot = self.pool.get('stock.production.lot')

        for val in ids :
            vals = lot.browse(cr,uid,val)

            form_id  = 'permohonan.faktur.form'
            view_pool = self.pool.get("ir.ui.view")
            vit = view_pool.search(cr,uid, [
                                         ("name", "=", form_id),
                                         ("model", "=", 'wtc.permohonan.faktur'),
                                        ])
            form_browse = view_pool.browse(cr,uid,vit)
        
        return {
            'name': 'Permohonan Faktur',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'wtc.permohonan.faktur',
            'type': 'ir.actions.act_window',
            'view_id' : form_browse.id,
            'nodestroy': True,
            'target': 'new',
#             'res_id': vals.customer_stnk.id
            }

.xml

        <record id="action_permohonan_faktur" model="ir.actions.server">
            <field name="name">Mohonkan Faktur</field>
            <field name="type">ir.actions.server</field>
            <field name="model_id" ref="model_wtc_permohonan_faktur"/>
            <field name="state">code</field>
            <field name="code">self.action_button_permohonan(cr,uid,context.get('active_ids'),context=context)</field>
        </record>
        
        <record id="id_of_the_action_value" model="ir.values">
            <field name="name">Permohonan Faktur STNK</field>
            <field name="action_id" ref="action_permohonan_faktur"/>
            <field name="value" eval="'ir.actions.server,' + str(ref('action_permohonan_faktur'))"/>
            <field name="key">action</field>
            <field name="model_id" ref="model_stock_production_lot"/>
            <field name="model">stock.production.lot</field>
            <field name="key2">client_action_multi</field>
        </record>

 

anyone know how to fix it ?

thanks in advance ..

Avatar
Discard

Is you 'return' statement under the 'for loop'...??

Author

no its outside ..

Author

eh i mean yes it is under for loop

That means that for every loop it should pop-up window? Do you think this is logical? I think you are making mistake here.

Author

no , i am not using return inside of looping ..

Author

@emipro i try to use and it show up , but i can't get ids of my selected record because it an action not a method, is there anyway to call a method in act_window ?

Author

i try to use this code

Author

i try to put act_window code , but it doesn't show up in here

Author Best Answer

i try different method , using act_window but i can't return ids of my selected record, is there anyway to put action in act_window ?

        <act_window name="New Sub menu"
            res_model="wtc.permohonan.faktur"
            src_model="stock.production.lot"
            key2="client_action_multi"
            view_mode="form" target="new"
            id="action_window_permohonan_faktur" />

Avatar
Discard