i am trying to create a button that link to account.invoice so this button can make a post request of json data to some url:
what i have achieved is i am able to create a button in customer invoice
right now when i click on custom button the error appear like this
AttributeError: type object 'account.invoice' has no attribute 'labeltest'
So, this is my shippinglabel.xml file
<record id="invoice_form_shippinglabel" model="ir.ui.view">
<field name="name">account.invoice.form.shippinglabel</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<header>
<button name="labeltest" type="object" string="Print Shipping Label" class="oe_highlight"/>
</header>
</field>
</record>
my models.py
from odoo import models, fields, api import json, urllib2.
@api.multi def labeltest(self):
data = {'ids': [12, 3, 4, 5, 6]}
req = urllib2.Request('https://requestb.in/1bz11jv1')
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data))
PLEASE HELP