# A customer's branches: register, deactivate and unlink

> For the administrator: register a customer's branches and delivery addresses, mark partial delivery, deactivate, delete or unlink a branch.

Source: https://vendria.com/en/ajuda/filiais-de-um-cliente

## Where to find it

In the menu, under **Customers**: open the customer and go to the **Branches** tab, card **Group
branches**. For a customer with no branch yet, use the **Add branches** button
at the top of the profile: it opens the same tab. When the customer is already a group, the top of the
profile shows the badge **Group · N branches**.

Registering, editing and deleting branches is for the administrator. The seller sees the branches
on the profile, for reference only.

## What a customer's branches are for

A branch is a CNPJ or a delivery address **under** the customer. It's with them
that an order can be invoiced to a specific store in the chain and that the
quantity of a line can be distributed among the customer's stores. See [Rateio: distribuir a quantidade de uma linha entre as filiais do cliente](/ajuda/rateio-entre-filiais).

A branch is not another customer: it has no seller, buyers, table or discount
of its own: all of that belongs to the customer.

## The columns of the branch table

**Code**, **Name**, **Legal name**, **CNPJ** (**no CNPJ** in amber when
missing), **City/State** and **ERP** (in which ERP connections that branch exists).
The row badges:

- **Head office**: the customer's own CNPJ. The head office can't be deleted or deactivated.
- **Delivery (DC/LO)**: delivery-only address, without its own invoicing.
- **Inactive**: deactivated branch; the row is faded.
- **Does not accept partial**: the branch doesn't take half deliveries.
- **Linked manually**: someone linked the branch to the customer by hand, because the
  ERP doesn't declare this relationship.

## How to register a branch

1. On the **Branches** tab, click **New branch**.
2. Fill in at least one of **Name**, **Legal name** and **CNPJ** (the CNPJ is
   optional).
3. If you want, fill in **State registration** and **Buyer code**: the code
   the customer itself uses for that store (for example **003**), not the
   branch number in your ERP.
4. In **Type**, choose **Branch (billable)** or **Delivery (DC / logistics
   operator)**.
5. Leave checked or uncheck **Accepts partial delivery**.
6. Click **Save**. The message **Branch created** confirms.

The pencil on the row opens **Edit branch** with the same fields. On the head office, the
**Type** stays fixed as branch.

## Accepts partial delivery

When stock runs short on an order split among branches, someone decides who gets
what exists. Unchecked, **Accepts partial delivery** says this branch is
served **in full or later**, never halfway. Use it for a
small store, or one that only receives on set days, and for those for whom a half delivery costs two
checks and two freights.

## Delete, deactivate or unlink a branch

- **X** (**Delete**): on a regular branch. Vendria asks **Delete the branch
  "<name>"?** first.
- **Unlink**: on a **Linked manually** branch. Undoes the link with
  this customer; the aliases the branch learned are lost.
- **Reactivate**: on an inactive branch, activates it again.

⚠️ **Delete only erases when no order points to the branch.** If any
order uses the branch, it is only **deactivated**, and the screen warns **Branch deactivated
— it has orders pointing to it.** A deactivated branch **still occupies
the CNPJ**: that CNPJ can't come in as a customer of its own or as a branch of
another. To free it, remove its items from the orders and remove it again.

There is no undo: a deleted branch only comes back if it's registered again.

## Customer with branches from the ERP

When the ERP is what reports the customer's branches, invoiceable branches can't be
created, edited or deleted here. The screen responds **This customer's branches
come from the ERP and can't be managed here.**: register in the ERP and the
sync brings them.

Two exceptions remain yours: addresses of type **Delivery (DC / logistics
operator)**, which the ERP never writes, and **Linked manually** branches, which
are unlinked normally.

## When the branch's CNPJ is already a customer

If the CNPJ typed is already a customer with its own record, saving is refused with
**This CNPJ is already the customer <name>.** and a shortcut **Open <name>**. The right
path is to use that customer (for example, as the order destination) and not
duplicate it as a branch.

## Branches are not related companies

Below the table, **Related companies** may appear: other **customers**
linked to this one by CNPJ root, ERP group, manual link or by having already
appeared together in an order. They have their own record and don't become branches. The
list serves to suggest a destination in an order; **Undo link** erases only the
recorded links (manual or learned).

## When it goes wrong

- **"Enter the branch's name, legal name or CNPJ."**: fill in at least one
  of the three.
- **"The head office can't be removed."** / **"The head office can't be deactivated."**:
  the head office goes with the customer.
- **"The head office must be of type branch."**: the head office doesn't become a delivery address.
- **I deleted it and the branch is still there, inactive**: it has orders; see the
  deletion section above.
