[IMP] stock, stock_account: dates added to stock move name

Scheduled date and accounting date added to stock move name

Task: 2764771
Part-of: odoo/odoo#91640
This commit is contained in:
Ahmed Khalaf(ahkh)
2022-06-03 12:02:04 +02:00
committed by Ahmed Khalaf (ahkh)
parent dd1d758476
commit 9c46e2ba95
2 changed files with 13 additions and 1 deletions
+4
View File
@@ -877,6 +877,10 @@ class StockQuant(models.Model):
name = _('Product Quantity Confirmed')
else:
name = _('Product Quantity Updated')
if self.inventory_date:
name += _(' [Scheduled on %s]', self.inventory_date)
return {
'name': self.env.context.get('inventory_name') or name,
'product_id': self.product_id.id,
+9 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo import api, fields, models, _
from odoo.tools.float_utils import float_is_zero
from odoo.tools.misc import groupby
@@ -71,6 +71,14 @@ class StockQuant(models.Model):
else:
super(StockQuant, inventories)._apply_inventory()
def _get_inventory_move_values(self, qty, location_id, location_dest_id, out=False):
res_move = super()._get_inventory_move_values(qty, location_id, location_dest_id, out)
if not self.env.context.get('inventory_name'):
force_period_date = self.env.context.get('force_period_date', False)
if force_period_date:
res_move['name'] += _(' [Accounted on %s]', force_period_date)
return res_move
@api.model
def _get_inventory_fields_write(self):
""" Returns a list of fields user can edit when editing a quant in `inventory_mode`."""