ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Multiple, shops, employee and branches

Hello everyone.
I have multiple branches in a country with employees, different landed costs (because of shipping)
and on going sales and costs.
I don’t know how I should set it up? what is the best practice in your experience? should i use branch in HR or cost center each one? or create an accounting dimension for branches?
and how will the different landed cost in different warehouses work?
TNX

You can use cost center for your branches to generate financial statements. For HR, you can use the branch document in HR. Landed cost voucher is based on purchase receipt. So that won’t be an issue

Maybe you can also try to create more Company as the branches.
They all depend on your requirements.

This is a pretty normal scenario, and the best practice must be decided by accountants. Branches themselves will handle most of the issues like landed cost and HR.

I will not recommend this

And why is that?

Many reasons

For one, you transfer goods amongst branches, if you set the branches up as different companies, transfer of inventory becomes more complicated.

Also from an accounting reporting perspective, you give yourself unnecessary headaches by setting up a branch as a separate company

Just two of several reasons

Make sense…
But ERPNext does support inter-company transactions, right?
And for some doctypes, the companies share databases, right?

#moretolearneveryday :slight_smile:

I thank all experts helping me here.
is there a consensus?

You can do setup like below (assuming branch is not a legal entity and not having independent license/registration)

  • Create cost_center/branch wise warehouses.
  • Add Custom Fields
    cost_center/branch in Warehouse Doctype
    default_warehouse in Cost Center/Branch Doctype
  • Add Branch as Accounting Dimension (Cost Center Accounting Dimension is already exists in all the documents by default)
  • Write Custom Script to fetch default warehouse, update warehouse query filter and set parent value in child
  • Setup User Permission to restrict user to access only allowed cost_center/branch

Sample Custom Script for Sales Invoice

frappe.ui.form.on('Sales Invoice', {
	setup: function(frm){
		frm.add_fetch('cost_center', 'default_warehouse', 'warehouse');
		frm.add_fetch('cost_center', 'default_warehouse', 'set_warehouse');	
	},
	cost_center: function(frm){
		cur_frm.cscript.overrides_parent_value_in_all_rows(frm, "items", "cost_center", "cost_center");
		cur_frm.cscript.overrides_parent_value_in_all_rows(frm, "taxes", "cost_center", "cost_center");		
	},
})

cur_frm.cscript.overrides_parent_value_in_all_rows = function(frm, table_fieldname, parent_fieldname, fieldname){
	$.each(frm.doc[table_fieldname] || [], function(i, row) {
		row[fieldname] = frm.doc[parent_fieldname];
	});			
	frm.refresh_field(table_fieldname);
} 

$.extend(erpnext.queries, {
	warehouse: function(doc) {
		return {
			filters: [
				["Warehouse", "company", "in", ["", cstr(doc.company)]],
				["Warehouse", "is_group", "=",0],
				["Warehouse", "cost_center", "=", cstr(doc.cost_center)]				

			]
		};
	},
});

After above setup, you can:

  1. Do inter-branch stock transfer (material transfer from one warehouse to another)
  2. See branch-wise profitability report
  3. Define branch-wise Income/Expense/Stock Account
  4. Maintain branch wise Cash/Bank Accounts (like warehouse, you can add custom fields for default cash/bank account in Cost Center/Branch Doctype.

Note : Instead of Branch you can also use Cost Center which is available by default in all the documents.

Hope this will help you.

1 Like

Hi, in which regions do you operate? I would like to explore if we can collaborate, I think our business models complement. Please send me a direct message in Whatsapp of viber +639178061182 my email is info@evegrocer.com

1 Like

Thanks alot. But we supply building materials I dont know how we can cooperate.

Dear Sanjay
In your 5th point you said
5. Write custom script to update document warehouse on selection of branch (should be the warehouse defined under branch)
Can you guide me how to do that?

nope, that’s mean each branch has its own financial statements, imagine your tax report.

I think using branch as cost center is the best, and create script to automate employee user permission per branch

1 Like