feat: available qty at company in sales transactions (backport #44260) (#44325)

* feat: available qty at company in sales transactions

(cherry picked from commit d8b9aef14f)

# Conflicts:
#	erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
#	erpnext/selling/doctype/quotation_item/quotation_item.json
#	erpnext/selling/doctype/sales_order_item/sales_order_item.json
#	erpnext/stock/doctype/delivery_note_item/delivery_note_item.json

* chore: fix conflicts

* chore: fix conflicts

* chore: fix conflicts

* chore: fix conflicts

---------

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-11-25 20:29:13 +05:30
committed by GitHub
parent d77a880a62
commit 20d0e95d7c
9 changed files with 115 additions and 19 deletions

View File

@@ -89,11 +89,14 @@
"incoming_rate", "incoming_rate",
"item_tax_rate", "item_tax_rate",
"actual_batch_qty", "actual_batch_qty",
"actual_qty",
"section_break_eoec", "section_break_eoec",
"serial_no", "serial_no",
"column_break_ytgd", "column_break_ytgd",
"batch_no", "batch_no",
"available_quantity_section",
"actual_qty",
"column_break_ogff",
"company_total_stock",
"edit_references", "edit_references",
"sales_order", "sales_order",
"so_detail", "so_detail",
@@ -675,7 +678,8 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "actual_qty", "fieldname": "actual_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Available Qty at Warehouse", "label": "Qty (Warehouse)",
"no_copy": 1,
"oldfieldname": "actual_qty", "oldfieldname": "actual_qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"print_hide": 1, "print_hide": 1,
@@ -923,12 +927,30 @@
{ {
"fieldname": "column_break_ytgd", "fieldname": "column_break_ytgd",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "available_quantity_section",
"fieldtype": "Section Break",
"label": "Available Quantity"
},
{
"fieldname": "column_break_ogff",
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "company_total_stock",
"fieldtype": "Float",
"label": "Qty (Company)",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2024-10-28 15:06:40.980995", "modified": "2024-11-25 16:27:33.287341",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Item", "name": "Sales Invoice Item",

View File

@@ -28,6 +28,7 @@ class SalesInvoiceItem(Document):
base_rate_with_margin: DF.Currency base_rate_with_margin: DF.Currency
batch_no: DF.Link | None batch_no: DF.Link | None
brand: DF.Data | None brand: DF.Data | None
company_total_stock: DF.Float
conversion_factor: DF.Float conversion_factor: DF.Float
cost_center: DF.Link cost_center: DF.Link
customer_item_code: DF.Data | None customer_item_code: DF.Data | None

View File

@@ -21,9 +21,15 @@ class SellingController(StockController):
def onload(self): def onload(self):
super().onload() super().onload()
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"): if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice", "Quotation"):
for item in self.get("items") + (self.get("packed_items") or []): for item in self.get("items") + (self.get("packed_items") or []):
item.update(get_bin_details(item.item_code, item.warehouse, include_child_warehouses=True)) company = self.company
item.update(
get_bin_details(
item.item_code, item.warehouse, company=company, include_child_warehouses=True
)
)
def validate(self): def validate(self):
super().validate() super().validate()

View File

@@ -24,6 +24,10 @@
"uom", "uom",
"conversion_factor", "conversion_factor",
"stock_qty", "stock_qty",
"available_quantity_section",
"actual_qty",
"column_break_ylrv",
"company_total_stock",
"section_break_16", "section_break_16",
"price_list_rate", "price_list_rate",
"base_price_list_rate", "base_price_list_rate",
@@ -70,7 +74,6 @@
"prevdoc_docname", "prevdoc_docname",
"item_balance", "item_balance",
"projected_qty", "projected_qty",
"actual_qty",
"col_break4", "col_break4",
"stock_balance", "stock_balance",
"item_tax_rate", "item_tax_rate",
@@ -460,9 +463,10 @@
"report_hide": 1 "report_hide": 1
}, },
{ {
"allow_on_submit": 1,
"fieldname": "actual_qty", "fieldname": "actual_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Actual Qty", "label": "Qty (Warehouse)",
"no_copy": 1, "no_copy": 1,
"print_hide": 1, "print_hide": 1,
"read_only": 1, "read_only": 1,
@@ -662,12 +666,31 @@
"label": "Has Alternative Item", "label": "Has Alternative Item",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
},
{
"fieldname": "available_quantity_section",
"fieldtype": "Section Break",
"label": "Available Quantity"
},
{
"fieldname": "column_break_ylrv",
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "company_total_stock",
"fieldtype": "Float",
"label": "Qty (Company)",
"no_copy": 1,
"print_hide": 1,
"read_only": 1,
"report_hide": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2023-11-14 18:24:24.619832", "modified": "2024-11-24 15:18:43.952844",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation Item", "name": "Quotation Item",
@@ -677,4 +700,4 @@
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"track_changes": 1 "track_changes": 1
} }

