Adding Country/State Province

Hello everyone,

Thanks for the wonderful job Dolibarr is doing. It has a very promising future.

Quick one, i’ve just seamlessly installed Dolibarr (7.0.1) but finding it extremely difficult to add content to dictionaries. For example, I tried to add, states and provinces to NG under Setup->Dictionaries setup->State/Province but NG is not listed in the Country/Region above dropdown menu.

Please how do I go about solving this?

Thanks in advance

Hi MosDef. Go to Setup->Dictionaries setup->Countries and check if Nigeria is enabled. If it is then go to Setup->Dictionaries setup->Regions to check if you have created regions for Nigeria if not then create them or al least one e.g.
Code 701
Label Nigeria
Country NG - Nigeria
make sure the Region is enabled and you should be able to create State/Province.


Thanks for prompt response…

Works like a charm now…

Kind regards

Regarding the addition of new regions and provinces/states.

This requires a unique NUMERIC field “code_region”. “Unique” as in unique for the entire table, not just this country!
So, some sort of standard should be followed to have logical global codes here. This is further complicated by being only a numeric field.

Looking at the installation sql, I see no logical numbering used with respect to the rest of the world!
One idea would be to append the ISO three digit code to the end.

eg for France

-- Regions France (id country=1)
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1,   2,'97209',3,'Martinique');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1,   3,'97302',3,'Guyane');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1,   4,'97411',3,'Réunion');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1,   6,'97601',3,'Mayotte');

Similarly for provinces.
“fk_region” = “code_region” in the previous example.

“code_departement” is some unique alphanumeric code for the province, and again it must be unique for the entire table. Here it would make sense to use an ISO code as a prefix.

-- Departements France (id country=1)
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 1,'971','97105',3,'GUADELOUPE','Guadeloupe');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 2,'972','97209',3,'MARTINIQUE','Martinique');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 3,'973','97302',3,'GUYANE','Guyane');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 4,'974','97411',3,'REUNION','Réunion');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 6,'976','97601',3,'MAYOTTE','Mayotte');

My point about all this is that there should be some guidance about the creation of these two unique codes as at the moment they can be anything at all…until you come to insert new ones and find they are already in use.

1 Like

After looking at the sql install for regions and departementes it is clear there is no consistency whatsoever between countries. Not good.

If you want to be consistent while creating the regions you can first check the country code assigned to your contry in Dolibarr at:

Then you can add regions numbers accordingly. You can check other countries regions codes at:

I’m going to try to submit a push request for my country’s code based on this information.

Hello Everyone,
Am wondering how i can add the option for choosing the region as a drop down when creating a third party just like the option for selecting the state?
How best can i go about that
Thank you

Hi All,

The country, region, and provinces area is a delaying factor when implementing DoliBarr.

Not all are well defined, even officially. Some countries have colonies. Some colonies are independent countries while others are provinces.

Regions are not included in the database by default. This is understandable because here too there are few standards. And to make matters even more complicated there are many countries which have several region divisions depending on the region criteria used to make the division.

I have done this myself for quite a few countries. And it is time consuming to do this.

May I suggest a change here? If the user (Admin I guess is more appropriate here…) can identify for each country if regions are going to be used or not, and if there is at least a default setting for each country with only 1 region than there is a way to go around this. And for regions there should also be an option to accept different region concepts per country. Some people prefer to use a 4 regions country while others may want 6 regions for the same countries. And if this was to be implemented, it should again be done by country, because this varies per country.

In addition to this, since we have so many members here, everyone could send in the regions for the countries they use and we could compile this in something complete and include it with the default DoliBarr distribution so that we never have to worry about it again other than updating on any changes.

If there is an interest for this, please let me know and I will download all my regions from our Database and send them.

And if you need someone to compile all these regions from all these people, than I can volunteer for this. This will take some time though… And this should also include the Provinces because they are linked to the regions.



Thanks very much for the post. I am trying to add provinces for South Africa but its is saying the record exist. But I know the Provinces are not there. Please assist

Just guessing, but probaly the value you used for “code” (01) has already been taken.

1 Like