**Step 1: Create Base Pricelist**

Create a pricelist that defines your base pricing logic:

#. Go to Sales → Configuration → Pricelists
#. Create a new pricelist: "Base Pricelist - Last Purchase Price"
#. Add a rule:

   * **Apply On:** All Products
   * **Based on:** Last Purchase Price (or List Price, Standard Price, etc.)
   * **Price Computation:** Formula
   * **Discount:** 5% (example for "cesta básica" category)

**Step 2: Create Chained Pricelist with Total Margin**

#. Create a new pricelist: "Category Margin - Your Category"
#. Add a rule:

   * **Apply On:** All Products (or specific category)
   * **Based on:** Other Pricelist → Select your base pricelist
   * **Price Computation:** Formula
   * **Discount:** -25% (negative = 25% markup)
   * **☑️ Total Margin Mode:** Check this box!
   * **Calculation Method:** Choose between:

     * **Markup (on cost)** - Default, calculates ``PVP = Cost × (1 + markup%)``
     * **Commercial Margin (on PVP)** - Calculates ``PVP = Cost / (1 - margin%)``

**Step 3: Configure Global Limits (Optional)**

Set enterprise-wide minimum and maximum margins:

#. Go to Settings → Sales → Total Margin Limits
#. Configure:

   * **Minimum Margin (%):** E.g., 10% (no product can have less margin)
   * **Maximum Margin (%):** E.g., 50% (no product can have more margin)
   * **Calculation Method:** Choose how these percentages are interpreted

     * **Markup (on cost)** - Default
     * **Commercial Margin (on PVP)**

**Important:** The global limits calculation method is independent from individual pricelist items.

**Step 4: Assign to Products**

* For automatic price calculation, configure the pricelist in Settings → Sales → Automatic Price Configuration
* Or assign the pricelist to specific customers/partners
