Auto Populate currency_id Field in Custom Module

Good afternoon,

Apologies if the answer to this question is blindingly obvious but I've tried all of the normal things I can think of to do this but I cannot get it to work.

I've created two modules (a_po_header and a_po_detail) which are to contain Header data and Detail data respectively. I've got these set up but I'm just missing this final bit.

Essentially what I want to do is:

When the currency is set in the Header record, any Detail records created through the Header subpanel should have all currency fields defaulting to the same currency as defined by the Header. At the moment I can set the Header currency to dollars but the Detail line always shows pounds.

I'm familiar with populate_list and have tried to use this in the relationship vardef as below:

$dictionary["a_po_header"]["fields"]["a_po_header_a_po_detail_1"] = array (
'name' => 'a_po_header_a_po_detail_1',
'type' => 'link',
'relationship' => 'a_po_header_a_po_detail_1',
'source' => 'non-db',
'module' => 'a_po_detail',
'bean_name' => 'a_po_detail',
'vname' => 'LBL_A_PO_HEADER_A_PO_DETAIL_1_FROM_A_PO_HEADER_TITLE',
'id_name' => 'a_po_header_a_po_detail_1a_po_header_ida',
'link-type' => 'many',
'side' => 'left',
'populate_list' => array(
'currency_id' => 'currency_id',
),

);

However, this isn't working.

I have tested to see if the from side is failing using the below:

'populate_list' => array(
'currency_id' => 'description',
),

But the description in the Detail line does get populated with the currency id, so I'm unsure why it doesn't appear to map to currency_id.

I have also tried to populate the a_po_detail currency_id field using a logic hook to no avail and also briefly looked at business processes but didn't have any luck here either.

The only way I've been able to get this to partially work is to create a formula through the extended vardefs, but this only updates the currency after the record has been saved; ideally I'd want the correct currency to display before the record is displayed.

Any help which can be provided would be most appreciated.

 

Many thanks,

Ian