python - OpenERP 7: Adding a button on a product view -


i playing openerp 7. doing testing , building first add-on. want add on every product view "synchronize" button on tab named "special" has been created add-on (which works fine). button displays when click on obtain following error:

attributeerror: 'product.product' object has no attribute 'custom_export' 

if can explain me why have error , how fix it.

my add-on folder name is: custom_synchronizer, have 4 files inside.

__init__.py

import product 

__openerp.py__

{     "name" : "custom synchronizer",     "version" : "0.1",     "author" : "ajite",     "category" : "product",     "depends" : ["product"],     "init_xml" : [],     "demo_xml" : [],     "update_xml" : ["product_view.xml"],     "installable": true,     "active": true } 

product.py

from openerp.osv import orm, fields  class product_product(osv.osv):         _name = 'product.product'         _columns = {}          def custom_export(self, cr, uid, ids, context=none):             f = open('/home/ajite/faytung.txt','w')             f.write('hi there !')             f.close()             return true product_product() 

product_view.xml

<?xml version="1.0" encoding="utf-8"?> <openerp>     <data>         <record id="product_normal_form_view" model="ir.ui.view">             <field name="name">product.product.form</field>             <field name="model">product.product</field>             <field name="inherit_id" ref="special.product_normal_form_view"/>             <field name="arch" type="xml">                 <page name="special" position="inside">                     <button name="custom_export" string="export" icon="gtk-execute" type="object"/>                 </page>             </field>         </record>     </data> </openerp> 

change _name _inherit in product_product class definition.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -