mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
fix: Update Received Qty in Material Request as per Stock UOM (#21055)
* fix: Update Received Qty in Material Request as per Stock UOM * fix: Process each PR only once * fix: minor suggested changes Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -651,3 +651,4 @@ erpnext.patches.v12_0.add_export_type_field_in_party_master
|
|||||||
erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22
|
erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22
|
||||||
erpnext.patches.v12_0.create_irs_1099_field_united_states
|
erpnext.patches.v12_0.create_irs_1099_field_united_states
|
||||||
erpnext.patches.v12_0.set_permission_einvoicing
|
erpnext.patches.v12_0.set_permission_einvoicing
|
||||||
|
erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
purchase_receipts = frappe.db.sql("""
|
||||||
|
SELECT
|
||||||
|
parent from `tabPurchase Receipt Item`
|
||||||
|
WHERE
|
||||||
|
material_request is not null
|
||||||
|
AND docstatus=1
|
||||||
|
""",as_dict=1)
|
||||||
|
|
||||||
|
purchase_receipts = set([d.parent for d in purchase_receipts])
|
||||||
|
|
||||||
|
for pr in purchase_receipts:
|
||||||
|
doc = frappe.get_doc("Purchase Receipt", pr)
|
||||||
|
doc.status_updater = [
|
||||||
|
{
|
||||||
|
'source_dt': 'Purchase Receipt Item',
|
||||||
|
'target_dt': 'Material Request Item',
|
||||||
|
'join_field': 'material_request_item',
|
||||||
|
'target_field': 'received_qty',
|
||||||
|
'target_parent_dt': 'Material Request',
|
||||||
|
'target_parent_field': 'per_received',
|
||||||
|
'target_ref_field': 'stock_qty',
|
||||||
|
'source_field': 'stock_qty',
|
||||||
|
'percent_join_field': 'material_request'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
doc.update_qty()
|
||||||
@@ -49,8 +49,8 @@ class PurchaseReceipt(BuyingController):
|
|||||||
'target_field': 'received_qty',
|
'target_field': 'received_qty',
|
||||||
'target_parent_dt': 'Material Request',
|
'target_parent_dt': 'Material Request',
|
||||||
'target_parent_field': 'per_received',
|
'target_parent_field': 'per_received',
|
||||||
'target_ref_field': 'qty',
|
'target_ref_field': 'stock_qty',
|
||||||
'source_field': 'qty',
|
'source_field': 'stock_qty',
|
||||||
'percent_join_field': 'material_request'
|
'percent_join_field': 'material_request'
|
||||||
}]
|
}]
|
||||||
if cint(self.is_return):
|
if cint(self.is_return):
|
||||||
@@ -349,7 +349,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
if warehouse_with_no_account:
|
if warehouse_with_no_account:
|
||||||
frappe.msgprint(_("No accounting entries for the following warehouses") + ": \n" +
|
frappe.msgprint(_("No accounting entries for the following warehouses") + ": \n" +
|
||||||
"\n".join(warehouse_with_no_account))
|
"\n".join(warehouse_with_no_account))
|
||||||
|
|
||||||
return process_gl_map(gl_entries)
|
return process_gl_map(gl_entries)
|
||||||
|
|
||||||
def get_asset_gl_entry(self, gl_entries):
|
def get_asset_gl_entry(self, gl_entries):
|
||||||
@@ -616,7 +616,7 @@ def get_item_account_wise_additional_cost(purchase_document):
|
|||||||
|
|
||||||
if not landed_cost_vouchers:
|
if not landed_cost_vouchers:
|
||||||
return
|
return
|
||||||
|
|
||||||
item_account_wise_cost = {}
|
item_account_wise_cost = {}
|
||||||
|
|
||||||
for lcv in landed_cost_vouchers:
|
for lcv in landed_cost_vouchers:
|
||||||
|
|||||||
Reference in New Issue
Block a user