hello,I'm working on a custom module that allowed me to maintain the checks journals,so what i need is, when i click on the payments method (one2many) on the "Register payment" choose the option "checks journal", other fields , that i create will appears (checks journal options).Is there a way to do that?help please!
this is my code:
<record model="ir.ui.view" id="view_account_voucher_inherit_form">
<field name="name">Accounts.inherit</field>
<field name="model">account.voucher</field>
<field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='journal_id']" position="inside">
<field name="journal_id" domain="[('type','in',['bank', 'cash' , 'bank'])]"
invisible="context.get('line_type', False)" widget="selection"
on_change="onchange_journal1(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
attrs="{'invisible': [('journal_id','!=','bank')]}"/>
<label for="Number_check" attrs="{'invisible': [('journal_id', 'not in', ('bank','cash'))]}"/>
/> </xpath> </field> </record>
and .py :
from openerp.osv import fields, osv
from bsddb.dbtables import _columns
class cheque_cheque(osv.osv):
_name='account.voucher'
_inherit='account.voucher'
_columns = {
'num_chk':fields.integer('Num Chèque'),
'bank':fields.char('Nom de Banque',size=100),
'rib':fields.integer('RIB'),
'ech':fields.date('Echeance')
}
def onchange_journal1(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, date, amount, ttype, company_id, context=None):
if journal_id == 'bank':
return {'value': {'num_chk':1, 'journal_id':False }}