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

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

Abonare

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

Această întrebare a fost marcată
inventoryreport
1 Răspunde
1303 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

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
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
Customized Packing Slip report not showing customization Rezolvat
inventory report
Imagine profil
Imagine profil
1
iun. 20
3796
Stock difference printing in inventory report Rezolvat
inventory report
Imagine profil
Imagine profil
1
sept. 15
4566
In OpenERP v7, Inventory Report Printing
inventory report
Imagine profil
Imagine profil
1
mar. 15
5605
How can I Identify dead inventory in OpenERP
inventory report
Imagine profil
Imagine profil
1
mar. 15
6048
Accounting Inventory Report - Lower of Cost or Market (LCM)
accounting inventory report
Imagine profil
0
aug. 24
4110
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