feat: Enhance stock valuation layer descriptions by including the readjustment name and specific context.

This commit is contained in:
Suherdy Yacob 2026-03-03 10:18:00 +07:00
parent c7f53e2858
commit db543651e5

View File

@ -288,7 +288,7 @@ class StockReadjustValuation(models.Model):
initial_diff = line.target_initial_value - line.initial_value
if not float_is_zero(initial_diff, precision_digits=2):
self._create_correction_layer(line.product_id, initial_diff, self.date_start, _("Readjustment: Initial Value"))
self._create_correction_layer(line.product_id, initial_diff, self.date_start, f"{self.name} - {_('Readjustment: Initial Value')}")
line.product_id.sudo().write({'standard_price': line.new_average_cost})
@ -715,7 +715,7 @@ class StockReadjustValuation(models.Model):
svl_vals = {
'company_id': self.company_id.id,
'product_id': product.id,
'description': label_text,
'description': ref_text,
'stock_move_id': move.id,
'quantity': 0,
'value': amount, # Direct usage of amount
@ -806,7 +806,7 @@ class StockReadjustValuation(models.Model):
# Create a layer to adjust the starting value
# We simply create a value-only layer.
# Value = initial_diff.
self._create_correction_layer(line.product_id, initial_diff, self.date_start, _("Readjustment: Initial Value"))
self._create_correction_layer(line.product_id, initial_diff, self.date_start, f"{self.name} - {_('Readjustment: Initial Value')}")
new_cost = line.new_average_cost
@ -971,7 +971,7 @@ class StockReadjustValuation(models.Model):
credit_acc = stock_acc_id
amt = abs(diff)
description = _("Readjustment MO: %s") % production.name
description = f"{self.name} - {_('Readjustment MO:')} {production.name}"
move_vals = {
'journal_id': self.journal_id.id,
@ -1025,7 +1025,7 @@ class StockReadjustValuation(models.Model):
svl_vals = {
'company_id': self.company_id.id,
'product_id': move.product_id.id,
'description': _('Readjustment: %s') % self.name,
'description': f"{self.name} - Adj for {move.name}",
'stock_move_id': move.id,
'quantity': 0,
'value': -amount,
@ -1041,7 +1041,7 @@ class StockReadjustValuation(models.Model):
svl_vals = {
'company_id': self.company_id.id,
'product_id': move.product_id.id,
'description': _('Readjustment: %s') % self.name,
'description': f"{self.name} - Adj for {move.name}",
'stock_move_id': move.id,
'quantity': 0,
'value': -amount,
@ -1460,7 +1460,7 @@ class StockReadjustValuation(models.Model):
svl_vals = {
'company_id': self.company_id.id,
'product_id': layer.product_id.id,
'description': _('Readjustment: %s') % self.name,
'description': f"{self.name} - Adj for {layer.stock_move_id.name}",
'stock_move_id': layer.stock_move_id.id,
'quantity': 0,
'value': -amount, # Adjustment to the ASSET value on the layer?