How can i make it ?
i make a custome module , the fields are :
many2one invoice_id(refer to customer invoice number),
many2one order_line (refer to account.invoice.line, the invoice number same as selected invoice_id)
many2one customer_id(refer to partner_id in customer invoice that has the same number as selected item in invoice_id field),and
address field(refer to customer's address in selected invoice_id too)
here's the code :
class faktur(osv.osv):
_name = 'permohonan.faktur'
_columns = {
''invoice_id': fields.many2one('account.invoice',string='Invoice',domain=[('state','=','paid'),('type','=','out_invoice')],required=True),
'order_line': fields.many2one('account.invoice.line', string='Order Line', required=True),
'customer_id': fields.many2one('res.partner', string='Customer',required=True),
'address': fields.char('Address',23),
}
here is xml code :
record model="ir.ui.view" id="permohonan_faktur_form_view">
<field name="name">permohonan.faktur.form</field>
<field name="model">permohonan.faktur</field>
<field name="arch" type="xml">
<form string="Form Permohonan Faktur STNK" version="7.0">
<group col="2" string="Permohonan Faktur STNK">
<group >
<field name="invoice_id" context="{'form_view_ref':'account.invoice_form'}"/>
<field name="order_line" />
<field name="customer_id"/>
<field name="address"/>
</group>
</group>
</form>
</field>
</record>
i want address and customer_id field onchange when i select invoice_id , i want order_line value defend on selected invoice number..