Little dev tips for extrafields

Hey, just a little tip,
I’m creating a new module for Elettronic Invoice for italy so i need that the user give me more data about thirdparties , invoices and his own company
I already created extrafields for thirdparty and invoice but i can’t find an extrafields to add data of his company
Should add fields in module setup view or what?
Thanks

I think that in Dolibarr “third party” is the same as “company”.

You must add “extrafields” for THIRD PARTIES (“societes” in database table):

I may be mistaken here @caos30, but I think he meant his company, aka the line above in the left menu of your picture.

If so @zelly74 what kind of data are you talking about, where and when are they used?

Ah, you’re right, it probably refers to that.

In that case:

  • I’m not sure if the concept of company “extrafields” exists
  • one way to solve it would be by editing the invoice templates, or creating a new modified version to use when needed (that’s very convenient, I use it often)
  • the other way would be to create the “extrafields” as extra attribute fields for INVOICES and set default values according to what you need to appear, which will normally always be the same.

In this last case, you need to make sure those fields appear in the PDF, and that’s well explained here:

Best regards

Give you some context:
I wanna create an open source module to manage Italian elettronic invoice so other gonna use my module so it must work out of the box (no custom code into dolibarr core)

The data i need to create a italian elettronic invoice:

Copmany:

  • id country [IT]
  • vat code (0248291085)
  • Name (alburl s.r.l.)
  • Addresses CAP ecc…
  • REGIME FISCALE(RF01) ←
  • Coduce univico (SUBM70N) ←
  • other

Customer:

  • id country [IT]
  • vat code (0248291085)
  • Name (alburl s.r.l.)
  • Addresses CAP ecc…
  • REGIME FISCALE(RF01)
  • Coduce univico (SUBM70N)
  • other

Product:

  • price count ecc…

I can take product and customer data from the dolibarr vanilla database or add simply with some extrafields ($extrafields->addExtraField()) but i dont know how to create a view so the user can insert his own company data (Codice Univoco , Regime fiscale , …)

Then after this, I will probably add some other feature in the future like automatically send the elettronic invoice and other

I just wanna now how to create a view like when you create new customer but with custom fields

I hope somebody can understand what I’m looking for

Maybe is better just create a new database and a view in moduleindex.php to get those data, I don’t now

are we so lucky that all EU countries uses the same electronic invoice format?

I tried a few times but without success.
In the company for the Codice Univoco and the Regime Fiscale I suggest you use a field not used in the company and maybe change the description in the translation.
If you want we can keep in touch I am also Italian

finally i found it !!
when you create a module you can add a TAB in the company by inserting :
// $this->tabs = array(‘mycompany_admin:+tabname:Title:@mymodule:/mymodule/mypage.php?id=ID’);
I created a group on Telegram if you want to join

2 Likes

Really so I can use other country module maybe add just a translation?

Ηι @zelly74 @jonbendtsen

Not really but you can check here per country implementations

and

1 Like

hey @sonikf

It does seem like Denmark uses something which Dolibarr can do according to that wiki page.

Yes, since 2020 all public administrations must be able to receive invoices in the national OIOUBL format and the European PEPPOL BIS 3.0 format.

There is also this page

And this place seems to have some files like this PEPPOL_DK_CIUS_2025-01-23_v1.14.0.afd9776.zip which really resembles the same name I see from other EU countries on the dolibarr wiki page

Acording to Directive 2014/55/EU of the European Parliament all EU countries must use the same electronic delivery mechanism if you will which is the Peppol framework for cross-border exchange of eInvoices. Using the same standard format Bis CII .
The process is really simple and reliable

Sender(Vendor)->Sender access point provider->Peppol Network->Receiver access point provider->Receiver(Buyer)

The problem lies elsewhere, most countries adhere to the directive but also have different rules and formats they use internally for years, also access point providers use different APIs(Some use xml other json format)
Examples:
@zelly74 must use Codice Univoco , Regime fiscale not needed in other countries.
France and Germany chose to use another format Factur-X using a hybrid xml/ pdf which is also accepted from the Peppol network
Greece is already using e-reporting(to be adopted from other countries too) which is another step in the process described above(we are already creating a similar xml using country specific MyData API with an external module).

Dolibarr right now supports only the creation of valid e-invoice xml data through external modules but sending is a matter of access point provider API and country rules.
Receiving of e-invoices is not implemented yet and will be also partially different according to country specific rules.
In conclusion for now although some code parts of modules maybe common the implementation will be different.
My guess is that in upcoming years with the adoption of e-reporting and e-invoicing from every country some code parts will find their way into Dolibarr invoicing core.

My intention was start to understand how to create a good module with Dolibarr functionalities without writing bad code hard to modify in the future. Forget technical implementation for IT electronic invoice, is a complicated topic(im gonna open one other to discuss that), I was just looking for some advice to understand Dolibarr more for future developing than just this module.
Thanks anyway for replies

Already checked there is only one that provide a module that just generate xml (it cost a lot for just doing that) There is a lot of thinks that can be added that can save a lot of time in companies. I gonna do this