AmiNe
AmiNe

Reputation: 62

creating a new import button in odoo

in my python code, I have two classes :

class object_one(osv.osv):
    _name = "object.one"

and

class object_two(osv.osv):
    _name = "object.two"

I want to create a customized import button in object.one's Form View in order to import object.two's data, I tried to search in the base_import module's files, but in vain, so it would be helpful if someone knows from where (which xml file) the original import button is created

enter image description here

Upvotes: 0

Views: 1882

Answers (1)

Mudathir Ahmed SD
Mudathir Ahmed SD

Reputation: 11

At least in Odoo V11 you can do the following code in XML to open import view to specific model after click on button:

in XML :
    <!--Action Definition-->
    <record id="action_import_employee_data" model="ir.actions.client">
        <field name="name">Employees Import</field>
        <field name="tag">import</field>
        <field name="params">{ 'model': 'hr.employee' }</field>
    </record>

    <!--Button Definition on Form View or Wizard-->
    <button name="%(action_import_employee_data)d" string="Import Employees Data" type="action"/>

Upvotes: 1

Related Questions