Auto update cost item rates when enabling editing non-sor cost schedule

There was an issue that it wouldn't load until you manually select it in the "Cost Item Rates" enum - otherwise items didn't appear the first time cost schedule opened and didn't not update when you makes changes to the active schedule of rates.
This commit is contained in:
Andrej730
2024-11-21 16:04:22 +05:00
parent 6e56fe8f9b
commit 8a31e8d149
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -54,6 +54,8 @@ def enable_editing_cost_items(cost: tool.Cost, cost_schedule: ifcopenshell.entit
cost.enable_editing_cost_items(cost_schedule)
cost.load_active_schedule_columns()
cost.load_cost_schedule_tree()
if not cost.is_active_schedule_of_rates() and (schedule_of_rates := cost.get_active_schedule_of_rates()):
cost.load_schedule_of_rates_tree(schedule_of_rates)
cost.play_sound()
+8
View File
@@ -551,6 +551,14 @@ class Cost(bonsai.core.tool.Cost):
props = bpy.context.scene.BIMCostProperties
props.columns.remove(props.columns.find(name))
@classmethod
def get_active_schedule_of_rates(cls) -> Union[ifcopenshell.entity_instance, None]:
props = bpy.context.scene.BIMCostProperties
schedule_id = tool.Blender.get_enum_safe(props, "schedule_of_rates")
if schedule_id is None:
return
return tool.Ifc.get().by_id(int(schedule_id))
@classmethod
def expand_cost_item_rate(cls, cost_item: ifcopenshell.entity_instance) -> None:
props = bpy.context.scene.BIMCostProperties