Hi guys
I dont know what's going on here I tried to set as readonly two buttons when for example I click on it but this dont work.
I have 5 boolean fields to help and I store the True or False option on a database
I have a funtion to update the fields.
class account_invoice(osv.osv):
_inherit = 'account.invoice'
_columns = {
'impressoori' : fields.boolean('Original ja foi impresso'),
'impressodupl': fields.boolean('Duplicado Impresso'),
'impressotri' : fields.boolean('Triplicado ja foi impresso'),
'impressoall' : fields.boolean('Todas as vias ja foram impressas'),
'impressoseg' : fields.boolean('Segunda via ja impressa')
}
_defaults = {
'impressodupl': False,
'impressoori': False,
'impressotri': False,
'impressoall': False,
'impressoseg': False,
}def update_field_all(self, cr, uid, ids,context):
for invoice in self.browse(cr, uid, ids):
cr.execute("UPDATE account_invoice SET impressoall = True WHERE id = %d" %(invoice.id) )
cr.execute("UPDATE account_invoice SET impressodupl = True WHERE id = %d" %(invoice.id) )
cr.execute("UPDATE account_invoice SET impressotri = True WHERE id = %d" %(invoice.id) )
cr.execute("UPDATE account_invoice SET impressoori = True WHERE id = %d" %(invoice.id) )
#raise osv.except_osv(_('This is the error title'), _('This is the error message'))
return True
My Xml file :
record model="ir.ui.view" id="account_invoice_rule_saft_inherit">
<field name="name">account.invoice.rule.saft.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<notebook colspan="4" position="after">
<!--<button name="%(account.account_invoices)d" position="replace">-->
<group col="1">
<field name="impressodupl" nolabel="0" invisible="False" />
<field name="impressoori" nolabel="0" invisible="False" />
<field name="impressotri" nolabel="0" invisible="False" />
<field name="impressoall" nolabel="0" invisible="False" />
<field name="impressoseg" nolabel="0" invisible="False" />
</group>
<button name="%(account_invoices_tri_default)d" type="action" string="Triplicado" icon="gtk-print" states="open,paid,proforma,proforma2" attrs="{'readonly':[('impressoall', '=', True)]}"/>
<button name="account_invoices_all_default" type="action" string="Todas as Vias" icon="gtk-print" attrs="{'readonly':[('impressoall', '=', True)]}" states="open,paid,proforma,proforma2" />
</notebook>
</field>
</record>