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

How to display account move line (in_invoice) in list view including taxes entries?

Suscribirse

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

Se marcó esta pregunta
accountingfilter
2 Respuestas
4502 Vistas
Avatar
RALPH IDOKO

The requirement is to have a menu that will display account move line entries with expense account selected on the vendor bills. If taxes are applied, the listing should include all tax entries.  See the expected output: https://i.sstatic.net/2A4IgAM6.jpg.

See my current domain:

<record id="action_account_move_line" model="ir.actions.act_window">
    <field name="name">Expense Analysis</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">account.move.line</field>
    <field name="view_mode">tree,pivot,graph</field>
    <field name="domain">[('account_id.deprecated', '=', False),('account_id.internal_group', 'in', ['expense']),('exclude_from_invoice_tab','=',False)]</field>
    <field name="view_id" eval="expense_line_tree_view"/>
</record>

The above domain only fetched the move line entries without the taxes. See the current result: https://i.sstatic.net/JXR7852C.jpg

Gracia.

0
Avatar
Descartar
Avatar
RALPH IDOKO
Autor Mejor respuesta

Thank you Andry. Your suggested workaround was so invaluable. However, hard-coding IDs into domain might cause avoidable issues further down the line especially if you are not working with a final version of your database as the IDs will be regenerated if a new database is created.

My adopted approach was to create an sql view with init method containing sql statements using UNION and JOIN. That way, it became easy to grab the desired tables and fields.

See complete class below:

from odoo import models, fields, tools

class ExpenseAnalysisWithTaxes(models.Model):
_name = ".expense.analysis.with.taxes"
_description = "Expense Analysis"
_auto = False # This is a SQL view, not a normal table

id = fields.Integer("ID", readonly=True)
date = fields.Date("Date", readonly=True)
name = fields.Char("Description of Job", readonly=True)
move_name = fields.Char("Payment Reference", readonly=True)
partner_id = fields.Many2one("res.partner", "Partner", readonly=True)
account_id = fields.Many2one("account.account", "Account", readonly=True)
account_name = fields.Char("Account Name", readonly=True)
price_subtotal = fields.Monetary("Total Amount", readonly=True)
currency_id = fields.Many2one("res.currency", "Currency", readonly=True, default=lambda self: self.env.company.currency_id)

def init(self):
"""Create the SQL view dynamically when the module is installed or updated."""
tools.drop_view_if_exists(self._cr, "expense_analysis_with_taxes")
self._cr.execute("""
CREATE OR REPLACE VIEW expense_analysis_with_taxes AS (
-- Expense lines
SELECT
aml.id AS id,
aml.date AS date,
aml.name AS name,
am.name AS move_name,
aml.partner_id AS partner_id,
aml.account_id AS account_id,
aa.name AS account_name,
aml.price_total AS price_subtotal
FROM account_move_line aml
JOIN account_account aa ON aml.account_id = aa.id
JOIN account_move am ON aml.move_id = am.id
WHERE am.move_type IN ('in_invoice','in_receipt')
AND aa.internal_group = 'expense'

UNION ALL

-- Tax lines (identified via tax_line_id)
SELECT
aml.id AS id,
aml.date AS date,
CONCAT('Tax: ', at.name) AS name,
am.name AS move_name,
aml.partner_id AS partner_id,
aml.account_id AS account_id,
aa.name AS account_name,
ABS(aml.price_subtotal) AS price_subtotal
FROM account_move_line aml
JOIN account_account aa ON aml.account_id = aa.id
JOIN account_move am ON aml.move_id = am.id
JOIN account_tax at ON aml.tax_line_id = at.id
WHERE am.move_type IN ('in_invoice','in_receipt')
) ORDER BY id DESC;
""")
Based on this, I then defined a menu, window action and tree view.

Hope this helps someone.


0
Avatar
Descartar
Avatar
Andry Ang
Mejor respuesta

Hi Raplh,

I have a workaround for your case. First you need to know few things:

  1. Tax payable is a liabilities account which have a different account_type than expense
  2. There is no grouping on tax payable accounts except you create one for them
  3. You used filter on internal_group, this includes 3 account types: Expenses, Depreciation, and Cost of Revenue. Double check if you really need "internal_group" or "account_type"

For tax accounts, you might need to hard code the ids into the domain tuples.

Hope this helps

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
a favorites or bookmarking needed!
configuration accounting filter
Avatar
0
ene 25
1209
filter all contacts from "active" companies
accounting filter contacts
Avatar
Avatar
1
nov 22
2783
Facing QuickBooks Error 6123? @ +1-804-(985)-1002 Here’s the Easiest Fix
accounting
Avatar
0
nov 25
3
{{GUIA`$Avianca$𓆩×͜×𓆪 𝐏𝐀}}¿Cómo llamar a Avianca desde Panamá?
accounting
Avatar
0
nov 25
58
Invoice Printing Error in Odoo V19 – GCC/Saudi Localization
accounting
Avatar
Avatar
1
nov 25
166
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