[FIX] stock_account: fix test
Step to reproduce: - Install l10n_it (or l10n_fr) - Run test `.test_standard_manual_to_auto_1` Issue: Test fail. Cause: Since this [commit](https://github.com/odoo/odoo/commit/0d84cc7aa17d325600e093aa58b0a82f6c0605aa), when changing the property valuation of a product category to `manual_periodic`, the properties `property_stock_*` are set to False. When setting back the property valuation to 'real_time', on the write of the product, we will try to 'Replenish the stock with the new cost method'. By doing so it will check a stock_input_account is found but since remove property from product category and property not set on company, it will not find any account and raise an error. Solution: Only for the test (since should consider that must set the default propreties on the company), when changing the property valuation, set also all the property_stock_* properties. opw-2767684 closes odoo/odoo#110054 X-original-commit: 7b6c25ec7945bf8aae7530696c3ef9e1afbc8c19 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
This commit is contained in:
@@ -907,7 +907,12 @@ class TestStockValuationChangeValuation(TestStockValuationCommon):
|
||||
self.assertEqual(len(self.product1.stock_valuation_layer_ids.mapped('account_move_id')), 0)
|
||||
self.assertEqual(len(self.product1.stock_valuation_layer_ids), 1)
|
||||
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.write({
|
||||
'property_valuation': 'real_time',
|
||||
'property_stock_account_input_categ_id': self.stock_input_account.id,
|
||||
'property_stock_account_output_categ_id': self.stock_output_account.id,
|
||||
'property_stock_valuation_account_id': self.stock_valuation_account.id,
|
||||
})
|
||||
|
||||
self.assertEqual(self.product1.value_svl, 100)
|
||||
self.assertEqual(self.product1.quantity_svl, 10)
|
||||
|
||||
Reference in New Issue
Block a user