Hi everybody. Today I add a button in my form view, but when I enter view my button is not enabled.
What happened?
This is my code..
<button name="costos" type="object" string="CostoCalculo" />
costos is a function.
Thanks :)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi everybody. Today I add a button in my form view, but when I enter view my button is not enabled.
What happened?
This is my code..
<button name="costos" type="object" string="CostoCalculo" />
costos is a function.
Thanks :)
Thanks for support.
This is my code:
View (sales.xml):
<record model="ir.ui.view" id="linea_pedido_tree">
<field name="name">linea_pedido.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/form[@string='Sales Order Lines']/field[@name='name']" position="after">
<div string='Especificaciones'>
<label for="especificacion_especial_line"/>
<field name="especificacion_especial_line">
<tree string="Especificaciones Especiales">
<field name="product_id"/>
<field name="ancho"/>
<field name="alto"/>
</tree>
<form string="Especificaciones Especiales">
<field name="product_id"/>
<field name="ancho"/>
<field name="alto"/>
<field name="mecanismo"/>
<button name="costos" type="object" string="Otro" />
</form>
</field>
</div>
</xpath>
</field>
</record>
My class py (sales.py)
class linea_pedido(osv.Model):
_inherit = 'sale.order.line'
_columns = {
'especificacion_especial_line': fields.one2many('sale.order.hud',
'order_line_id', 'Especificaciones especiales'),
}class sale_order_hud(osv.Model):
_name = 'sale.order.hud'
def costos(self, cr, uid, ids, context=None):
print 'this is a messagge'
res = {}
for a in self.browse(cr, uid, ids, context):
for b in a.especificacion_especial_line:
res = (b.ancho + 20.2)
return res_columns = {
'order_line_id': fields.many2one('sale.order.line',
'Referencia linea de compra', ondelete='cascade', invisible=True),
'product_id': fields.many2one('product.product', 'Nombre de tela'),
'ancho': fields.float('Ancho', digits=(2, 2)),
'alto': fields.float('Alto', digits=(2, 2)),
'mecanismo': fields.selection([('izquierda', 'Izquierda'), ('derecha',
'Derecha')], 'Ubicacion del mecanismo'),
}
My __init__.py
import sales
My __openerp__.py
{
'name': 'Module Sales',
'version': '0.1',
'author': Carlos',
'description': "Carlos",
'summary': 'carlos',
'category': 'Customization',
'website': '',
'depends': [
'base',
'crm',
'l10n_mx_cities',
'l10n_mx_settings_facturae',
'l10n_mx_facturae_pac',
'l10n_mx_sale_payment_method',
'l10n_mx_purchase_payment_method',
'l10n_mx_account_invoice_tax',
'l10n_mx_facturae_pac_sf','sale',
'sale_stock',
'point_of_sale','purchase',
'stock',
'mrp',
'project',
'account',
'hr',
'knowledge',
'fleet',
],
'data': [
'vistas/sales.xml',],
'demo': [
# Aqui van datos de demostracion
],
'test': [
# Archivos de testing
],
'installable': True,
'application': True,
'auto_install': False,
'images': [
],
}
That's all. In my XML view the button is named = costos.
Thank you for all.
Could be so many things there. Post a snippet of your code, maybe we can analyse some more.
If the button does not show up, make sure that you have the modified XML file in your __openerp__.py file, in the right list.