create a new module

Hi all

I would like to duplicate the module of invoice in my dolibarr.
In the actual module it could be for Invoice ~s and the other one is for a kind of Proforma invoice ( not exactly but similiar ).
Instead of i create a new on is it possible to duplicate and give a different name when they are opned ?

As im not a experient in programing is it possible anyone tell me how to do it ?

Thank you
Antonio

If you are trying to create your own custom php to pdf invoices,

  1. go to /htdocs/core/modules/facture/doc
  2. make a copy of pdf_crabe.modules.php and rename it to pdf_myinvoice.php
  3. near the top add
 
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';

/**
 *	Class to manage PDF invoice template Crabe
 */
class pdf_myinvoice extends ModelePDFFactures
{
  1. around line 43, rename
class pdf_crabe extends ModelePDFFactures

to

class pdf_myinvoice extends ModelePDFFactures
  1. around line 88&89
		$this->name = "My Invocie";
		$this->description = $langs->trans('This is a custom invoice');
  1. around line 150 add the following just above $outputlangs
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$object->fetch($rowid);
$object->fetch_optionals($rowid,$extralabels);
2 Likes

After all that, go to Setup > Modules > Invoices and set My Invoice to the Default Invoice.

1 Like

Thank you so much for your reply.
I dont know if i made myself clear but what i would like to have is the following as the image.

In fact i want to have ON the invoice module, but i would like to have another module exactly the same as the parameters of the invoice but with different name ( in image i called Restauros), and the function of this module will be almost the same . For some kind of products i use ( comercial as in image ) that is the module of invoices, and for other kind of products i use the (restauros ).

Can you explain me how to do it ?

Thank you in advance

Pièces jointes :

the image attached