[FIX] stock_account: valuation layer description on valuation change
The layer created to handle the valuation and costing change share the same code but they should not share the same description. closes odoo/odoo#34952 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
@@ -675,8 +675,12 @@ class ProductCategory(models.Model):
|
||||
continue
|
||||
|
||||
# Empty out the stock with the current cost method.
|
||||
description = _("Costing method change for product category %s: from %s to %s.") \
|
||||
% (self.display_name, self.property_cost_method, new_cost_method)
|
||||
if new_cost_method:
|
||||
description = _("Costing method change for product category %s: from %s to %s.") \
|
||||
% (self.display_name, self.property_cost_method, new_cost_method)
|
||||
else:
|
||||
description = _("Valuation method change for product category %s: from %s to %s.") \
|
||||
% (self.display_name, self.property_valuation, new_valuation)
|
||||
out_svl_vals_list, products_orig_quantity_svl, products = Product\
|
||||
._svl_empty_stock(description, product_category=product_category)
|
||||
out_stock_valuation_layers = SVL.create(out_svl_vals_list)
|
||||
|
||||
@@ -613,6 +613,8 @@ class TestStockValuationChangeCostMethod(TestStockValuationCommon):
|
||||
self.assertEqual(self.product1.quantity_svl, 19)
|
||||
|
||||
self.assertEqual(len(self.product1.stock_valuation_layer_ids), 5)
|
||||
for svl in self.product1.stock_valuation_layer_ids[-2:]:
|
||||
self.assertEqual(svl.description, 'Costing method change for product category All: from standard to fifo.')
|
||||
|
||||
def test_standard_to_fifo_2(self):
|
||||
""" We want the same result as `test_standard_to_fifo_1` but by changing the category of
|
||||
@@ -727,6 +729,8 @@ class TestStockValuationChangeValuation(TestStockValuationCommon):
|
||||
# An accounting entry should only be created for the replenish now that the category is perpetual.
|
||||
self.assertEqual(len(self.product1.stock_valuation_layer_ids.mapped('account_move_id')), 1)
|
||||
self.assertEqual(len(self.product1.stock_valuation_layer_ids), 3)
|
||||
for svl in self.product1.stock_valuation_layer_ids[-2:]:
|
||||
self.assertEqual(svl.description, 'Valuation method change for product category All: from manual_periodic to real_time.')
|
||||
|
||||
def test_standard_manual_to_auto_2(self):
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
|
||||
Reference in New Issue
Block a user