Delivery period changed into Shipment period

This commit is contained in:
2026-06-13 11:04:13 +02:00
parent 77b1ab333b
commit ec90d19cc7
10 changed files with 288 additions and 51 deletions

View File

@@ -22,8 +22,10 @@ import logging
import re
import zipfile
from io import BytesIO
from xml.etree import ElementTree
from trytond.modules.purchase_trade.purchase import (TRIGGERS)
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)
logger = logging.getLogger(__name__)
@@ -586,9 +588,16 @@ class MtmStrategy(ModelSQL, ModelView):
'pricing.component', 'strategy', "Components"
)
@classmethod
def default_active(cls):
return True
@classmethod
def default_active(cls):
return True
@classmethod
def default_currency(cls):
if is_itsa_company():
currency = default_itsa_currency()
if currency:
return currency
def get_mtm(self,line,qty):
pool = Pool()
@@ -709,11 +718,18 @@ class Mtm(ModelSQL, ModelView):
return self.price_matrix.currency
return None
@fields.depends('price_index','price_matrix')
def on_change_with_currency(self):
return self.get_cur()
class PriceMatrix(ModelSQL, ModelView):
@fields.depends('price_index','price_matrix')
def on_change_with_currency(self):
return self.get_cur()
@classmethod
def default_currency(cls):
if is_itsa_company():
currency = default_itsa_currency()
if currency:
return currency
class PriceMatrix(ModelSQL, ModelView):
"Price Matrix"
__name__ = 'price.matrix'
@@ -737,11 +753,25 @@ class PriceMatrix(ModelSQL, ModelView):
valid_from = fields.Date("Valid From")
valid_to = fields.Date("Valid To")
lines = fields.One2Many(
'price.matrix.line', 'matrix', "Lines"
)
class PriceMatrixLine(ModelSQL, ModelView):
lines = fields.One2Many(
'price.matrix.line', 'matrix', "Lines"
)
@classmethod
def default_currency(cls):
if is_itsa_company():
currency = default_itsa_currency()
if currency:
return currency
@classmethod
def default_unit(cls):
if is_itsa_company():
unit = default_itsa_unit()
if unit:
return unit
class PriceMatrixLine(ModelSQL, ModelView):
"Price Matrix Line"
__name__ = 'price.matrix.line'
@@ -851,13 +881,20 @@ class Component(ModelSQL, ModelView):
@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
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
@classmethod
def default_fixed_currency(cls):
if is_itsa_company():
currency = default_itsa_currency()
if currency:
return currency
@classmethod
def set_cur(cls, components, name, value):