View File

@@ -27,6 +27,7 @@ class QuotationItem(Document):
blanket_order: DF.Link | None blanket_order: DF.Link | None
blanket_order_rate: DF.Currency blanket_order_rate: DF.Currency
brand: DF.Link | None brand: DF.Link | None
company_total_stock: DF.Float
conversion_factor: DF.Float conversion_factor: DF.Float
customer_item_code: DF.Data | None customer_item_code: DF.Data | None
description: DF.TextEditor | None description: DF.TextEditor | None

View File

@@ -78,11 +78,14 @@
"against_blanket_order", "against_blanket_order",
"blanket_order", "blanket_order",
"blanket_order_rate", "blanket_order_rate",
"available_quantity_section",
"actual_qty",
"column_break_jpky",
"company_total_stock",
"manufacturing_section_section", "manufacturing_section_section",
"bom_no", "bom_no",
"planning_section", "planning_section",
"projected_qty", "projected_qty",
"actual_qty",
"ordered_qty", "ordered_qty",
"planned_qty", "planned_qty",
"production_plan_qty", "production_plan_qty",
@@ -636,7 +639,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "actual_qty", "fieldname": "actual_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Actual Qty", "label": "Qty (Warehouse)",
"no_copy": 1, "no_copy": 1,
"print_hide": 1, "print_hide": 1,
"print_width": "70px", "print_width": "70px",
@@ -905,12 +908,30 @@
"label": "Is Stock Item", "label": "Is Stock Item",
"print_hide": 1, "print_hide": 1,
"report_hide": 1 "report_hide": 1
},
{
"allow_on_submit": 1,
"fieldname": "company_total_stock",
"fieldtype": "Float",
"label": "Qty (Company)",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "column_break_jpky",
"fieldtype": "Column Break"
},
{
"fieldname": "available_quantity_section",
"fieldtype": "Section Break",
"label": "Available Quantity"
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2024-03-21 18:15:56.625005", "modified": "2024-11-21 14:21:29.743474",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order Item", "name": "Sales Order Item",
@@ -921,4 +942,4 @@
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"track_changes": 1 "track_changes": 1
} }

View File

@@ -30,6 +30,7 @@ class SalesOrderItem(Document):
blanket_order_rate: DF.Currency blanket_order_rate: DF.Currency
bom_no: DF.Link | None bom_no: DF.Link | None
brand: DF.Link | None brand: DF.Link | None
company_total_stock: DF.Float
conversion_factor: DF.Float conversion_factor: DF.Float
customer_item_code: DF.Data | None customer_item_code: DF.Data | None
delivered_by_supplier: DF.Check delivered_by_supplier: DF.Check

View File

@@ -87,16 +87,19 @@
"column_break_rxvc", "column_break_rxvc",
"batch_no", "batch_no",
"available_qty_section", "available_qty_section",
"actual_batch_qty",
"actual_qty", "actual_qty",
"installed_qty", "actual_batch_qty",
"item_tax_rate",
"column_break_atna", "column_break_atna",
"company_total_stock",
"section_break_kejd",
"installed_qty",
"packed_qty", "packed_qty",
"column_break_fguf",
"received_qty", "received_qty",
"accounting_details_section", "accounting_details_section",
"expense_account", "expense_account",
"column_break_71", "column_break_71",
"item_tax_rate",
"internal_transfer_section", "internal_transfer_section",
"material_request", "material_request",
"purchase_order", "purchase_order",
@@ -519,7 +522,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "actual_qty", "fieldname": "actual_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Available Qty at From Warehouse", "label": "Qty (Warehouse)",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "actual_qty", "oldfieldname": "actual_qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
@@ -907,13 +910,30 @@
{ {
"fieldname": "column_break_rxvc", "fieldname": "column_break_rxvc",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "company_total_stock",
"fieldtype": "Float",
"label": "Qty (Company)",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "section_break_kejd",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_fguf",
"fieldtype": "Column Break"
} }
], ],
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2024-03-21 18:15:07.603672", "modified": "2024-11-21 17:37:37.441498",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Delivery Note Item", "name": "Delivery Note Item",
@@ -923,4 +943,4 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": []
} }

View File

@@ -30,6 +30,7 @@ class DeliveryNoteItem(Document):
batch_no: DF.Link | None batch_no: DF.Link | None
billed_amt: DF.Currency billed_amt: DF.Currency
brand: DF.Link | None brand: DF.Link | None
company_total_stock: DF.Float
conversion_factor: DF.Float conversion_factor: DF.Float
cost_center: DF.Link | None cost_center: DF.Link | None
customer_item_code: DF.Data | None customer_item_code: DF.Data | None