feat: available qty at company in sales transactions

This commit is contained in:
Rohit Waghchaure
2024-11-21 15:45:32 +05:30
parent cc571aca8f
commit d8b9aef14f
9 changed files with 112 additions and 16 deletions

View File

@@ -90,11 +90,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",
@@ -676,7 +679,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,
@@ -930,12 +934,30 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Distributed Discount Amount", "label": "Distributed Discount Amount",
"options": "currency" "options": "currency"
},
{
"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

@@ -34,6 +34,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",
@@ -71,7 +75,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",
@@ -461,9 +464,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,
@@ -669,12 +673,31 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Distributed Discount Amount", "label": "Distributed Discount Amount",
"options": "currency" "options": "currency"
},
{
"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": "2024-06-02 06:21:09.508680", "modified": "2024-11-24 14:18:43.952844",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation Item", "name": "Quotation Item",

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

@@ -79,11 +79,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",
@@ -637,7 +640,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",
@@ -912,12 +915,30 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Distributed Discount Amount", "label": "Distributed Discount Amount",
"options": "currency" "options": "currency"
},
{
"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-06-02 06:13:40.597947", "modified": "2024-11-21 13:21:29.743474",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order Item", "name": "Sales Order Item",

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

@@ -88,16 +88,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",
@@ -520,7 +523,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",
@@ -914,13 +917,30 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Distributed Discount Amount", "label": "Distributed Discount Amount",
"options": "currency" "options": "currency"
},
{
"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-06-02 06:18:38.491763", "modified": "2024-11-21 16:37:37.441498",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Delivery Note Item", "name": "Delivery Note Item",

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