Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Custom Field "Service Fee %" in Sales Order Line

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
sale.order.linestudio18.0automation-rules
4 Respuestas
1579 Vistas
Avatar
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
Avatar
Descartar
Avatar
D Enterprise
Mejor respuesta

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
Avatar
Descartar
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

Avatar
Jainesh Shah(Aktiv Software)
Mejor respuesta

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
Avatar
Descartar
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

Avatar
Zulfikri
Autor Mejor respuesta

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
Avatar
Descartar
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

Avatar
Piyush H
Mejor respuesta

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
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
How to set default view to list view globally
configuration studio 18.0
Avatar
Avatar
1
abr 25
1707
Sale order to purchase order with all line of Sale order
sale.order.line purchase_order studio
Avatar
Avatar
Avatar
2
dic 23
2465
Odoo 18: Create/Override Odoo studio
create studio path components 18.0
Avatar
0
sept 25
526
Carry over data and content from CRM card to Project card
opportunities project crm studio won 18.0
Avatar
Avatar
1
nov 25
259
debit and credit in currency
studio
Avatar
Avatar
1
nov 25
2125
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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