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
    • Información
    • 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

How to add a field that displays information related to the distance of the last movement of goods with the date the report was drawn

Suscribirse

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

Se marcó esta pregunta
inventoryreport
1 Responder
1239 Vistas
Avatar
Alex

How to add a field that displays information related to the distance of the last movement of goods with the date the report was drawn

For example, if the last product movement was on 6/1/2025, and I want to see the report for the movement of goods on 6/10/2025, the system will display the stock age as 10 days. Then, if I pull up the date 6/15/2025, the system will display the stock age as 15 days.

1
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,


You want to display the stock age of a product based on the last stock movement date. This age should be calculated dynamically based on a user-defined report date.

This can be done by extending the 'product.product' model using a custom module in Odoo 17 on-premise.


1. Create a Custom Module.


from odoo import models, fields, api

from datetime import date


class ProductProduct(models.Model):

    _inherit = 'product.product'


    report_date = fields.Date(string="Report Date")

    stock_age_days = fields.Integer(string="Stock Age (Days)", compute="_compute_stock_age")


    @api.depends('report_date')

    def _compute_stock_age(self):

        for product in self:

            if product.report_date:

                last_move = self.env['stock.move'].search([

                    ('product_id', '=', product.id),

                    ('state', '=', 'done'),

                    ('location_dest_id.usage', '=', 'internal'),

                ], order='date desc', limit=1)

               

                if last_move:

                    move_date = last_move.date.date()

                    delta_days = (product.report_date - move_date).days

                    product.stock_age_days = max(delta_days, 0)

                else:

                    product.stock_age_days = 0

            else:

                product.stock_age_days = 0


2. Add the Fields to Views


<odoo>

    <record id="view_product_form_inherit_stock_age" model="ir.ui.view">

        <field name="name">product.product.form.inherit.stock.age</field>

        <field name="model">product.product</field>

        <field name="inherit_id" ref="product.product_normal_form_view"/>

        <field name="arch" type="xml">

            <xpath expr="//sheet/group" position="inside">

                <group string="Stock Age Info">

                    <field name="report_date"/>

                    <field name="stock_age_days" readonly="1"/>

                </group>

            </xpath>

        </field>

    </record>

</odoo>


How It Works

     - The user sets a Report Date on the product form.

     - Odoo will search for the most recent stock move into internal location for that product.

     - The system calculates the number of days between the report_date and the last move date.

     - The result appears in the Stock Age (Days) field.


By customizing the 'product.product' model in your on-premise Odoo 17 instance, you can efficiently track and display the stock age of products based on any date selected for reporting. This approach offers full control and dynamic stock aging without relying on external spreadsheets or filters.


More information.

- Refer to the flow of the Inventory Aging' default report in Odoo.

(Inventory --> Reporting --> Inventory Aging )


Hope it 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.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Customized Packing Slip report not showing customization Resuelto
inventory report
Avatar
Avatar
1
jun 20
3728
Stock difference printing in inventory report Resuelto
inventory report
Avatar
Avatar
1
sept 15
4502
In OpenERP v7, Inventory Report Printing
inventory report
Avatar
Avatar
1
mar 15
5567
How can I Identify dead inventory in OpenERP
inventory report
Avatar
Avatar
1
mar 15
6005
Accounting Inventory Report - Lower of Cost or Market (LCM)
accounting inventory report
Avatar
0
ago 24
4050
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