下面是我打开弹出窗口的代码
XML FORM BUTTON:
`<record id="action_import_inventory" model="ir.actions.act_window">
<field name="name">Import Beneficiaries Payments List</field>
<field name="res_model">beneficiary_list.beneficiary_list</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_import_inventory"/>
<field name="context">{'default_id': context.get('record_id', False),} </field>
<field name="target">new</field>
</record>`
PopUp窗口:
`<record id="view_import_inventory" model="ir.ui.view">
<field name="name">import.bene.form</field>
<field name="model">beneficiary_list.beneficiary_list</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import Inventory">
<label string="Please Upload CSV file with beneficiarses payments detasls. Columns Formats- Firstname,Lastname,Account,Amount" colspan="4"/>
<group colspan="4" col="6">
<field name="data" filename="filename" colspan="4"/>
<field name="filename" invisible="1"/>
<!--field name="delimeter"/-->
</group>
<separator string="" colspan="4"/>
<footer>
<button class="oe_highlight" special="cancel" string="Cancel"/>
<button name="action_import" string="Import" type="object" />
<button name="download_sample_csv" string="Download Sample Csv" type="object"/>
</footer>
</form>
</field>
</record>`
弹出窗口窗体视图:
BEFORE UPDATE
每次我点击弹出窗口按钮,都会打开一个窗口,这是我想要的,但是在树视图中也会创建一个新的空记录。任何人都可以告诉我它为什么会发生以及如何防止odoo创建一个新的空记录。