hey everybody, i want to add a field in my footer report , here my code: my classe inherited from res_compagny:
class res_company(osv.osv):
_inherit = 'res.company'
_columns = {
'nis': fields.char("N° d'Identification Statistique", size=15),
'ai': fields.char("Article d'Imposition", size=30),
'frm_juri_company': fields.many2one('forme.juridique','Forme juridique',),
}
#the method onchange_footer is in Base/res/res_company , i just add an argument **"ai"**
def onchange_footer(self, cr, uid, ids, custom_footer, phone, fax, email, website, vat, company_registry, bank_ids,ai, context=None):
if custom_footer:
return {}
# first line (notice that missing elements are filtered out before the join)
res = ' | '.join(filter(bool, [
phone and '%s: %s' % (_('Phone'), phone),
fax and '%s: %s' % (_('Fax'), fax),
email and '%s: %s' % (_('Email'), email),
website and '%s: %s' % (_('Website'), website),
vat and '%s: %s' % (_('TIN'), vat),
company_registry and '%s: %s' % (_('Reg'), company_registry),
ai and '%s: %s' % (_('AI'), ai),
]))
# second line: bank accounts
res_partner_bank = self.pool.get('res.partner.bank')
account_data = self.resolve_2many_commands(cr, uid, 'bank_ids', bank_ids, context=context)
account_names = res_partner_bank._prepare_name_get(cr, uid, account_data, context=context)
if account_names:
title = _('Bank Accounts') if len(account_names) > 1 else _('Bank Account')
res += '\n%s: %s' % (title, ', '.join(name for id, name in account_names))
return {'value': {'rml_footer': res, 'rml_footer_readonly': res}}
the xml file: the reference is in res_company_view
<record id="res_company_form_l10n_dz_fouter" model="ir.ui.view">
<field name="name">res.company.form.l10n.dz_fouter</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<data>
<field name="company_registry" position="after">
<field name="ai" on_change="onchange_footer(custom_footer, phone, fax, email, website, vat, company_registry, bank_ids,ai)"/>
</field>
</data>
</field>
</record>
the problem is that nothing is happening even a mistake , is there anymodification to add???