Hello.
I'm making a new module, and the view I have a button that calls a function passed as parameter a char field. My intention is that when I press the fill another field with the description of the field that I pass as a parameter. The problem I have is that I have not made any button so far and I do not work well. I think the view I have no right to call the method declared "generar_nombre_producto" or that the .py, in the function declaration, I haven't the code correctly.
My code is as follows:
Code:
.......
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="categ_id" position="replace">
<field name="categ_id" on_change = "onchange_categ_id(categ_id)"/>
</field>
<xpath expr="/form/notebook[@colspan='4']/page[@string='Information']" position="after">
<page string="Información 2">
<group colspan="6" col="6">
............
<field name="descripcionarticulo" colspan="3"/>
<button name="generar_nombre_producto(descripcionarticulo)" string="Generar nombre producto" type="object" icon="icon" colspan="3"/>
<field name="campoprueba" colspan="6"/>
</group>
and the .py ...
Code:
class product_product(osv.osv):
_inherit = 'product.product'
_name = 'product.product'
.....
_columns = {
......
'descripcionarticulo' : fields.char('Descripción adicional', size=128),
'campoprueba' : fields.char('campo prueba', size=256),
}
def generar_nombre_producto(self, cr, uid, ids, descripcionarticulo_param):
descripcionarticulo_obj = self.pool.get('product.descripcionarticulo')
descripcionarticulo = descripcionarticulo_obj.browse(cursor,user,[descripcionarticulo_param])[0]
#####descripcionarticulo_obj = self.browse(cr, uid, ids)
#####descripcionarticulo = self.read(cr, uid, ids, ['product_id'],context)
values = {}
values = {'campoprueba' : descripcionarticulo}
return {'value': values}
product_product()
I hope I have specified either my problem. Sorry for my English.
Anyone can help me??