ITSA points 28.06
This commit is contained in:
@@ -25,7 +25,8 @@ from io import BytesIO
|
||||
from xml.etree import ElementTree
|
||||
from trytond.modules.purchase_trade.purchase import (TRIGGERS)
|
||||
from trytond.modules.purchase_trade.company_defaults import (
|
||||
default_itsa_currency, default_itsa_unit, is_itsa_company)
|
||||
default_itsa_currency, default_itsa_price_calendar,
|
||||
default_itsa_price_fix_type, default_itsa_unit, is_itsa_company)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -594,6 +595,13 @@ class MtmScenario(ModelSQL, ModelView):
|
||||
def default_valuation_date_type():
|
||||
return 'fixed'
|
||||
|
||||
@classmethod
|
||||
def default_calendar(cls):
|
||||
if is_itsa_company():
|
||||
calendar = default_itsa_price_calendar()
|
||||
if calendar:
|
||||
return calendar
|
||||
|
||||
def get_resolved_valuation_date(self, name=None):
|
||||
return self.get_valuation_date()
|
||||
|
||||
@@ -777,12 +785,14 @@ class Mtm(ModelSQL, ModelView):
|
||||
|
||||
currency = fields.Many2One('currency.currency', "Currency")
|
||||
|
||||
def get_cur(self, name=None):
|
||||
if self.price_index:
|
||||
return self.price_index.price_currency
|
||||
if self.price_matrix:
|
||||
return self.price_matrix.currency
|
||||
return None
|
||||
def get_cur(self, name=None):
|
||||
if self.price_index:
|
||||
return self.price_index.price_currency
|
||||
if self.price_matrix:
|
||||
return self.price_matrix.currency
|
||||
if self.currency:
|
||||
return self.currency
|
||||
return None
|
||||
|
||||
@fields.depends('price_index','price_matrix')
|
||||
def on_change_with_currency(self):
|
||||
@@ -795,6 +805,18 @@ class Mtm(ModelSQL, ModelView):
|
||||
if currency:
|
||||
return currency
|
||||
|
||||
@classmethod
|
||||
def default_fix_type(cls):
|
||||
if is_itsa_company():
|
||||
fix_type = default_itsa_price_fix_type()
|
||||
if fix_type:
|
||||
return fix_type
|
||||
|
||||
@classmethod
|
||||
def default_ratio(cls):
|
||||
if is_itsa_company():
|
||||
return Decimal('100')
|
||||
|
||||
class PriceMatrix(ModelSQL, ModelView):
|
||||
"Price Matrix"
|
||||
__name__ = 'price.matrix'
|
||||
@@ -934,26 +956,24 @@ class Component(ModelSQL, ModelView):
|
||||
else:
|
||||
return '[' + self.fix_type.name + '] '
|
||||
|
||||
def get_cur(self, name=None):
|
||||
if self.price_index:
|
||||
PI = Pool().get('price.price')
|
||||
pi = PI(self.price_index)
|
||||
return pi.price_currency
|
||||
if self.price_matrix:
|
||||
return self.price_matrix.currency
|
||||
if self.price_source_type == 'fixed':
|
||||
return self.fixed_currency
|
||||
|
||||
@fields.depends(
|
||||
'price_source_type', 'price_index', 'price_matrix',
|
||||
'fixed_currency')
|
||||
def get_cur(self, name=None):
|
||||
if self.price_index:
|
||||
PI = Pool().get('price.price')
|
||||
pi = PI(self.price_index)
|
||||
return pi.price_currency
|
||||
if self.price_matrix:
|
||||
return self.price_matrix.currency
|
||||
return self.fixed_currency
|
||||
|
||||
@fields.depends(
|
||||
'price_source_type', 'price_index', 'price_matrix',
|
||||
'fixed_currency')
|
||||
def on_change_with_currency(self):
|
||||
if self.price_source_type == 'curve' and self.price_index:
|
||||
return self.get_cur()
|
||||
if self.price_source_type == 'matrix' and self.price_matrix:
|
||||
return self.get_cur()
|
||||
if self.price_source_type == 'fixed':
|
||||
return self.fixed_currency
|
||||
return self.fixed_currency
|
||||
|
||||
@classmethod
|
||||
def default_fixed_currency(cls):
|
||||
@@ -961,6 +981,25 @@ class Component(ModelSQL, ModelView):
|
||||
currency = default_itsa_currency()
|
||||
if currency:
|
||||
return currency
|
||||
|
||||
@classmethod
|
||||
def default_fix_type(cls):
|
||||
if is_itsa_company():
|
||||
fix_type = default_itsa_price_fix_type()
|
||||
if fix_type:
|
||||
return fix_type
|
||||
|
||||
@classmethod
|
||||
def default_ratio(cls):
|
||||
if is_itsa_company():
|
||||
return Decimal('100')
|
||||
|
||||
@classmethod
|
||||
def default_calendar(cls):
|
||||
if is_itsa_company():
|
||||
calendar = default_itsa_price_calendar()
|
||||
if calendar:
|
||||
return calendar
|
||||
|
||||
@classmethod
|
||||
def set_cur(cls, components, name, value):
|
||||
|
||||
Reference in New Issue
Block a user