Hi
In the res_partner model/table, there is a field which holds the Partner name and the field is called "name" (not surprising)
Then there is this line of code in the sale_view.xml:
Code:
<field name="partner_id" on_change="onchange_partner_id(partner_id)" ...
that calls this onchange_partner_id method/function:
Code:
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False, 'payment_term': False, 'fiscal_position': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery', 'invoice', 'contact'])
part = self.pool.get('res.partner').browse(cr, uid, part)
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
payment_term = part.property_payment_term and part.property_payment_term.id or False
fiscal_position = part.property_account_position and part.property_account_position.id or False
dedicated_salesman = part.user_id and part.user_id.id or uid
val = {
'partner_invoice_id': addr['invoice'],
'partner_order_id': addr['contact'],
'partner_shipping_id': addr['delivery'],
'payment_term': payment_term,
'fiscal_position': fiscal_position,
'user_id': dedicated_salesman,
}
if pricelist:
val['pricelist_id'] = pricelist
return {'value': val}
that somehow puts the contents of the "name" column into the "partner_id" field on the screen. How is that linked together since there is no mention of "name" anywhere and the partner_id is just an key field.
Thanks in advance
O.