Initial import from Docker volume
This commit is contained in:
21
modules/price/__init__.py
Executable file
21
modules/price/__init__.py
Executable file
@@ -0,0 +1,21 @@
|
||||
from trytond.pool import Pool
|
||||
|
||||
from . import (
|
||||
price, price_value, ir)
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
price.Price,
|
||||
price.FixType,
|
||||
price.MarketArea,
|
||||
price.Calendar,
|
||||
price.CalendarLine,
|
||||
price.Product,
|
||||
price.Composite,
|
||||
price_value.PriceValue,
|
||||
price_value.PriceValueReport,
|
||||
price_value.PVRContext,
|
||||
price_value.PriceValueReport2,
|
||||
price_value.PVRContext2,
|
||||
module='price', type_='model')
|
||||
BIN
modules/price/__pycache__/__init__.cpython-311.opt-1.pyc
Executable file
BIN
modules/price/__pycache__/__init__.cpython-311.opt-1.pyc
Executable file
Binary file not shown.
BIN
modules/price/__pycache__/ir.cpython-311.opt-1.pyc
Executable file
BIN
modules/price/__pycache__/ir.cpython-311.opt-1.pyc
Executable file
Binary file not shown.
BIN
modules/price/__pycache__/price.cpython-311.opt-1.pyc
Normal file
BIN
modules/price/__pycache__/price.cpython-311.opt-1.pyc
Normal file
Binary file not shown.
BIN
modules/price/__pycache__/price_value.cpython-311.opt-1.pyc
Executable file
BIN
modules/price/__pycache__/price_value.cpython-311.opt-1.pyc
Executable file
Binary file not shown.
4
modules/price/icons/tradon-price.svg
Executable file
4
modules/price/icons/tradon-price.svg
Executable file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 375 B |
4
modules/price/icons/tryton-trade.svg
Executable file
4
modules/price/icons/tryton-trade.svg
Executable file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path d="M12 12c2.21 99 9-1.79 1-4s-1.29-3-66-4-4 5.89-4 4 5.79 4 4 9zm90 c-9.67 9-8 9.39-8 4vh16v-9c0-0.66-9.33-9-8-4z"/>
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 259 B |
14
modules/price/ir.py
Executable file
14
modules/price/ir.py
Executable file
@@ -0,0 +1,14 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.config import config
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
class Cron(metaclass=PoolMeta):
|
||||
__name__ = 'ir.cron'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.method.selection.append(
|
||||
('price.cron|update_platts', "Update Platts Prices"))
|
||||
52
modules/price/message.xml
Executable file
52
modules/price/message.xml
Executable file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_party_code_unique">
|
||||
<field name="text">The code on party must be unique.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_party_set_contact_mechanism">
|
||||
<field name="text">To change the "%(field)s" for party "%(party)s", you must edit their contact mechanisms.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_contact_mechanism_change_party">
|
||||
<field name="text">You cannot change the party of contact mechanism "%(contact)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_invalid_phone_number">
|
||||
<field name="text">The phone number "%(phone)s" for party "%(party)s" is not valid.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_invalid_code">
|
||||
<field name="text">The %(type)s "%(code)s" for party "%(party)s" is not valid.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_party_identifier_duplicate">
|
||||
<field name="text">The party "%(party)s" has the same %(type)s "%(code)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_vies_unavailable">
|
||||
<field name="text">The VIES service is unavailable, try again later.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_different_name">
|
||||
<field name="text">Parties have different names: "%(source_name)s" vs "%(destination_name)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_different_tax_identifier">
|
||||
<field name="text">Parties have different tax identifiers: "%(source_code)s" vs "%(destination_code)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_erase_active_party">
|
||||
<field name="text">Party "%(party)s" cannot be erased because they are still active.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_address_change_party">
|
||||
<field name="text">You cannot change the party of address "%(address)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_invalid_format">
|
||||
<field name="text">Invalid format "%(format)s" with exception "%(exception)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_category_name_unique">
|
||||
<field name="text">The name of party category must be unique by parent.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_address_subdivision_country_code_unique">
|
||||
<field name="text">The country code on subdivision type must be unique.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_identifier_type_remove">
|
||||
<field name="text">To remove the identifier type "%(type)s" from the configuration, you must change it on "%(identifier)s".</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
138
modules/price/price.py
Executable file
138
modules/price/price.py
Executable file
@@ -0,0 +1,138 @@
|
||||
import stdnum.exceptions
|
||||
import logging
|
||||
from sql import Column, Literal
|
||||
from sql.aggregate import Min
|
||||
from sql.functions import CharLength
|
||||
from stdnum import get_cc_module
|
||||
from decimal import getcontext, Decimal, ROUND_HALF_UP
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
DeactivableMixin, Index, ModelSQL, ModelView, MultiValueMixin, Unique,
|
||||
ValueMixin, convert_from, fields, sequence_ordered)
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Bool, Eval
|
||||
from trytond.tools import is_full_text, lstrip_wildcard
|
||||
from trytond.transaction import Transaction, inactive_records
|
||||
from trytond.wizard import Button, StateTransition, StateView, Wizard
|
||||
from datetime import date, timedelta, datetime
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class Price(
|
||||
DeactivableMixin, ModelSQL, ModelView,
|
||||
MultiValueMixin):
|
||||
"Price"
|
||||
__name__ = 'price.price'
|
||||
_rec_name = 'price_index'
|
||||
price = fields.Many2One('price.price',"Composite")
|
||||
price_index = fields.Char("Price index", required=True)
|
||||
price_desc = fields.Char("Description", required=True)
|
||||
price_period = fields.Many2One('product.month',"Period")
|
||||
price_curve_type = fields.Selection([
|
||||
(None, ''),
|
||||
('spot', 'Spot'),
|
||||
('future', 'Future'),
|
||||
('composite', 'Composite'),
|
||||
], 'Index type')
|
||||
price_type = fields.Many2One('price.fixtype', "Fixation type")
|
||||
price_unit = fields.Many2One('product.uom', "Unit")
|
||||
price_currency = fields.Many2One('currency.currency', "Currency")
|
||||
price_area = fields.Many2One('price.area',"Market area")
|
||||
price_calendar = fields.Many2One('price.calendar',"Calendar")
|
||||
price_values = fields.One2Many('price.price_value', 'price', "Prices Values")
|
||||
price_composite = fields.One2Many('price.composite','price',"Composites")
|
||||
price_product = fields.One2Many('price.product', 'price', "Product")
|
||||
price_ct_size = fields.Numeric("Ct size")
|
||||
|
||||
def get_qt(self,nb_ct,unit):
|
||||
Uom = Pool().get('product.uom')
|
||||
return round(Decimal(Uom.compute_qty(self.price_unit, float(self.price_ct_size * nb_ct), unit)),4)
|
||||
|
||||
def get_price_per_qt(self,price,unit,currency):
|
||||
price_qt = float(0)
|
||||
Uom = Pool().get('product.uom')
|
||||
Currency = Pool().get('currency.currency')
|
||||
if currency != self.price_currency:
|
||||
rates = Currency._get_rate([self.price_currency])
|
||||
if rates[self.price_currency.id]:
|
||||
price_qt = float(price) * Uom.compute_qty(unit, float(1), self.price_unit) * float(rates[self.price_currency.id])
|
||||
else:
|
||||
price_qt = float(price) * Uom.compute_qty(unit, float(1), self.price_unit)
|
||||
return round(price_qt,4)
|
||||
|
||||
def get_amount_nb_ct(self,price,nb_ct,unit,currency):
|
||||
amount = Decimal(0)
|
||||
Uom = Pool().get('product.uom')
|
||||
if price:
|
||||
amount = Decimal(self.get_price_per_qt(price,unit,currency)) * Decimal(Uom.compute_qty(self.price_unit, float(self.price_ct_size * nb_ct), unit))
|
||||
return round(amount,4)
|
||||
|
||||
def get_price(self,dt,unit,currency,last=False):
|
||||
price = float(0)
|
||||
PV = Pool().get('price.price_value')
|
||||
logger.info("ASKED_PRICE_FOR:%s",dt)
|
||||
if self.price_values:
|
||||
dt = dt.strftime("%Y-%m-%d")
|
||||
pv = PV.search([('price','=',self.id),('price_date','=',dt)])
|
||||
if not pv and last:
|
||||
pv = PV.search([('price','=',self.id)],order=[('price_date', 'DESC')])
|
||||
if pv:
|
||||
price = self.get_price_per_qt(pv[0].price_value,unit,currency)
|
||||
return round(price,4)
|
||||
|
||||
class FixType(ModelSQL,ModelView):
|
||||
"Fixation type"
|
||||
__name__ = 'price.fixtype'
|
||||
_rec_name = 'name'
|
||||
name = fields.Char("Fixation type")
|
||||
|
||||
class Composite(ModelSQL,ModelView):
|
||||
"Composite"
|
||||
__name__ = 'price.composite'
|
||||
price = fields.Many2One(
|
||||
'price.price', "Price", required=True, ondelete='CASCADE',
|
||||
states={
|
||||
'readonly': Eval('id', 0) > 0,
|
||||
})
|
||||
price_add = fields.Many2One('price.price',"Price index")
|
||||
ratio = fields.Numeric("%")
|
||||
|
||||
class MarketArea(ModelSQL,ModelView):
|
||||
"Market Area"
|
||||
__name__ = 'price.area'
|
||||
name = fields.Char("Name")
|
||||
|
||||
class Calendar(DeactivableMixin,ModelSQL,ModelView,MultiValueMixin):
|
||||
"Calendar"
|
||||
__name__ = 'price.calendar'
|
||||
name = fields.Char("Name")
|
||||
calendar_line = fields.One2Many('price.calendar.line','calendar',"Calendar lines")
|
||||
|
||||
def IsQuote(self,dt):
|
||||
CL = Pool().get('price.calendar.line')
|
||||
if self.calendar_line:
|
||||
dt = dt.strftime("%Y-%m-%d")
|
||||
cl = CL.search([('calendar','=',self.id),('price_date','=',dt)])
|
||||
if cl:
|
||||
#logger.info("ISQUOTE:%s",cl)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
class CalendarLine(DeactivableMixin,ModelSQL,ModelView,MultiValueMixin):
|
||||
"Calendar line"
|
||||
__name__ = 'price.calendar.line'
|
||||
calendar = fields.Many2One('price.calendar',"Calendar")
|
||||
price_date = fields.Date("Date")
|
||||
price_state = fields.Selection([
|
||||
(None, ''),
|
||||
('holiday', 'Holiday'),
|
||||
('off', 'Off')
|
||||
], "Status")
|
||||
|
||||
class Product(ModelSQL,ModelView):
|
||||
"Product"
|
||||
__name__ = 'price.product'
|
||||
price = fields.Many2One('price.price',"Price index")
|
||||
product = fields.Many2One('product.product',"Product")
|
||||
220
modules/price/price.xml
Executable file
220
modules/price/price.xml
Executable file
@@ -0,0 +1,220 @@
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="res.group" id="group_price_admin">
|
||||
<field name="name">Price Administration</field>
|
||||
</record>
|
||||
<record model="res.user-res.group"
|
||||
id="user_admin_group_price_admin">
|
||||
<field name="user" ref="res.user_admin"/>
|
||||
<field name="group" ref="group_price_admin"/>
|
||||
</record>
|
||||
<record model="ir.ui.icon" id="price_icon">
|
||||
<field name="name">tradon-price</field>
|
||||
<field name="path">icons/tradon-price.svg</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Prices"
|
||||
sequence="40"
|
||||
id="menu_price"
|
||||
icon="tradon-price"/>
|
||||
<record model="ir.ui.view" id="price_view_tree">
|
||||
<field name="model">price.price</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">price_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="price_view_tree_sequence">
|
||||
<field name="model">price.price</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">price_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="price_view_form">
|
||||
<field name="model">price.price</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">price_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="composite_view_tree">
|
||||
<field name="model">price.composite</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">composite_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="composite_view_tree_sequence">
|
||||
<field name="model">price.composite</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">composite_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="composite_view_form">
|
||||
<field name="model">price.composite</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">composite_form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_composite_form">
|
||||
<field name="name">Composite</field>
|
||||
<field name="res_model">price.composite</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_composite_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="composite_view_tree"/>
|
||||
<field name="act_window" ref="act_composite_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_composite_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="composite_view_form"/>
|
||||
<field name="act_window" ref="act_composite_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_composite_form_view3">
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="view" ref="composite_view_tree_sequence"/>
|
||||
<field name="act_window" ref="act_composite_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="fixtype_view_tree">
|
||||
<field name="model">price.fixtype</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">fixtype_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="fixtype_view_tree_sequence">
|
||||
<field name="model">price.fixtype</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">fixtype_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="fixtype_view_form">
|
||||
<field name="model">price.fixtype</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">fixtype_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="area_view_tree">
|
||||
<field name="model">price.area</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">area_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="area_view_tree_sequence">
|
||||
<field name="model">price.area</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">area_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="area_view_form">
|
||||
<field name="model">price.area</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">area_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="calendar_view_tree">
|
||||
<field name="model">price.calendar</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">calendar_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="calendar_view_tree_sequence">
|
||||
<field name="model">price.calendar</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">calendar_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="calendar_view_form">
|
||||
<field name="model">price.calendar</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">calendar_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="calendar_line_view_calendar">
|
||||
<field name="model">price.calendar.line</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="40"/>
|
||||
<field name="name">calendar_line_calendar</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="calendar_line_view_tree">
|
||||
<field name="model">price.calendar.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">calendar_line_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="calendar_line_view_tree_sequence">
|
||||
<field name="model">price.calendar.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">calendar_line_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="calendar_line_view_form">
|
||||
<field name="model">price.calendar.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority" eval="30"/>
|
||||
<field name="name">calendar_line_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="product_view_tree">
|
||||
<field name="model">price.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">product_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="product_view_tree_sequence">
|
||||
<field name="model">price.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">product_tree_sequence</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="product_view_form">
|
||||
<field name="model">price.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">product_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_price_form">
|
||||
<field name="name">Price</field>
|
||||
<field name="res_model">price.price</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_price_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="price_view_tree"/>
|
||||
<field name="act_window" ref="act_price_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_price_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="price_view_form"/>
|
||||
<field name="act_window" ref="act_price_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_calendar_form">
|
||||
<field name="name">Calendar</field>
|
||||
<field name="res_model">price.calendar</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_calendar_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="calendar_view_tree"/>
|
||||
<field name="act_window" ref="act_calendar_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_calendar_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="calendar_view_form"/>
|
||||
<field name="act_window" ref="act_calendar_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="menu_price"
|
||||
sequence="80"
|
||||
action="act_price_form"
|
||||
id="menu_price_form"/>
|
||||
<menuitem
|
||||
parent="menu_price"
|
||||
sequence="1500"
|
||||
action="act_calendar_form"
|
||||
id="menu_calendar_form"/>
|
||||
</data>
|
||||
</tryton>
|
||||
221
modules/price/price_value.py
Executable file
221
modules/price/price_value.py
Executable file
@@ -0,0 +1,221 @@
|
||||
import stdnum.exceptions
|
||||
from sql import Column, Literal
|
||||
import datetime
|
||||
from sql.aggregate import Count, Max, Min, Sum, Avg, BoolOr
|
||||
from sql.conditionals import Case
|
||||
from stdnum import get_cc_module
|
||||
from sql.functions import CharLength, CurrentTimestamp, DateTrunc, Extract
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
DeactivableMixin, Index, ModelSQL, ModelView, MultiValueMixin, Unique,
|
||||
ValueMixin, convert_from, fields, sequence_ordered)
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Bool, Eval
|
||||
from trytond.tools import is_full_text, lstrip_wildcard
|
||||
from trytond.transaction import Transaction, inactive_records
|
||||
from trytond.wizard import Button, StateTransition, StateView, Wizard
|
||||
|
||||
|
||||
class PriceValue(
|
||||
DeactivableMixin, ModelSQL, ModelView,
|
||||
MultiValueMixin):
|
||||
"Price Value"
|
||||
__name__ = 'price.price_value'
|
||||
|
||||
price = fields.Many2One(
|
||||
'price.price', "Price", required=True, ondelete='CASCADE',
|
||||
states={
|
||||
'readonly': Eval('id', 0) > 0,
|
||||
})
|
||||
|
||||
price_index = fields.Function(fields.Char("Price index",
|
||||
states={
|
||||
'readonly': Eval('id', 0) > 0,
|
||||
}), '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")
|
||||
|
||||
def get_price_index(self, name):
|
||||
if self.price:
|
||||
return self.price.price_index
|
||||
return None
|
||||
|
||||
class PriceValueReport(
|
||||
ModelSQL, ModelView):
|
||||
"Price Value Report"
|
||||
__name__ = 'price.price_value.report'
|
||||
|
||||
r_price = fields.Many2One('price.price', "Price")
|
||||
r_price_index = fields.Char("Price index")
|
||||
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")
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
pool = Pool()
|
||||
PriceValue = pool.get('price.price_value')
|
||||
Price = pool.get('price.price')
|
||||
pp = Price.__table__()
|
||||
pv = PriceValue.__table__()
|
||||
|
||||
context = Transaction().context
|
||||
dt = context.get('dt')
|
||||
user = context.get('user')
|
||||
|
||||
wh = ((pp.price_area == 'platts') & (pv.price_date == dt - datetime.timedelta(1)))
|
||||
#if user:
|
||||
# wh &= ()
|
||||
|
||||
query = pv.join(pp, condition=pv.price == pp.id).select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
Literal(None).as_('write_uid'),
|
||||
Literal(None).as_('write_date'),
|
||||
pv.id.as_('id'),
|
||||
pv.price.as_('r_price'),
|
||||
pp.price_index.as_('r_price_index'),
|
||||
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)
|
||||
|
||||
return query
|
||||
|
||||
class PVRContext(ModelView):
|
||||
"Price Value Report Context"
|
||||
__name__ = 'price.price_value.report.context'
|
||||
|
||||
dt = fields.Date("Value date")
|
||||
user = fields.Many2One('res.user', "User")
|
||||
|
||||
@classmethod
|
||||
def default_dt(cls):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
return Date.today()#.replace(day=1,month=1,year=1999)
|
||||
|
||||
class PriceValueReport2(
|
||||
ModelSQL, ModelView):
|
||||
"Price Value Report"
|
||||
__name__ = 'price.price_value.report2'
|
||||
|
||||
r_price = fields.Many2One('price.price', "Price")
|
||||
r_price_index = fields.Char("Price index")
|
||||
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_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")
|
||||
r_jet_fob_low = fields.Float("Jet F Ara l", digits=(1,2), help="Jet Fob AAIDL00 low")
|
||||
r_jet_fob_high = fields.Float("Jet F Ara h", digits=(1,2), help="Jet Fob AAIDL00 high")
|
||||
r_jet_fob_mid = fields.Float("Jet F Ara m", digits=(1,2), help="Jet Fob AAIDL00 mid")
|
||||
r_naphta_cif_low = fields.Float("Naph C Med l", digits=(1,2), help="Naphta Cif PAAAH00 low")
|
||||
r_naphta_cif_high = fields.Float("Naph C Med h", digits=(1,2), help="Naphta Cif PAAAH00 high")
|
||||
r_naphta_cif_mid = fields.Float("Naph C Med m", digits=(1,2), help="Naphta Cif PAAAH00 mid")
|
||||
r_jet_cif_low = fields.Float("Jet C Ara l", digits=(1,2), help="Naphta Cif AAZBN00 low")
|
||||
r_jet_cif_high = fields.Float("Jet C Ara h", digits=(1,2), help="Naphta Cif AAZBN00 high")
|
||||
r_jet_cif_mid = fields.Float("Jet C Ara m", digits=(1,2), help="Naphta Cif AAZBN00 mid")
|
||||
r_eur_fob_low = fields.Float("Ebob F Rdm l", digits=(1,2), help="Eurobob Fob AAQZV00 low")
|
||||
r_eur_fob_high = fields.Float("Ebob F Rdm h", digits=(1,2), help="Eurobob Fob AAQZV00 high")
|
||||
r_eur_fob_mid = fields.Float("Ebob F Rdm m", digits=(1,2), help="Eurobob Fob AAQZV00 mid")
|
||||
r_gaz_cif_low = fields.Float("Gas10 C Ara l", digits=(1,2), help="Gasoline Cif AAXFQ00 low")
|
||||
r_gaz_cif_high = fields.Float("Gas10 C Ara h", digits=(1,2), help="Gasoline Cif AAXFQ00 high")
|
||||
r_gaz_cif_mid = fields.Float("Gas10 C Ara m", digits=(1,2), help="Gasoline Cif AAXFQ00 mid")
|
||||
r_brent_1 = fields.Float("Brent1 m", digits=(1,2), help="Brent AAYES00 mid")
|
||||
r_brent_2 = fields.Float("Brent2 m", digits=(1,2), help="Brent AAYET00 mid")
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(PriceValueReport2, cls).__setup__()
|
||||
cls._order.insert(0, ('r_price_date', 'DESC'))
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
pool = Pool()
|
||||
PriceValue = pool.get('price.price_value')
|
||||
Price = pool.get('price.price')
|
||||
pp = Price.__table__()
|
||||
pv = PriceValue.__table__()
|
||||
|
||||
context = Transaction().context
|
||||
dtfrom = context.get('dtfrom')
|
||||
dtto = context.get('dtto')
|
||||
#user = context.get('user')
|
||||
|
||||
wh = ((pp.price_area == 'platts') & (pv.price_date <= dtto) & (pv.price_date >= dtfrom))
|
||||
|
||||
query = pv.join(pp, condition=pv.price == pp.id).select(
|
||||
Literal(0).as_('create_uid'),
|
||||
CurrentTimestamp().as_('create_date'),
|
||||
Literal(None).as_('write_uid'),
|
||||
Literal(None).as_('write_date'),
|
||||
Max(pv.id).as_('id'),
|
||||
Max(pv.price).as_('r_price'),
|
||||
Max(pp.price_index).as_('r_price_index'),
|
||||
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(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'),
|
||||
Max(Case((pv.price==9, pv.low_price),else_=0)).as_('r_jet_fob_low'),
|
||||
Max(Case((pv.price==9, pv.high_price),else_=0)).as_('r_jet_fob_high'),
|
||||
Max(Case((pv.price==9, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_jet_fob_mid'),
|
||||
Max(Case((pv.price==16, pv.low_price),else_=0)).as_('r_naphta_cif_low'),
|
||||
Max(Case((pv.price==16, pv.high_price),else_=0)).as_('r_naphta_cif_high'),
|
||||
Max(Case((pv.price==16, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_naphta_cif_mid'),
|
||||
Max(Case((pv.price==17, pv.low_price),else_=0)).as_('r_jet_cif_low'),
|
||||
Max(Case((pv.price==17, pv.high_price),else_=0)).as_('r_jet_cif_high'),
|
||||
Max(Case((pv.price==17, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_jet_cif_mid'),
|
||||
Max(Case((pv.price==11, pv.low_price),else_=0)).as_('r_eur_fob_low'),
|
||||
Max(Case((pv.price==11, pv.high_price),else_=0)).as_('r_eur_fob_high'),
|
||||
Max(Case((pv.price==11, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_eur_fob_mid'),
|
||||
Max(Case((pv.price==18, pv.low_price),else_=0)).as_('r_gaz_cif_low'),
|
||||
Max(Case((pv.price==18, pv.high_price),else_=0)).as_('r_gaz_cif_high'),
|
||||
Max(Case((pv.price==18, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_gaz_cif_mid'),
|
||||
Max(Case((pv.price==19, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_brent_1'),
|
||||
Max(Case((pv.price==20, (pv.high_price-pv.low_price)/2 + pv.low_price),else_=0)).as_('r_brent_2'),
|
||||
|
||||
where=wh,
|
||||
group_by=[pv.price_date])
|
||||
|
||||
return query
|
||||
|
||||
class PVRContext2(ModelView):
|
||||
"Price Value Report Context"
|
||||
__name__ = 'price.price_value.report.context2'
|
||||
|
||||
dtfrom = fields.Date("From")
|
||||
dtto = fields.Date("To")
|
||||
user = fields.Many2One('res.user', "User")
|
||||
|
||||
@classmethod
|
||||
def default_dtto(cls):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
return Date.today() - datetime.timedelta(1)#.replace(day=1,month=1,year=1999)
|
||||
|
||||
@classmethod
|
||||
def default_dtfrom(cls):
|
||||
pool = Pool()
|
||||
Date = pool.get('ir.date')
|
||||
return Date.today() - datetime.timedelta(30)#.replace(day=1,month=1,year=1999)
|
||||
102
modules/price/price_value.xml
Executable file
102
modules/price/price_value.xml
Executable file
@@ -0,0 +1,102 @@
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="price_value_view_tree">
|
||||
<field name="model">price.price_value</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="15"/>
|
||||
<field name="name">price_value_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="price_value_view_graph">
|
||||
<field name="model">price.price_value</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">price_value_graph</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="price_value_view_tree_sequence">
|
||||
<field name="model">price.price_value</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">price_value_tree_sequence</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="price_value_view_form">
|
||||
<field name="model">price.price_value</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority" eval="30"/>
|
||||
<field name="name">price_value_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_price_value_form">
|
||||
<field name="name">Price Value</field>
|
||||
<field name="res_model">price.price_value</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_price_value_form_view3">
|
||||
<field name="sequence" eval="25"/>
|
||||
<field name="view" ref="price_value_view_graph"/>
|
||||
<field name="act_window" ref="act_price_value_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_price_value_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="price_value_view_tree"/>
|
||||
<field name="act_window" ref="act_price_value_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_price_value_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="price_value_view_form"/>
|
||||
<field name="act_window" ref="act_price_value_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="price_report_view_list">
|
||||
<field name="model">price.price_value.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">price_report_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_price_report_form">
|
||||
<field name="name">Platts Price report</field>
|
||||
<field name="res_model">price.price_value.report</field>
|
||||
<field name="context_model">price.price_value.report.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_price_report_form_view">
|
||||
<field name="sequence" eval="70"/>
|
||||
<field name="view" ref="price_report_view_list"/>
|
||||
<field name="act_window" ref="act_price_report_form"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="price_report_context_view_form">
|
||||
<field name="model">price.price_value.report.context</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">price_report_context_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="price_report_view_list2">
|
||||
<field name="model">price.price_value.report2</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">price_report_list2</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_price_report_form2">
|
||||
<field name="name">European M Scan</field>
|
||||
<field name="res_model">price.price_value.report2</field>
|
||||
<field name="context_model">price.price_value.report.context2</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_price_report_form_view2">
|
||||
<field name="sequence" eval="70"/>
|
||||
<field name="view" ref="price_report_view_list2"/>
|
||||
<field name="act_window" ref="act_price_report_form2"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="price_report_context_view_form2">
|
||||
<field name="model">price.price_value.report.context2</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">price_report_context_form2</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="menu_price"
|
||||
sequence="90"
|
||||
action="act_price_value_form"
|
||||
id="menu_price_value_form"/>
|
||||
</data>
|
||||
</tryton>
|
||||
127
modules/price/setup.py
Executable file
127
modules/price/setup.py
Executable file
@@ -0,0 +1,127 @@
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
from configparser import ConfigParser
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
def read(fname):
|
||||
content = io.open(
|
||||
os.path.join(os.path.dirname(__file__), fname),
|
||||
'r', encoding='utf-8').read()
|
||||
content = re.sub(
|
||||
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
|
||||
return content
|
||||
|
||||
|
||||
def get_require_version(name):
|
||||
require = '%s >= %s.%s, < %s.%s'
|
||||
require %= (name, major_version, minor_version,
|
||||
major_version, minor_version + 1)
|
||||
return require
|
||||
|
||||
|
||||
config = ConfigParser()
|
||||
config.read_file(open(os.path.join(os.path.dirname(__file__), 'tryton.cfg')))
|
||||
info = dict(config.items('tryton'))
|
||||
for key in ('depends', 'extras_depend', 'xml'):
|
||||
if key in info:
|
||||
info[key] = info[key].strip().splitlines()
|
||||
version = info.get('version', '0.0.1')
|
||||
major_version, minor_version, _ = version.split('.', 2)
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
name = 'trytond_price'
|
||||
|
||||
if minor_version % 2:
|
||||
download_url = ''
|
||||
else:
|
||||
download_url = 'http://downloads.tryton.org/%s.%s/' % (
|
||||
major_version, minor_version)
|
||||
|
||||
requires = ['python-sql >= 0.4', 'python-stdnum >= 1.15']
|
||||
for dep in info.get('depends', []):
|
||||
if not re.match(r'(ir|res)(\W|$)', dep):
|
||||
requires.append(get_require_version('trytond_%s' % dep))
|
||||
requires.append(get_require_version('trytond'))
|
||||
|
||||
tests_require = [get_require_version('proteus'), 'phonenumbers']
|
||||
|
||||
setup(name=name,
|
||||
version=version,
|
||||
description='Tryton module with parties and addresses',
|
||||
author='Tryton',
|
||||
author_email='foundation@tryton.org',
|
||||
url='http://www.tryton.org/',
|
||||
download_url=download_url,
|
||||
project_urls={
|
||||
"Bug Tracker": 'https://bugs.tryton.org/',
|
||||
"Forum": 'https://www.tryton.org/forum',
|
||||
"Source Code": 'https://code.tryton.org/tryton',
|
||||
},
|
||||
keywords='tryton price',
|
||||
package_dir={'trytond.modules.price': '.'},
|
||||
packages=(
|
||||
['trytond.modules.price']
|
||||
+ ['trytond.modules.price.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.price': (info.get('xml', [])
|
||||
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
|
||||
'icons/*.svg', 'tests/*.rst']),
|
||||
},
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Plugins',
|
||||
'Framework :: Tryton',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Financial and Insurance Industry',
|
||||
'Intended Audience :: Legal Industry',
|
||||
'Intended Audience :: Manufacturing',
|
||||
'License :: OSI Approved :: '
|
||||
'GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: Bulgarian',
|
||||
'Natural Language :: Catalan',
|
||||
'Natural Language :: Chinese (Simplified)',
|
||||
'Natural Language :: Czech',
|
||||
'Natural Language :: Dutch',
|
||||
'Natural Language :: English',
|
||||
'Natural Language :: Finnish',
|
||||
'Natural Language :: French',
|
||||
'Natural Language :: German',
|
||||
'Natural Language :: Hungarian',
|
||||
'Natural Language :: Indonesian',
|
||||
'Natural Language :: Italian',
|
||||
'Natural Language :: Persian',
|
||||
'Natural Language :: Polish',
|
||||
'Natural Language :: Portuguese (Brazilian)',
|
||||
'Natural Language :: Romanian',
|
||||
'Natural Language :: Russian',
|
||||
'Natural Language :: Slovenian',
|
||||
'Natural Language :: Spanish',
|
||||
'Natural Language :: Turkish',
|
||||
'Natural Language :: Ukrainian',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Programming Language :: Python :: 3.10',
|
||||
'Programming Language :: Python :: 3.11',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Topic :: Office/Business',
|
||||
],
|
||||
license='GPL-3',
|
||||
python_requires='>=3.8',
|
||||
install_requires=requires,
|
||||
extras_require={
|
||||
'test': tests_require,
|
||||
'VIES': ['python-stdnum[SOAP]'],
|
||||
'phonenumbers': ['phonenumbers'],
|
||||
},
|
||||
zip_safe=False,
|
||||
entry_points="""
|
||||
[trytond.modules]
|
||||
price = trytond.modules.price
|
||||
""",
|
||||
)
|
||||
14
modules/price/tryton.cfg
Executable file
14
modules/price/tryton.cfg
Executable file
@@ -0,0 +1,14 @@
|
||||
[tryton]
|
||||
version=7.2.7
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
party
|
||||
currency
|
||||
company
|
||||
product
|
||||
product_month
|
||||
xml:
|
||||
price.xml
|
||||
price_value.xml
|
||||
message.xml
|
||||
4
modules/price/view/area_form.xml
Executable file
4
modules/price/view/area_form.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
</form>
|
||||
3
modules/price/view/area_tree.xml
Executable file
3
modules/price/view/area_tree.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
3
modules/price/view/area_tree_sequence.xml
Executable file
3
modules/price/view/area_tree_sequence.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
6
modules/price/view/calendar_form.xml
Executable file
6
modules/price/view/calendar_form.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<field name="calendar_line" mode="tree,form,calendar" colspan="4"
|
||||
view_ids="price.calendar_line_view_tree_sequence,price.calendar_line_view_form,price.calendar_line_view_calendar"/>
|
||||
</form>
|
||||
8
modules/price/view/calendar_line_calendar.xml
Executable file
8
modules/price/view/calendar_line_calendar.xml
Executable file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<calendar
|
||||
dtstart="price_date"
|
||||
dtend="price_date">
|
||||
<field name="price_state"/>
|
||||
</calendar>
|
||||
6
modules/price/view/calendar_line_form.xml
Executable file
6
modules/price/view/calendar_line_form.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="price_date"/>
|
||||
<field name="price_date"/>
|
||||
<label name="price_state"/>
|
||||
<field name="price_state"/>
|
||||
</form>
|
||||
4
modules/price/view/calendar_line_tree.xml
Executable file
4
modules/price/view/calendar_line_tree.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price_date"/>
|
||||
<field name="price_state"/>
|
||||
</tree>
|
||||
4
modules/price/view/calendar_line_tree_sequence.xml
Executable file
4
modules/price/view/calendar_line_tree_sequence.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price_date"/>
|
||||
<field name="price_state"/>
|
||||
</tree>
|
||||
3
modules/price/view/calendar_tree.xml
Executable file
3
modules/price/view/calendar_tree.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
3
modules/price/view/calendar_tree_sequence.xml
Executable file
3
modules/price/view/calendar_tree_sequence.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
6
modules/price/view/composite_form.xml
Executable file
6
modules/price/view/composite_form.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="price_add"/>
|
||||
<field name="price_add"/>
|
||||
<label name="ratio"/>
|
||||
<field name="ratio"/>
|
||||
</form>
|
||||
4
modules/price/view/composite_tree.xml
Executable file
4
modules/price/view/composite_tree.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price_add"/>
|
||||
<field name="ratio"/>
|
||||
</tree>
|
||||
4
modules/price/view/composite_tree_sequence.xml
Executable file
4
modules/price/view/composite_tree_sequence.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price_add"/>
|
||||
<field name="ratio"/>
|
||||
</tree>
|
||||
14
modules/price/view/cron_form.xml
Executable file
14
modules/price/view/cron_form.xml
Executable file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="frequency"/>
|
||||
<group id="frequency" col="-1">
|
||||
<field name="frequency"/>
|
||||
</group>
|
||||
<label name="last_update"/>
|
||||
<group id="run">
|
||||
<field name="last_update"/>
|
||||
<button name="run"/>
|
||||
</group>
|
||||
</form>
|
||||
7
modules/price/view/cron_list.xml
Executable file
7
modules/price/view/cron_list.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="frequency"/>
|
||||
<field name="last_update"/>
|
||||
</tree>
|
||||
4
modules/price/view/fixtype_form.xml
Executable file
4
modules/price/view/fixtype_form.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
</form>
|
||||
3
modules/price/view/fixtype_tree.xml
Executable file
3
modules/price/view/fixtype_tree.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
3
modules/price/view/fixtype_tree_sequence.xml
Executable file
3
modules/price/view/fixtype_tree_sequence.xml
Executable file
@@ -0,0 +1,3 @@
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
40
modules/price/view/price_form.xml
Executable file
40
modules/price/view/price_form.xml
Executable file
@@ -0,0 +1,40 @@
|
||||
<form>
|
||||
<group id="price_header">
|
||||
<label name="price_index"/>
|
||||
<field name="price_index"/>
|
||||
<label name="price_desc"/>
|
||||
<field name="price_desc"/>
|
||||
<label name="price_period"/>
|
||||
<field name="price_period"/>
|
||||
<label name="price_curve_type"/>
|
||||
<field name="price_curve_type"/>
|
||||
<label name="price_type"/>
|
||||
<field name="price_type"/>
|
||||
<label name="price_unit"/>
|
||||
<field name="price_unit"/>
|
||||
<label name="price_currency"/>
|
||||
<field name="price_currency"/>
|
||||
<label name="price_area"/>
|
||||
<field name="price_area"/>
|
||||
<label name="price_calendar"/>
|
||||
<field name="price_calendar"/>
|
||||
<label name="price_ct_size"/>
|
||||
<field name="price_ct_size"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Prices Values" id="price_value">
|
||||
<!-- <field name="price_values" mode="graph,tree" colspan="4"
|
||||
view_ids="price.price_value_view_graph,price.price_value_view_tree_sequence"/> -->
|
||||
<field name="price_values" mode="tree,graph" colspan="4"
|
||||
view_ids="price.price_value_view_tree_sequence,price.price_value_view_graph"/>
|
||||
</page>
|
||||
<page string="Composites" id="composites">
|
||||
<field name="price_composite" mode="tree,form" colspan="4"
|
||||
view_ids="price.composite_view_tree_sequence,price.composite_view_form"/>
|
||||
</page>
|
||||
<page string="Products" id="products">
|
||||
<field name="price_product" mode="tree,form" colspan="4"
|
||||
view_ids="price.product_view_tree_sequence,price.product_view_form"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
6
modules/price/view/price_report_context_form.xml
Executable file
6
modules/price/view/price_report_context_form.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="dt"/>
|
||||
<field name="dt"/>
|
||||
<label name="user"/>
|
||||
<field name="user"/>
|
||||
</form>
|
||||
6
modules/price/view/price_report_context_form2.xml
Executable file
6
modules/price/view/price_report_context_form2.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="dtfrom"/>
|
||||
<field name="dtfrom"/>
|
||||
<label name="dtto"/>
|
||||
<field name="dtto"/>
|
||||
</form>
|
||||
9
modules/price/view/price_report_list.xml
Executable file
9
modules/price/view/price_report_list.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="r_price_index"/>
|
||||
<field name="r_price_desc"/>
|
||||
<field name="r_price_date"/>
|
||||
<field name="r_price_value"/>
|
||||
<field name="r_low_price"/>
|
||||
<field name="r_high_price"/>
|
||||
</tree>
|
||||
24
modules/price/view/price_report_list2.xml
Executable file
24
modules/price/view/price_report_list2.xml
Executable file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="r_price_date"/>
|
||||
<field name="r_naphta_fob_low"/>
|
||||
<field name="r_naphta_fob_high"/>
|
||||
<field name="r_naphta_fob_mid"/>
|
||||
<field name="r_jet_fob_low"/>
|
||||
<field name="r_jet_fob_high"/>
|
||||
<field name="r_jet_fob_mid"/>
|
||||
<field name="r_naphta_cif_low"/>
|
||||
<field name="r_naphta_cif_high"/>
|
||||
<field name="r_naphta_cif_mid"/>
|
||||
<field name="r_jet_cif_low"/>
|
||||
<field name="r_jet_cif_high"/>
|
||||
<field name="r_jet_cif_mid"/>
|
||||
<field name="r_eur_fob_low"/>
|
||||
<field name="r_eur_fob_high"/>
|
||||
<field name="r_eur_fob_mid"/>
|
||||
<field name="r_gaz_cif_low"/>
|
||||
<field name="r_gaz_cif_high"/>
|
||||
<field name="r_gaz_cif_mid"/>
|
||||
<field name="r_brent_1"/>
|
||||
<field name="r_brent_2"/>
|
||||
</tree>
|
||||
9
modules/price/view/price_tree.xml
Executable file
9
modules/price/view/price_tree.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<tree>
|
||||
<field name="price_index"/>
|
||||
<field name="price_desc"/>
|
||||
<field name="price_type"/>
|
||||
<field name="price_curve_type"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_currency"/>
|
||||
<field name="price_area"/>
|
||||
</tree>
|
||||
8
modules/price/view/price_tree_sequence.xml
Executable file
8
modules/price/view/price_tree_sequence.xml
Executable file
@@ -0,0 +1,8 @@
|
||||
<tree>
|
||||
<field name="price_desc"/>
|
||||
<field name="price_type"/>
|
||||
<field name="price_curve_type"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_currency"/>
|
||||
<field name="price_area"/>
|
||||
</tree>
|
||||
17
modules/price/view/price_value_form.xml
Executable file
17
modules/price/view/price_value_form.xml
Executable file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<group id="price_value_header">
|
||||
<label name="price_index"/>
|
||||
<field name="price_index"/>
|
||||
<label name="price_date"/>
|
||||
<field name="price_date"/>
|
||||
<label name="price_value"/>
|
||||
<field name="price_value"/>
|
||||
<label name="open_price"/>
|
||||
<field name="open_price"/>
|
||||
<label name="low_price"/>
|
||||
<field name="low_price"/>
|
||||
<label name="high_price"/>
|
||||
<field name="high_price"/>
|
||||
</group>
|
||||
</form>
|
||||
14
modules/price/view/price_value_graph.xml
Executable file
14
modules/price/view/price_value_graph.xml
Executable file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<graph type="line">
|
||||
<x>
|
||||
<field name="price_date"/>
|
||||
</x>
|
||||
<y>
|
||||
<field name="price_value" fill="1" empty="0"/>
|
||||
<field name="open_price" fill="1" empty="0"/>
|
||||
<field name="low_price" fill="1" empty="0"/>
|
||||
<field name="high_price" fill="1" empty="0"/>
|
||||
</y>
|
||||
</graph>
|
||||
9
modules/price/view/price_value_tree.xml
Executable file
9
modules/price/view/price_value_tree.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="price_index"/>
|
||||
<field name="price_date"/>
|
||||
<field name="price_value"/>
|
||||
<field name="open_price"/>
|
||||
<field name="low_price"/>
|
||||
<field name="high_price"/>
|
||||
</tree>
|
||||
9
modules/price/view/price_value_tree_sequence.xml
Executable file
9
modules/price/view/price_value_tree_sequence.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<tree editable="1">
|
||||
<field name="price_index"/>
|
||||
<field name="price_date"/>
|
||||
<field name="price_value"/>
|
||||
<field name="open_price"/>
|
||||
<field name="low_price"/>
|
||||
<field name="high_price"/>
|
||||
</tree>
|
||||
6
modules/price/view/product_form.xml
Executable file
6
modules/price/view/product_form.xml
Executable file
@@ -0,0 +1,6 @@
|
||||
<form>
|
||||
<label name="price"/>
|
||||
<field name="price"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
</form>
|
||||
4
modules/price/view/product_tree.xml
Executable file
4
modules/price/view/product_tree.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price"/>
|
||||
<field name="product"/>
|
||||
</tree>
|
||||
4
modules/price/view/product_tree_sequence.xml
Executable file
4
modules/price/view/product_tree_sequence.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="price"/>
|
||||
<field name="product"/>
|
||||
</tree>
|
||||
Reference in New Issue
Block a user