feat: Add production and expiration dates to stock move lines and update delivery slip report

This commit is contained in:
2026-02-02 14:41:24 +03:30
parent 72aee1b1d1
commit 2c1bdd8c19
5 changed files with 53 additions and 33 deletions

View File

@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from datetime import datetime, timedelta
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
production_date = fields.Date(
string='Production Date',
compute='_compute_production_date',
store=False,
readonly=True,
)
expiration_date = fields.Date(
string='Expiration Date',
compute='_compute_expiration_date',
store=False,
readonly=True,
)
@api.depends('move_id.create_date')
def _compute_production_date(self):
"""Set production date to today or the move's creation date"""
for line in self:
line.production_date = fields.Date.today()
@api.depends('move_id.create_date')
def _compute_expiration_date(self):
"""Set expiration date to 6 months (180 days) from today"""
for line in self:
line.expiration_date = fields.Date.today() + timedelta(days=180)