feat: Enhance stock valuation layer descriptions by including the readjustment name and specific context.
This commit is contained in:
parent
c7f53e2858
commit
db543651e5
@ -288,7 +288,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
|
|
||||||
initial_diff = line.target_initial_value - line.initial_value
|
initial_diff = line.target_initial_value - line.initial_value
|
||||||
if not float_is_zero(initial_diff, precision_digits=2):
|
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})
|
line.product_id.sudo().write({'standard_price': line.new_average_cost})
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
svl_vals = {
|
svl_vals = {
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'product_id': product.id,
|
'product_id': product.id,
|
||||||
'description': label_text,
|
'description': ref_text,
|
||||||
'stock_move_id': move.id,
|
'stock_move_id': move.id,
|
||||||
'quantity': 0,
|
'quantity': 0,
|
||||||
'value': amount, # Direct usage of amount
|
'value': amount, # Direct usage of amount
|
||||||
@ -806,7 +806,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
# Create a layer to adjust the starting value
|
# Create a layer to adjust the starting value
|
||||||
# We simply create a value-only layer.
|
# We simply create a value-only layer.
|
||||||
# Value = initial_diff.
|
# 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
|
new_cost = line.new_average_cost
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
credit_acc = stock_acc_id
|
credit_acc = stock_acc_id
|
||||||
amt = abs(diff)
|
amt = abs(diff)
|
||||||
|
|
||||||
description = _("Readjustment MO: %s") % production.name
|
description = f"{self.name} - {_('Readjustment MO:')} {production.name}"
|
||||||
|
|
||||||
move_vals = {
|
move_vals = {
|
||||||
'journal_id': self.journal_id.id,
|
'journal_id': self.journal_id.id,
|
||||||
@ -1025,7 +1025,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
svl_vals = {
|
svl_vals = {
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'product_id': move.product_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,
|
'stock_move_id': move.id,
|
||||||
'quantity': 0,
|
'quantity': 0,
|
||||||
'value': -amount,
|
'value': -amount,
|
||||||
@ -1041,7 +1041,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
svl_vals = {
|
svl_vals = {
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'product_id': move.product_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,
|
'stock_move_id': move.id,
|
||||||
'quantity': 0,
|
'quantity': 0,
|
||||||
'value': -amount,
|
'value': -amount,
|
||||||
@ -1460,7 +1460,7 @@ class StockReadjustValuation(models.Model):
|
|||||||
svl_vals = {
|
svl_vals = {
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'product_id': layer.product_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,
|
'stock_move_id': layer.stock_move_id.id,
|
||||||
'quantity': 0,
|
'quantity': 0,
|
||||||
'value': -amount, # Adjustment to the ASSET value on the layer?
|
'value': -amount, # Adjustment to the ASSET value on the layer?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user