[Fix] Project not set in the stock ledger entry (#13357)
This commit is contained in:
parent
e010ddf65f
commit
93779c21a7
@ -252,7 +252,7 @@ class StockController(AccountsController):
|
||||
"company": self.company,
|
||||
"batch_no": cstr(d.get("batch_no")).strip(),
|
||||
"serial_no": d.get("serial_no"),
|
||||
"project": d.get("project"),
|
||||
"project": d.get("project") or self.get('project'),
|
||||
"is_cancelled": self.docstatus==2 and "Yes" or "No"
|
||||
})
|
||||
|
||||
|
@ -497,3 +497,4 @@ erpnext.patches.v10_0.update_warehouse_address_details
|
||||
erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
|
||||
erpnext.patches.v10_0.update_hub_connector_domain
|
||||
erpnext.patches.v10_0.set_student_party_type
|
||||
erpnext.patches.v10_0.update_project_in_sle
|
15
erpnext/patches/v10_0/update_project_in_sle.py
Normal file
15
erpnext/patches/v10_0/update_project_in_sle.py
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for doctype in ['Sales Invoice', 'Delivery Note', 'Stock Entry']:
|
||||
frappe.db.sql(""" update
|
||||
`tabStock Ledger Entry` sle, `tab{0}` parent_doc
|
||||
set
|
||||
sle.project = parent_doc.project
|
||||
where
|
||||
sle.voucher_no = parent_doc.name and sle.voucher_type = %s and sle.project is null
|
||||
and parent_doc.project is not null and parent_doc.project != ''""".format(doctype), doctype, debug=1)
|
@ -59,6 +59,12 @@ frappe.query_reports["Stock Ledger"] = {
|
||||
"fieldname":"voucher_no",
|
||||
"label": __("Voucher #"),
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname":"project",
|
||||
"label": __("Project"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Project"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ def execute(filters=None):
|
||||
item_detail.stock_uom, sle.actual_qty, sle.qty_after_transaction,
|
||||
(sle.incoming_rate if sle.actual_qty > 0 else 0.0),
|
||||
sle.valuation_rate, sle.stock_value, sle.voucher_type, sle.voucher_no,
|
||||
sle.batch_no, sle.serial_no, sle.company])
|
||||
sle.batch_no, sle.serial_no, sle.project, sle.company])
|
||||
|
||||
return columns, data
|
||||
|
||||
@ -45,6 +45,7 @@ def get_columns():
|
||||
_("Voucher #") + ":Dynamic Link/" + _("Voucher Type") + ":100",
|
||||
_("Batch") + ":Link/Batch:100",
|
||||
_("Serial #") + ":Link/Serial No:100",
|
||||
_("Project") + ":Link/Project:100",
|
||||
{"label": _("Company"), "fieldtype": "Link", "width": 110,
|
||||
"options": "company", "fieldname": "company"}
|
||||
]
|
||||
@ -54,7 +55,7 @@ def get_columns():
|
||||
def get_stock_ledger_entries(filters):
|
||||
return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
|
||||
item_code, warehouse, actual_qty, qty_after_transaction, incoming_rate, valuation_rate,
|
||||
stock_value, voucher_type, voucher_no, batch_no, serial_no, company
|
||||
stock_value, voucher_type, voucher_no, batch_no, serial_no, company, project
|
||||
from `tabStock Ledger Entry` sle
|
||||
where company = %(company)s and
|
||||
posting_date between %(from_date)s and %(to_date)s
|
||||
@ -96,6 +97,8 @@ def get_sle_conditions(filters):
|
||||
conditions.append("voucher_no=%(voucher_no)s")
|
||||
if filters.get("batch_no"):
|
||||
conditions.append("batch_no=%(batch_no)s")
|
||||
if filters.get("project"):
|
||||
conditions.append("project=%(project)s")
|
||||
|
||||
return "and {}".format(" and ".join(conditions)) if conditions else ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user