diff --git a/modules/price/price_value.py b/modules/price/price_value.py
index 7b0e93e..ff6e629 100755
--- a/modules/price/price_value.py
+++ b/modules/price/price_value.py
@@ -35,10 +35,11 @@ class PriceValue(
}), 'get_price_index')
price_date = fields.Date("Price date")
- price_value = fields.Float("Price value")
- open_price = fields.Float("Open price")
- low_price = fields.Float("Low price")
- high_price = fields.Float("High price")
+ price_value = fields.Float("Price value")
+ open_price = fields.Float("Open price")
+ low_price = fields.Float("Low price")
+ mid_price = fields.Float("Mid price")
+ high_price = fields.Float("High price")
def get_price_index(self, name):
if self.price:
@@ -55,9 +56,10 @@ class PriceValueReport(
r_price_desc = fields.Char("Description")
r_price_date = fields.Date("Price date")
r_price_value = fields.Float("Price")
- r_open_price = fields.Float("Open price")
- r_low_price = fields.Float("Low price")
- r_high_price = fields.Float("High price")
+ r_open_price = fields.Float("Open price")
+ r_low_price = fields.Float("Low price")
+ r_mid_price = fields.Float("Mid price")
+ r_high_price = fields.Float("High price")
@classmethod
def table_query(cls):
@@ -86,10 +88,11 @@ class PriceValueReport(
pp.price_desc.as_('r_price_desc'),
pv.price_date.as_('r_price_date'),
pv.price_value.as_('r_price_value'),
- pv.open_price.as_('r_open_price'),
- pv.low_price.as_('r_low_price'),
- pv.high_price.as_('r_high_price'),
- where=wh)
+ pv.open_price.as_('r_open_price'),
+ pv.low_price.as_('r_low_price'),
+ pv.mid_price.as_('r_mid_price'),
+ pv.high_price.as_('r_high_price'),
+ where=wh)
return query
@@ -116,9 +119,10 @@ class PriceValueReport2(
r_price_desc = fields.Char("Description")
r_price_date = fields.Date("Price date")
r_price_value = fields.Float("Price")
- r_open_price = fields.Float("Open price")
- r_low_price = fields.Float("Low price")
- r_high_price = fields.Float("High price")
+ r_open_price = fields.Float("Open price")
+ r_low_price = fields.Float("Low price")
+ r_mid_price = fields.Float("Mid price")
+ r_high_price = fields.Float("High price")
r_naphta_fob_low = fields.Float("Naph F Med l", digits=(1,2), help="Naphta Fob PAAAI00 low")
r_naphta_fob_high = fields.Float("Naph F Med h", digits=(1,2), help="Naphta Fob PAAAI00 high")
r_naphta_fob_mid = fields.Float("Naph F Med m", digits=(1,2), help="Naphta Fob PAAAI00 mid")
@@ -171,9 +175,10 @@ class PriceValueReport2(
Max(pp.price_desc).as_('r_price_desc'),
pv.price_date.as_('r_price_date'),
Max(pv.price_value).as_('r_price_value'),
- Max(pv.open_price).as_('r_open_price'),
- Max(pv.low_price).as_('r_low_price'),
- Max(pv.high_price).as_('r_high_price'),
+ Max(pv.open_price).as_('r_open_price'),
+ Max(pv.low_price).as_('r_low_price'),
+ Max(pv.mid_price).as_('r_mid_price'),
+ Max(pv.high_price).as_('r_high_price'),
Max(Case((pv.price==15, pv.low_price),else_=0)).as_('r_naphta_fob_low'),
Max(Case((pv.price==15, pv.high_price),else_=0)).as_('r_naphta_fob_high'),
Max(Case((pv.price==15, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_naphta_fob_mid'),
diff --git a/modules/price/view/price_report_list.xml b/modules/price/view/price_report_list.xml
index 01ab595..67f103e 100755
--- a/modules/price/view/price_report_list.xml
+++ b/modules/price/view/price_report_list.xml
@@ -2,8 +2,9 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/modules/price/view/price_value_form.xml b/modules/price/view/price_value_form.xml
index 57d8fcd..3672e0e 100755
--- a/modules/price/view/price_value_form.xml
+++ b/modules/price/view/price_value_form.xml
@@ -8,10 +8,12 @@
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/modules/price/view/price_value_graph.xml b/modules/price/view/price_value_graph.xml
index 4647605..9922d33 100755
--- a/modules/price/view/price_value_graph.xml
+++ b/modules/price/view/price_value_graph.xml
@@ -9,6 +9,7 @@ this repository contains the full copyright notices and license terms. -->
+
diff --git a/modules/price/view/price_value_tree.xml b/modules/price/view/price_value_tree.xml
index 8680e94..78707c9 100755
--- a/modules/price/view/price_value_tree.xml
+++ b/modules/price/view/price_value_tree.xml
@@ -2,8 +2,9 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/modules/price/view/price_value_tree_sequence.xml b/modules/price/view/price_value_tree_sequence.xml
index c157d2e..4a624f9 100755
--- a/modules/price/view/price_value_tree_sequence.xml
+++ b/modules/price/view/price_value_tree_sequence.xml
@@ -2,8 +2,9 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/modules/purchase_trade/pricing.py b/modules/purchase_trade/pricing.py
index 77c8b3b..0dd6f5f 100755
--- a/modules/purchase_trade/pricing.py
+++ b/modules/purchase_trade/pricing.py
@@ -126,10 +126,11 @@ class ImportPrices(Wizard):
REQUIRED_COLUMNS = {
'priceindex': 'price_index',
'pricedate': 'price_date',
- 'highprice': 'high_price',
- 'lowprice': 'low_price',
- 'openprice': 'open_price',
- 'pricevalue': 'price_value',
+ 'highprice': 'high_price',
+ 'lowprice': 'low_price',
+ 'midprice': 'mid_price',
+ 'openprice': 'open_price',
+ 'pricevalue': 'price_value',
}
def transition_import_(self):
@@ -301,10 +302,11 @@ class ImportPrices(Wizard):
return {
'price': price.id,
'price_date': price_date,
- 'high_price': cls._as_float(row.get('high_price')),
- 'low_price': cls._as_float(row.get('low_price')),
- 'open_price': cls._as_float(row.get('open_price')),
- 'price_value': cls._as_float(row.get('price_value')),
+ 'high_price': cls._as_float(row.get('high_price')),
+ 'low_price': cls._as_float(row.get('low_price')),
+ 'mid_price': cls._as_float(row.get('mid_price')),
+ 'open_price': cls._as_float(row.get('open_price')),
+ 'price_value': cls._as_float(row.get('price_value')),
}
@staticmethod
@@ -357,10 +359,12 @@ class ImportPrices(Wizard):
@staticmethod
def _price_summary(values):
parts = []
- for name in ('price_value', 'open_price', 'low_price', 'high_price'):
- value = values.get(name)
- if value is not None:
- parts.append('%s=%s' % (name, value))
+ for name in (
+ 'price_value', 'open_price', 'low_price', 'mid_price',
+ 'high_price'):
+ value = values.get(name)
+ if value is not None:
+ parts.append('%s=%s' % (name, value))
return ', '.join(parts) or 'price imported'
@classmethod
@@ -461,6 +465,7 @@ class ImportPrices(Wizard):
'price_date': price_date,
'high_price': price_value,
'low_price': price_value,
+ 'mid_price': price_value,
'open_price': price_value,
'price_value': price_value,
})
diff --git a/modules/purchase_trade/tests/test_module.py b/modules/purchase_trade/tests/test_module.py
index ffd148e..5c4c88e 100644
--- a/modules/purchase_trade/tests/test_module.py
+++ b/modules/purchase_trade/tests/test_module.py
@@ -5160,7 +5160,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
@with_transaction()
def test_import_forward_prices_copies_value_to_ohl_fields(self):
- 'forward import uses price values for open, low and high prices'
+ 'forward import uses price values for open, low, mid and high prices'
ImportPrices = Pool().get('purchase_trade.import_prices')
ns = {'s': 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'}
sheet = ElementTree.fromstring('''
@@ -5187,6 +5187,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
self.assertEqual(result[0]['price_value'], '75.25')
self.assertEqual(result[0]['open_price'], '75.25')
self.assertEqual(result[0]['low_price'], '75.25')
+ self.assertEqual(result[0]['mid_price'], '75.25')
self.assertEqual(result[0]['high_price'], '75.25')
def test_pricing_component_matrix_returns_generic_line_price(self):