Vendor Code manual setup in Third Party

Hi all,
in most cases, my vendors already provided me with an existing vendor code.
This vendor code does not match the automatic vendor code creation of dolibarr.
Unfortunately, I can’t just deactivate the “Elephant” module to create the vendor code on my own, because I still would like to be able to auto create the third party code by dolibarr.
Is there any chance to deactivate the auto creation just for the vendor code ?
Even typing the vendor code on my own does not work, because the already provided vendor code does not match the rules in the “Elephant” module.

I also tried to create with Extra fields an additional field, but when changing the musquet script, the manual for implementing extra fields to PDF does not work here and crashes the website, once trying to create the PDF. I assume, that the call to the extra field does not work the same way as it would be working in the invoice, because I set the extra field already in the third party settings.

Anyone able to help ?

Thanks in advance

Hi,

For your first question : no it is not possible to desactivate the naming rules for vendor
Usually people use Extra fields to do that.

Then your second question, if you read carfully the wiki you should be able to do it.
If your website crash means that you made a php code error.
If you send the error and the code you have done we can try to see why it is not working

Hi Ksar,
thanks for the information.
I followed exactly the manual from here:

https://wiki.dolibarr.org/index.php/Add_Extrafields_on_PDF_Models

It did not match in 100% to the file, so I was slightly struggling with the exact execution.

What I did :

-added a complementary attribute to the third party module

-took the pdf_muscadet.modules.php and prepared my version
-the version i created was working before I added the code (to proof the change)

Find the code in attachment.

pdf_muscadet_vd.modules.php.zip (11.7 KB)

Thanks for the help so far!

Hi,

Your model is not working because there is a php syntax error

				$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);

When you do that, you ask extrafields for the $object supplier_order
But this object doesn’t have extrafields, because you create extra fields on third party object

In fact Third Party extra fields are already loaded in the object.
So you need to :

Remove

require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';

and remove

				$extrafields = new ExtraFields($db);
				$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);

				$object->fetch($rowid);
				$object->fetch_optionals($rowid,$extralabels);*/

Simply use :

$pdf->writeHTMLCell (190,3, $this->posxdesc-1, $tab_top-5, $outputlangs->convToOutputCharset($object->thirdparty->array_options['options_kd1']),0,1);

I have updated the wiki : https://wiki.dolibarr.org/index.php/Add_Extrafields_on_PDF_Models#Special_Case_for_Third_party_extrafields