mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1315 from SchrodingersGat/copy-bom-fix
Fix for duplicating BOM
This commit is contained in:
commit
25ada20a19
@ -304,11 +304,11 @@
|
||||
|
||||
.rowinvalid {
|
||||
color: #A00;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.rowinherited {
|
||||
background-color: #dde;
|
||||
background-color: #eee;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
|
@ -1524,7 +1524,7 @@ class Part(MPTTModel):
|
||||
|
||||
# Copy existing BOM items from another part
|
||||
# Note: Inherited BOM Items will *not* be duplicated!!
|
||||
for bom_item in other.bom_items.all():
|
||||
for bom_item in other.get_bom_items(include_inherited=False).all():
|
||||
# If this part already has a BomItem pointing to the same sub-part,
|
||||
# delete that BomItem from this part first!
|
||||
|
||||
@ -2094,6 +2094,8 @@ class BomItem(models.Model):
|
||||
- Quantity
|
||||
- Reference field
|
||||
- Note field
|
||||
- Optional field
|
||||
- Inherited field
|
||||
|
||||
"""
|
||||
|
||||
@ -2106,6 +2108,8 @@ class BomItem(models.Model):
|
||||
hash.update(str(self.quantity).encode())
|
||||
hash.update(str(self.note).encode())
|
||||
hash.update(str(self.reference).encode())
|
||||
hash.update(str(self.optional).encode())
|
||||
hash.update(str(self.inherited).encode())
|
||||
|
||||
return str(hash.digest())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user