Hi,
I have a button, when i click this button it shows a form in popup. But when i click it will shows an error "Form could not be loaded"
My Code:
In Python,
class AccountInvoice(models.Model):
_inherit = "account.invoice"
def attach_documents(self):
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'upload.file',
'res_id': self.id,
'target': 'new',
'context': {'default_invoice_id': self.id}
}
class UploadFile(models.Model):
_name = "upload.file"
attachment_ids = fields.Many2many(
'ir.attachment',
string='Attachments',
help='Attachments are linked to a document through model / res_id')
In XML,
<record id="invoice_supplier_tree_inherit" model="ir.ui.view">
<field name="name">account.invoice.supplier.tree.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_tree" />
<field name="arch" type="xml">
<xpath expr="field[@name='state']" position="after">
<button name="attach_documents" string="Attach" type="object"
icon="fa fa-paperclip" class="fa-paperclip" />
</xpath>
</field>
</record>
can anyone help me to resolve this issue.