diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_inventory_valuation_method.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_inventory_valuation_method.xml index c4ead3f06780d328317381a5d19a49635ebe3180..a38f69b467bfa9ae9db243aa072a5a6e28939a46 100644 --- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_inventory_valuation_method.xml +++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_inventory_valuation_method.xml @@ -249,6 +249,10 @@ <string>Default Sales Price</string> <string>default_sale_price</string> </tuple> + <tuple> + <string>Asset Price</string> + <string>asset_price</string> + </tuple> </list> </value> </item> diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryListBrain_getInventoryValuatedTotalPrice.py b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryListBrain_getInventoryValuatedTotalPrice.py index 1c70b62dd9ff167137aa5f45f8c3b3fae6937f47..6732af3d101eb029ee8e2c7932795fd8810fd8df 100644 --- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryListBrain_getInventoryValuatedTotalPrice.py +++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryListBrain_getInventoryValuatedTotalPrice.py @@ -39,6 +39,9 @@ def getPriceFromDefaultSupplyLine(brain, supply_line_id): return None return brain.inventory * base_price +if inventory_valuation_method == 'asset_price': + return context.total_price + if inventory_valuation_method: supply_line_id_mapping = { 'default_purchase_price': 'default_psl', diff --git a/bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py b/bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py index ca4aa4934f5b19e00892cb44bd9163bc3c86cd26..7885733dc79d99bca9bb6039542326a4b35200f8 100644 --- a/bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py +++ b/bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py @@ -1651,6 +1651,35 @@ class TestTradeReports(ERP5ReportTestCase): total_price=7, ) + def testStockReport_valuation_method_asset_price(self): + self._createConfirmedSalePackingListForStockReportTest() + request = self.portal.REQUEST + request.form['at_date'] = DateTime(2007, 3, 3) + request.form['node_category'] = 'site/demo_site_A' + request.form['simulation_period'] = 'future' + request.form['inventory_valuation_method'] = 'asset_price' + + line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\ + get_value('default', + render_format='list', REQUEST=self.portal.REQUEST) + + data_line_list = [l for l in line_list if l.isDataLine()] + self.assertEqual(1, len(data_line_list)) + data_line = data_line_list[0] + self.assertEqual( + data_line.column_id_list, + ['resource_title', 'resource_reference', 'variation_category_item_list', 'inventory', 'quantity_unit', 'total_price']) + + self.checkLineProperties( + data_line_list[0], + resource_title='product_A', + resource_reference='ref 2', + variation_category_item_list=[], + inventory=1, + quantity_unit='G', + total_price=10, + ) + def testStockReport_valuation_and_quantity_unit_conversion(self): self._createConfirmedSalePackingListForStockReportTest( quantity=0.5,