How to use a product extra-field in an INVOICE

Hello, i’ve created an extra field for products (ex: myprexfi) and i’ve created also an extra field for INLINES at INVOICES, which i want to automatically populate with the value of the field myprexfi of the product being added on that invoice’s line. This is called on Dolibarr as COMPUTED FIELD.

My problem is that i don’t know how to populate the attribute Computed field with the correct expression. I’ve tested almost 50 different combinations of expressions but none run:

$object->customfields->myprexfi
$object->customfields['myprexfi']
$object->extrafields->myprexfi
$object->extrafields['myprexfi']
$object->array_options->myprexfi
$object->array_options['myprexfi']
$object->array_options['options_myprexfi']
....

Please help! :wink:

Hello,

It is not possible to do that with computed field.
The product extra fields are not loaded in the line filed.

You need to write a module.

As far as I understood from Extrafield docs, it is possible using object reloading from $db. I have a similar TODO in my backlog, I´ll keep this posted on any updates.