Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Custom Field "Service Fee %" in Sales Order Line

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
sale.order.linestudio18.0automation-rules
4 Răspunsuri
1606 Vizualizări
Imagine profil
Zulfikri

Hi,

i need custom that named "Service Fee %" in sales order line like image below,


i noticed the service fee that i input didn't automatically change the total amount(field : subtotal) of in sales order line, i think i need an automation rule so the total amount change when i input the service fee. So, i did like this

BUT, when i make new sales order and input the quantity, price, etc and save it. Seem like an error appear and my Odoo frezeed. Any solution of this or the best approach for this case? 

0
Imagine profil
Abandonează
Imagine profil
D Enterprise
Cel mai bun răspuns

Hii,

Solution (No Code, No Studio)

1. Stop updating price_subtotal — it's a computed field.

2. Do this instead:

  • Create a new float field: x_service_fee_percent on sale.order.line
  • Create a new monetary field: x_adjusted_subtotal on sale.order.line (linked to currency_id)
  • Automation Rule (Safe Calculation)
  • Go to Settings → Technical → Automation → Automated Actions → Create:
    • Model: Sale Order Line
    • Trigger: On Creation & Update
    • Trigger Fields: x_service_fee_percent, price_unit, product_uom_qty, discount
    • Action To Do: Update the Record
  • Field to update:
  • x_adjusted_subtotal → Use this expression:

add this code in automation rule:

((record.price_unit * record.product_uom_qty) * (1 - (record.discount or 0)/100.0)) * (1 + (record.x_service_fee_percent or 0)/100.0)
i hope it is usefull

1
Imagine profil
Abandonează
Zulfikri
Autor

Hi, Thank you so much that work really well, but i still have an issue. Please check my new reply, i hope u can help

Imagine profil
Jainesh Shah(Aktiv Software)
Cel mai bun răspuns

Hello @Zulfikri,

 

Add the Action named 'Execute Python code' in Your Automated Action as shown in below image.

 



After that add below Python code in your automated action.

 

# Step-by-step safe evaluation of subtotal with service fee

 

# Step 1: Get quantity

qty = record.product_uom_qty or 0.0

 

# Step 2: Get unit price

price = record.price_unit or 0.0

 

# Step 3: Get service fee (as percentage, e.g. 0.10 = 10%)

fee = record.x_studio_service_fee or 0.0

 

# Step 4: Compute multiplier

multiplier = 1.0 + fee

 

# Step 5: Calculate total with service fee

total_with_fee = qty * price * multiplier

 

# Step 6: Store in custom field

record.write({'x_studio_service_fee' : total_with_fee})

 

If you have any questions or need further assistance, feel free to reach out.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

0
Imagine profil
Abandonează
Zulfikri
Autor

Hi, thank you so much, i have tried something like that, seems like it only make an change visually, am i right?. I still cant change the total on the bottom of the order line, invoice, and for the journal item as well

Imagine profil
Zulfikri
Autor Cel mai bun răspuns

Hi Desk Enterprise,

Thank you so much that work really well, but i still have an issue. How to change the "Total" (which I marked with a red box) below the sales order line so it can updated based on "Total Amount" that we already customized?


0
Imagine profil
Abandonează
D Enterprise

Override price_subtotal (Recommended for direct integration)
Instead of using x_adjusted_subtotal, override the standard field price_subtotal with your formula.
Update your Automation Rule:
Model: Sale Order Line

Trigger: On Update & Create

Trigger Fields: x_service_fee_percent, price_unit, discount, product_uom_qty

Action: Update the Record

Update Field: price_subtotal

Value:
((record.price_unit * record.product_uom_qty) * (1 - (record.discount or 0)/100.0)) * (1 + (record.x_service_fee_percent or 0)/100.0)
i hope this is solve the error

Imagine profil
Piyush H
Cel mai bun răspuns

Dear Zulfikri,

here's how to implement this entirely through the Odoo interface:

Method 1: Using Studio (Recommended)
  1. Install Studio
    • Go to Settings → Apps → Search for "Studio" → Install
  2. Add the Service Fee % Field
    • Open any Sales Order
    • Click the "Edit Form" button (pencil icon) in top-right
    • Click "+" to add a new field
    • Field Name: x_service_fee_percent
    • Field Label: "Service Fee %"
    • Field Type: Float
    • Widget: Percentage (or Monetary if you prefer currency format)
    • Save the field
  3. Create an Automated Action
    • Go to Settings → Technical → Automation → Automated Actions
    • Create a new record:
      • Name: "Update Subtotal with Service Fee"
      • Model: Sales Order Line
      • Trigger: On Update
      • Apply On: [Your specific domain if needed, or leave blank]
    • In "Actions To Do" tab:
      • Add Action → Execute Python Code
      • Paste this (simplified version that won't cause recursion):

python

for line in records:
    price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
    fees = line.x_service_fee_percent or 0.0
    line.price_subtotal = price * line.product_uom_qty * (1 + fees / 100.0)
Method 2: Using Only Standard Features

If you can't use Studio, try this workaround:

  1. Create a Discount Field Workaround
    • Go to Settings → Technical → Database Structure → Fields
    • Create a new field:
      • Model: sale.order.line
      • Field Name: x_service_fee_percent
      • Field Type: Float
      • Label: "Service Fee %"
  2. Modify the Sales Order Line View
    • Go to Settings → Technical → User Interface → Views
    • Find the sale.order.line form view
    • Click "Edit" and add your field after price_unit
  3. Use a Computed Field (Still no-code)
    • In the same Fields section, edit your x_service_fee_percent field
    • Check "Computed"
    • For the compute method, use:
      python
      def _compute_service_fee(self):
          for line in self:
              line.x_service_fee_percent = line.price_subtotal * 0.10  # Example 10% fee
Important Notes
  1. Performance Warning: No-code solutions may be less efficient than proper code implementations
  2. Backup First: Always backup your database before making structural changes
  3. Testing: Try this in a test environment first

Alternative: Consider using the "Margin" field that already exists in Sales if it meets your needs

🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to set default view to list view globally
configuration studio 18.0
Imagine profil
Imagine profil
1
apr. 25
1715
Sale order to purchase order with all line of Sale order
sale.order.line purchase_order studio
Imagine profil
Imagine profil
Imagine profil
2
dec. 23
2475
Odoo 18: Create/Override Odoo studio
create studio path components 18.0
Imagine profil
0
sept. 25
532
Carry over data and content from CRM card to Project card
opportunities project crm studio won 18.0
Imagine profil
Imagine profil
1
nov. 25
269
debit and credit in currency
studio
Imagine profil
Imagine profil
1
nov. 25
2134
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now