Skip to content

feat inv dim propagation#340

Open
robproject wants to merge 2 commits intoversion-15from
feat_inv_dim_propagation
Open

feat inv dim propagation#340
robproject wants to merge 2 commits intoversion-15from
feat_inv_dim_propagation

Conversation

@robproject
Copy link
Copy Markdown
Collaborator

@robproject robproject commented Apr 17, 2026

Description

  • Add inventory dimensions to get_handling_unit method, using cached list of dimensions, for update of all target child table documents.
  • Refactor Handling Unit inventory dimension creation into method to be shared by any app for Inventory Dimension creation.
  • Add custom_carry_forward field to Inventory Dimension DocType for use in propagate_inventory_dimensions.
  • Add propagate_inventory_dimensions method as before_submit hook on Stock Entry to enable below behavior. BEAM's handling_unit.py is updated to not overwrite target_handling_unit if it has a value set already, unless the HU qty and transfer qty don't match.
custom_carry_forward Transfer qty to_handling_unit result
On qty == stock (full) Same HU (conserved)
On qty != stock (split) New HU (BEAM overrides)
Off any New HU (BEAM default)
  • Update tests.
  • Syntax changes in scan/init.py for v16: pass frappe._dict(), use SUM dict in frappe.get_all()
  • Similar to 135 preserve complete hu #137 but applies to any configured Inventory Dimension and accounts for qty splitting.

@github-actions
Copy link
Copy Markdown

📝 Draft Changelog Entry

Changelog

This update adds inventory dimension propagation functionality to Stock Entry documents. When a Stock Entry is submitted, inventory dimensions are now automatically carried forward to handling units based on configuration settings.

A new custom_carry_forward field has been added to the Inventory Dimension DocType. When this field is enabled, handling units are preserved during full quantity transfers. For partial quantity transfers, new handling units are created as before. When the field is disabled, the default behavior of creating new handling units applies to all transfers.

The handling unit creation process has been refactored into a shared method that can be utilized across applications for inventory dimension creation. The get_handling_unit method now includes inventory dimensions using a cached list to ensure all target child table documents are updated consistently.

Technical updates include syntax changes in the scan module for compatibility with Frappe v16, including the use of frappe._dict() and SUM dictionary operations in frappe.get_all() calls.

This changelog entry was automatically generated by the Changelog Generator Action.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py10100% 
hooks.py150100% 
install.py330%4, 7–8
beam
   __init__.py00100% 
   barcodes.py1053863%21, 30, 36–37, 44, 56, 78–79, 81–82, 88–90, 92–94, 101–103, 109, 119, 127, 134, 137–138, 144–145, 151, 157, 163, 169, 181, 184–187, 189–190
   boot.py12120%4, 6, 9–12, 17, 19–20, 24–25, 28
   handling_unit.py844744%30, 33, 54–57, 61–63, 66, 69–73, 81, 92–93, 99–100, 102–103, 105–106, 108–109, 111, 113–116, 118–120, 122, 124, 126–127, 132, 134, 138, 140–141, 144, 146–147, 155
   inventory_dimension.py411368%38–39, 41–43, 45–46, 48, 50–51, 53, 57–58
   printing.py935540%18–19, 48, 50–53, 62–66, 70–71, 83–87, 91, 97, 106–112, 114–115, 117, 122, 124–125, 140–145, 147–153, 160–163, 165–168
   zpl_layout.py2462460%12–15, 17, 20, 36, 47–48, 51–52, 54–55, 58, 61, 64–67, 69–71, 77, 81–83, 86–87, 90–91, 93–94, 99, 101, 110–111, 113, 115, 118–120, 122–125, 128–129, 132, 140–141, 144–146, 154, 157, 161, 164, 167, 177–183, 185, 188, 193–196, 198, 201–206, 209–215, 217, 219, 222, 224–227, 231–233, 235–239, 241–245, 249–253, 258, 260, 263–269, 278–282, 285–292, 295–308, 311–313, 316–328, 331, 334–336, 339–353, 356–361, 364, 366, 369, 384, 386–387, 390–391, 393, 395, 397–399, 402, 411, 418–420, 423–424, 427, 429–433, 436, 439–442, 445–448, 451–453, 469, 471, 474–475, 496–501, 505, 507–508, 516–521, 524–525
beam/doctype
   __init__.py00100% 
beam/doctype/beam_settings
   __init__.py00100% 
   beam_settings.py17570%14–18
beam/doctype/handling_unit
   __init__.py9366%12–14
   handling_unit.py16193%16
   test_handling_unit.py30100% 
beam/overrides
   network_printer_settings.py403220%14–18, 24–34, 42–46, 49, 52–55, 57–62
   stock_entry.py933859%60, 62, 70–73, 81–84, 86, 94–97, 99, 107–109, 115–116, 121–128, 134–135, 151, 169, 174, 180, 186, 189–190
beam/print_format
   __init__.py00100% 
beam/print_format/handling_unit_6x4_zpl_format
   __init__.py00100% 
beam/print_format/handling_unit_label
   __init__.py00100% 
beam/print_format/item_barcode
   __init__.py00100% 
beam/print_format/labelary_print_preview
   __init__.py00100% 
beam/print_format/microqr_serial_no
   __init__.py00100% 
beam/print_format/warehouse_barcode
   __init__.py00100% 
beam/report
   __init__.py00100% 
beam/report/handling_unit_traceability
   __init__.py00100% 
   handling_unit_traceability.py44440%4–6, 9–11, 30–32, 34–35, 37–38, 41–42, 45–46, 48–49, 51–52, 54–55, 57, 63–65, 67–69, 71, 74–77, 79–81, 83–86, 89–90
beam/scan
   __init__.py2076966%47, 57, 113–115, 144–145, 147, 149, 153, 155–156, 158, 165–166, 169–170, 172–174, 178, 182–186, 192–199, 205, 207–208, 212, 216–217, 220, 226, 257–261, 267, 270, 277, 285, 300, 302, 330–331, 337–344, 351, 359, 373, 479, 487, 494
   config.py262119%12–17, 19–21, 23–26, 28–30, 32–35, 37
tests
   conftest.py240100% 
   test_barcode_auto_generate.py51394%23–25
   test_handling_unit.py46723849%18–19, 115, 181–183, 185–187, 201, 212–219, 221–222, 224–227, 240, 248–249, 252–256, 259–261, 267–268, 274–278, 294, 298, 308, 311–313, 315–316, 319–320, 323–331, 334–335, 337, 339–341, 371, 378–379, 381–384, 415, 422–423, 425–428, 467, 473–475, 478–485, 509, 511–513, 516, 525–526, 537–540, 543, 546, 549–553, 555–559, 562–564, 567–573, 575–578, 593–594, 603–605, 608–611, 613–615, 618–628, 630–634, 636–639, 645, 648–649, 652–661, 668–671, 680–682, 684–685, 687–689, 697, 704, 706–712, 714, 724–727, 736–739, 741–743, 751, 758–760, 762, 826–828, 831, 837–840, 911, 914, 916, 953, 964–965, 967–968, 971–974, 977, 982–985
   test_hooks_override.py39197%41
   test_inventory_dimension.py1941393%72, 74, 82, 125, 162, 305, 308–309, 365, 367, 369, 372–373
   test_item_barcode_print_format.py140100% 
   test_printing.py400100% 
   test_scan.py240100% 
   test_serial_number.py540100% 
www
   __init__.py00100% 
TOTAL196288255% 

@robproject robproject linked an issue Apr 18, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve handling unit PK when it is moved in its entirety

1 participant