See cm.abstract.part
section in 16.5 New Features migration guide for new CustomSpecOption
class documentation .
The following functions are now part of the old pricing system. They are still available for backwards compatibility (except basePrice
which has been overloaded in core Part
).
Migration to the new pricing API should happen as soon as possible. The new pricing API is introduced in v16.5 and documented in the cm.core.part.Part
documentation.
public double customListPrice(bool includeChildren=false, str currency=null, Space space=null) {} extend public double specialListPrice(double listPrice) {} extend public Double baseOptionPrice() {} extend public Double specialOptionPrice() {} extend public double optionSpecialUpcharge() {} extend public Double upcharge() {} Old: extend public double basePrice() {} New: extend public double basePrice(bool includeChildren=false, Space space=null, bool translatePrice=true) {}
See cm.abstract.part
section in 16.5 New Features migration guide for new CustomOptionSpecial
class documentation .
The upcharge method for SpecOption
has been extended to support:
Old: extend public double upcharge(ProdPart owner=null) {} New: extend public double upcharge(Part owner=null, Space space=null, bool translatePrice=false) {}
Old:
OptionSpecial
adjustments (replace or add).New:
The following fields and methods have been added and changed in the OptionSpecial
class:
// FIELDS Added: public int level; Added: public int sequence; // METHODS Added: public void copy(PartSpecial special) {} Added: extend public str optStr=(str value) {} Added: extend public str optDescStr=(str value) {} Added: extend public int level=(int value) {} Added: extend public int sequence=(int value) {} Added: extend public Part originalPart=(Part value) {} Added: extend public str originalOptStr=(str value) {} // UPDATED Old: public constructor(str partNum, str descr, bool priceReplace, double amount|, str optStr, str optDescStr, Part originalPart, str originalOptStr) {} New: public constructor(str partNum, str descr, bool priceReplace, double amount|, str optStr, str optDescStr, Part originalPart=null, str originalOptStr=null, int level=0, int sequence=-1) {} public str flattenableKey() { StrBuf res(super()); res << optStr << optDescStr New: << level New: << sequence << originalPart << originalPart.specialsKey(); return res.toS(); }
Both specOptions
and appendSpecOptions
now accept a new boolean parameter invalidateOptionPrice (default: true).
This works with the new option price caching mechanism by allowing the system to selectively invalidate the cached option price sum when spec options are modified.
Old: final public SpecOption[] specOptions=(SpecOption[] newOptions) {} New: final public SpecOption[] specOptions=(SpecOption[] newOptions, bool invalidateOptionPrice=true) {} Old: extend public void appendSpecOptions(SpecOption[] newOptions) {} New: extend public void appendSpecOptions(SpecOption[] newOptions, bool invalidateOptionPrice=true) {}
Old:
New:
invalidateOptionPriceSum()
is triggered to ensure the cache stays correctinvalidateOptionPrice=false
to skip cache invalidation if they plan to manage it manually or delay recalculation.bool invalidateWorldPrice
parameter to special functions
PartOptionItem
s
SpecOption
sAdded: extend public void putOptSpecial(PartOptionItem opt, OptionSpecial special, PropObj s=null, bool invalidateWorldPrice=true) {} Old: extend public void generateOptAdjustmentSifRows(SpecOption opt, str[] lines) {} New: extend public void generateOptAdjustmentSifRows(PartOptionItem opt, str[] lines) {} Old: extend public str optSpecialKey(SpecOption opt) {} New: extend public str optSpecialKey(PartOptionItem opt) {} Old: extend public OptionSpecial getOptSpecial(SpecOption opt, PropObj s=null) {} New: extend public OptionSpecial getOptSpecial(PartOptionItem opt, PropObj s=null) {} Old: extend public void removeOptSpecial(SpecOption opt, PropObj s=null) {} New: extend public void removeOptSpecial(PartOptionItem opt, PropObj s=null, bool invalidateWorldPrice=true) {} Old: extend public void removeOptSpecials(PropObj s=null) {} New: extend public void removeOptSpecials(PropObj s=null, bool invalidateWorldPrice=true) {} Old: extend public void removeAllSpecials(PropObj s=null) {} New: extend public void removeAllSpecials(PropObj s=null, bool invalidateWorldPrice=true) {}
PartOptionItem opt
: Option for row to get cell for (can be null)int columnIdx
: Column index to get cell for Part part
: Part owning option row to get cell for (can be null)
opt
is null or column index is out of bounds, returns getDefaultCell
getCellBrush
Old:
GridCell
s New:
getOptionRowCell
for each column and appending it to the returned GridCell
sequenceOld:
Old: public constructor(PartGridBuilderEnv env=null) { this.env = env; }
New:
New: public constructor(PartGridBuilderEnv env=null) { this.env = env ?? ProdPartGridBuilderEnv(buildTotalsRow=true); }
See cm.abstract.part
section in 16.5 New Features migration guide for new CustomSpecOption
class documentation .
AbsPart
now returns a SpecOptionInfoTree
by default when generating info treesextend public PartInfoTree createInfoTree(SpecOption option, PartInfoTree parent=null) { Old: return null; New: return SpecOptionInfoTree(this, option, parent=parent); }
The following functions are now part of the old pricing system. They are still available for backwards compatibility (except basePrice
which has been overloaded in core Part
).
Migration to the new pricing API should happen as soon as possible. The new pricing API is introduced in v16.5 and documented in the cm.core.part.Part
documentation.
public double customListPrice(bool includeChildren=false, str currency=null, Space space=null) {} extend public double specialListPrice(double listPrice) {} extend public Double baseOptionPrice() {} extend public Double specialOptionPrice() {} extend public double optionSpecialUpcharge() {} extend public Double upcharge() {} Old: extend public double basePrice() {} New: extend public double basePrice(bool includeChildren=false, Space space=null, bool translatePrice=true) {}
The AbsBasePricePartColumn
value now calls the new basePrice(..)
function on core Part
.
Old:
AbsPart
part.basePrice()
if soNew:
basePrice(..)
function value directly from core PartThe AbsUpchargePartColumn
value now calls the new optionPriceSum(..)
function on core Part
.
Old:
AbsPart
part.upcharge()
if soNew:
optionPriceSum(..)
function value directly from core PartOld:
NameGridCell
with the value New:
item
is a SpecOptionInfoTree
, returns a SpecOptionNameGridCell
with the item
s associated value, part, and optionNameGridCell
with the value public GridCell gridCell(PartInfoTree item, Space space, symbol view=null) { str value = output(item, space); if (value.empty()) return null; New: if (item as SpecOptionInfoTree) { New: return SpecOptionNameGridCell(value, item.part, item.specOption, align=left); New: } return NameGridCell(value, left); }
See cm.abstract.part
section in 16.5 New Features migration guide for new CustomOptionSpecial
class documentation .
Old:
_columns
field was set, its value was returnedsuper()
was returned (which is null)Old: public PartColumn[] columns() { return _columns ?? super(); }
New:
_columns
field was set, its value was returnedSpecOption
columns
specOptionInfoColumn
(option code)specOptionDescColumn
(option description)specOptionUpchargeColumn
(option price)New: public PartColumn[] columns() { return _columns ?? [PartColumn: specOptionInfoColumn, specOptionDescColumn, specOptionUpchargeColumn]; }
The ProdPart
class constructors have been expanded and split to support the new part pricing system (introduced in 16.5).
New constructors now accept basePrice
and optionPriceSum
separately.
Old constructors that use list price remain available but are marked for deprecation in a future version.
constructor(Snapper snapper, str articleCode, str description, double listPrice, …)
constructor(Snapper snapper, str articleCode, str description, double basePrice, Double optionPriceSum, …)
cm.core.part.Part
compile-time section for more migration tipsIntroduces a new method to compute the total option price, explicitly aggregating all SpecOption upcharges, including specials.
specOptions()
.upcharge(this)
for contextual pricing.generateOptionPriceSum()
in your extended Part class.invalidateOptionPriceSum()
) when option state changes to trigger regeneration.The invalidateSpecOptions
method is introduced alongside the new SpecOptions caching mechanism.
invalidateOptionPriceSum
is true (default), also clears the cached option price sum.invalidateSpecOptions()
to prevent stale valuesrebuildSpecOptions
documentation)invalidateSpecOptions()
in those paths to ensure cache consistency.Both appendSpecOptions
and appendSpecOption
now accept a new boolean parameter invalidateOptionPrice
(default: true).
This works with the new option price caching mechanism by allowing the system to selectively invalidate the cached option price sum when spec options are modified.
Old: extend public void appendSpecOptions(SpecOption[] newOptions) {} New: extend public void appendSpecOptions(SpecOption[] newOptions, bool invalidateOptionPrice=true) {} Old: extend public void appendSpecOption(SpecOption newOption) {} New: extend public void appendSpecOption(SpecOption newOption, bool invalidateOptionPrice=true) {}
Old:
New:
invalidateOptionPriceSum()
is triggered to ensure the cache stays correctinvalidateOptionPrice=false
to skip cache invalidation if they plan to manage it manually or delay recalculation.With the introduction of custom options in the query dialog, the following changes were made in ProdPart
:
specOptions()
now inserts custom options
CustomSpecOption
s sequence
valuesequence
is -1 (default for CustomSpecOption
)nonCustomSpecOptions()
SpecOption
s except CustomSpecOption
sCustomSpecOption
instances while collectingcustomSpecOptions()
CustomSpecOption
s only.PartSpecialHolder
lookup to gather user-defined options.SpecOption
s
private SpecOption[] _specOptions : stream=null
_partOptions
changesspecOptions()
now cached
_specOptions
, rebuilds only if null, otherwise returns cached.rebuildSpecOptions()
SpecOption
sequence rebuilding CustomSpecOption
s) in addition to standard onesAdded: private SpecOption[] _specOptions : stream=null; Added: final public SpecOption[] nonCustomSpecOptions() {} Added: extend public void insertCustomOptions(SpecOption[] ops) {} Added: extend public SpecOption[] rebuildSpecOptions() {} Added: extend public void invalidateSpecOptions() {} Added: extend public CustomSpecOption[] customSpecOptions() {} Added: extend public CustomOptionSpecial[] getCustomOptionSpecials(PropObj s=null) {}
With the addition of the new Attribute Note and Description columns in the Calculations dialog, the following changes have been made to ProdPart
:
partToOwnerKey
function
partSourceID
value appended to the super()
valuegenerateSifAnnotationRows
function
Part
s PartAnnotation
sPartAnnotation
PartAnnotation
s note valuePartAnnotation
s description valuegenerateAttributeData
function
Part
s PartAnnotation
sAttributeData
objects for each PartAnnotation
AttributeData
objects to the ItemData
s attributes
sequenceinitializeAnnotationsFromItemData
ItemData
s attributes
sequence PartAnnotation
objects from the AttributeData
sadds the
PartAnnotationobjects to the
Part`s annotations// Part-to-Owner key New: public str partToOwnerKey() {} // SIF New: extend public void generateSifAnnotationRows(str[] lines) {} // PMX New: extend public void generateAttributeData(ItemData itemData) {} //PMX Import New: extend public void initializeAnnotationsFromItemData(ItemData item, ProjectInformation projectInfo) {}
A new SpecOptionUpchargeInfoTreeColumn
has been added to display price values associated with SpecOption
s in a PartInfoTree
SpecOptionNameGridCell