mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
fix: set auto reserve stock flag before packing list generation
enable_auto_reserve_stock ran at the end of validate, after make_packing_list. On a new Sales Order saved with auto_reserve_stock enabled, packed item rows were built while the parent reserve_stock flag was still unset, so they never inherited it. Since the stamping in packed_item.py is gated on doc.is_new(), later saves could not repair the rows either; only the client-side toggle could. Move the auto-enable before packing list generation so packed rows are stamped on first save.
This commit is contained in:
@@ -238,6 +238,9 @@ class SalesOrder(SellingController):
|
||||
|
||||
validate_coupon_code(self.coupon_code)
|
||||
|
||||
if not self.get("is_subcontracted"):
|
||||
SalesOrderStockReservation(self).enable_auto_reserve_stock()
|
||||
|
||||
make_packing_list(self)
|
||||
|
||||
self.validate_with_previous_doc()
|
||||
@@ -247,8 +250,6 @@ class SalesOrder(SellingController):
|
||||
StatusService(self).set_default_statuses()
|
||||
|
||||
self.reset_default_field_value("set_warehouse", "items", "warehouse")
|
||||
if not self.get("is_subcontracted"):
|
||||
SalesOrderStockReservation(self).enable_auto_reserve_stock()
|
||||
|
||||
def set_has_unit_price_items(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user