-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Bom item field calculation #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for field calculation events on BOM (Bill of Materials) items, enabling custom field calculations when BOM items are created, modified, copied, or indexed. The implementation includes extensive custom attribute support (120 custom fields across char, bigchar, integer, float, boolean, and date types) to allow users to perform calculations on BOM item data.
- Introduces a new
BOMItemFieldCalculationEventthat follows the same pattern as the existingPartFieldCalculationEvent - Adds 120 custom attribute fields to the
BOMItemclass (20 fields each for char, bigchar, integer, float, boolean, and date types) - Updates the
get_items_of_typeutility function to support finding single object instances in addition to lists
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| json_schemas/request.json | Adds JSON schema definitions for BOMItem with all standard and custom fields, BOMItemFieldCalculationData, and BOMItemFieldCalculationEvent; updates event discriminator mapping |
| csfunctions/objects/part.py | Extends BOMItem class with cdb_object_id field, 120 custom attribute fields, part reference field, and link_objects method for establishing object relationships |
| csfunctions/events/bom_item_field_calculation.py | Defines new BOMItemFieldCalculationEvent and BOMItemFieldCalculationData classes following established event patterns |
| csfunctions/events/base.py | Adds BOM_ITEM_FIELD_CALCULATION to EventNames enum |
| csfunctions/events/init.py | Exports new BOMItemFieldCalculationEvent and BOMItemFieldCalculationData classes and includes them in event type unions |
| csfunctions/util.py | Enhances get_items_of_type function to handle single object instances in addition to lists, required for BOMItem's link_objects method |
| docs/reference/objects.md | Documents all 120 new custom attribute fields and the part reference field added to BOMItem |
| docs/reference/events.md | Documents the new BOMItemFieldCalculationEvent with its data structure, action types, and field descriptions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds event for field calculation on BOM Items.
Also adds missing custom attributes on BOM Items, because those are the attributes you would usually want to do calculations on.