Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Odoo 15 add custom value before invoice total

Suscribirse

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

Se marcó esta pregunta
invoiceinheritaccount.moveformviewv15
2 Respuestas
7842 Vistas
Avatar
Zied dams

Im using _inherit and adding new field in 'account.move'

in the view 

The problem is that 'tax_totals_json' variable is holding all the taxes and totals So that when I use position 'before' or 'after' it doesn't work I want my custom variable to be Before total value,

 I mean inside that Json variable 


any help please !




0
Avatar
Descartar
Zied dams
Autor

Hi and thank you , my problem is that tax_totals_json contains all the taxes and final total , and i want to add my custom value between the taxes values and the final amount value

Avatar
Fazle Rabbi Ferdaus
Mejor respuesta

Hi Zied dams,
tax_totals_json is a computed field and the method that computes the value is "_compute_tax_totals_json". You need make the following changes to add field inside tax_totals_json field.

  • You need to change this method and append your key, value pair in the tax_total_json. here is an example: 


    import json

    class AccountMove(models.Model):
    _inherit = "account.move"

    your_field = ....

    def _compute_tax_totals_json(self):
    super(SaleOrder, self)._compute_tax_totals_json()
    for rec in self:
    tax_totals_json_dict = json.loads(rec.tax_totals_json)
    tax_totals_json_dict.update(
    {'your_field': rec.your_field})
    rec.tax_totals_json = json.dumps(tax_totals_json_dict)

  • Now you have to inherit the "account.TaxtotalsField" template  in extension mode.this xml file should under  "static/src/xml/"
  • Then using xpath add your desired field in the position you prefer. here is an example for steps 2,3:
     


    Sorry unable to incule the example, Dosen't let me add it here


     
  • Lastly, you have to include the xml in the menifest as 'asstes'.  Add the following key, values to your manifest dict```
    'assets': {
    'web.assets_qweb': [
    'you_moduel_name/static/src/xml/your_xml_file_name.xml',
    ],
    },
    ``` 

Hope this helps.

2
Avatar
Descartar
Abdulwahed Freaa

Thanks alot it worked for me

Avatar
Jainesh Shah(Aktiv Software)
Mejor respuesta

Hello, Zied dams

I hope you are doing well.

You can add the any custom field after or before the field 'tax_totals_json', I think you didn't give the xpath in correct way.

You can try this,

Please find code in comment. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Descartar
Jainesh Shah(Aktiv Software)

--> py:

class AccountMove(models.Model):
_inherit = "account.move"

custom_field = fields.Char()

--> xml:

<record id="view_invoice" model="ir.ui.view">
<field name="name">view.invoice</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='tax_totals_json']" position="pos"> # pos = before / after
<field name="custom_field"/>
</xpath>
</field>
</record>

¿Le interesa esta conversación? ¡Participe en ella!

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to get all the invoice group to custom module in odoo 15?
development invoice newmodule inherit v15
Avatar
Avatar
Avatar
2
jul 23
4104
how to count invoice in smart button in odoo 15 ? Resuelto
invoice v15
Avatar
Avatar
Avatar
2
ene 23
5568
inherit sale.order form to new module Resuelto
inherit formview
Avatar
Avatar
Avatar
4
dic 22
8575
how is working invoice count smart button in odoo
invoice v15
Avatar
Avatar
1
jun 22
3888
How to know which invoice a payment belong to?
invoice v15
Avatar
Avatar
1
may 22
4186
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 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