0
votes

I have created a new tree View.

I need to update price with selected records based on user input .

My code :

    <record id="view_pricelist_upgrade" model="ir.ui.view">
        <field name="name">priclist upgrade</field>
        <field name="model">pricelist.upgrade</field>
        <field name="arch" type="xml">
            <form string="Upgrade Price" create="false" edit="false">
                <group>
                    <group>
                        <field name="level_of_price"/> 
                        <field name="upgrade_price"/>   
                        <button string='update_price' name="mass_update_price" class="btn-default"/>                        
                    </group>

                </group>
              <!--   <footer>                   
                    <button string='Validate' name="mass_update_price" type="object"/>                       
                    <button string="Cancel" class="btn-default" special="cancel" />
                </footer> -->
           </form>
        </field>
    </record>

     <record id="action_pricelist_upgrade" model="ir.actions.act_window">
        <field name="name">Pricelist upgrade</field>
        <field name="res_model">pricelist.upgrade</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_pricelist_upgrade"/>
        <field name="context">{'default_pricelist_ids': [(0, active_id, None)]}</field>
        <field name="target">new</field>
    </record>   



   <act_window
        id="action_pricelist_upgrade"
        name="Upgrade Pricelist"
        res_model="pricelist.upgrade"
        src_model="product.pricelist.item"
        view_mode="form"
        multi="True"           
        key2="client_action_multi"
    />

I'm getting the popup in form view when click on "Validate" button it call only create not my action

python file

class Pricelist_Upgrade(models.AbstractModel):
_name = 'pricelist.upgrade'   
_auto = False

@api.multi   
def mass_update_price(self, vals):
    ### some
    return  {'type': 'ir.actions.act_window_close'}
1

1 Answers

0
votes

The above records have the same id, that means since they are parsed from the top to the bottom, the last one will overwrite the previous one, thus removing your action.

Make sure all of them have different id.