Skip to content

Commit

Permalink
fix: update received qty in MR on purchase invoice submit with update…
Browse files Browse the repository at this point in the history
… stock
  • Loading branch information
Nihantra-Patel committed Jun 14, 2024
1 parent 99695df commit 13cb53f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
13 changes: 13 additions & 0 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,19 @@ def update_status_updater_args(self):
where name=`tabPurchase Invoice Item`.parent and update_stock = 1)""",
}
)
self.status_updater.append(
{
"source_dt": "Purchase Invoice 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",
}
)
if cint(self.is_return):
self.status_updater.append(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"purchase_receipt",
"pr_detail",
"sales_invoice_item",
"material_request",
"material_request_item",
"item_weight_details",
"weight_per_unit",
"total_weight",
Expand Down Expand Up @@ -934,12 +936,34 @@
{
"fieldname": "column_break_vbbb",
"fieldtype": "Column Break"
},
{
"fieldname": "material_request",
"fieldtype": "Link",
"label": "Material Request",
"no_copy": 1,
"options": "Material Request",
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
{
"fieldname": "material_request_item",
"fieldtype": "Data",
"hidden": 1,
"label": "Material Request Item",
"no_copy": 1,
"oldfieldname": "pr_detail",
"oldfieldtype": "Data",
"print_hide": 1,
"read_only": 1,
"search_index": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2024-03-27 13:10:24.204495",
"modified": "2024-06-14 11:57:07.171700",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class PurchaseInvoiceItem(Document):
manufacturer_part_no: DF.Data | None
margin_rate_or_amount: DF.Float
margin_type: DF.Literal["", "Percentage", "Amount"]
material_request: DF.Link | None
material_request_item: DF.Data | None
net_amount: DF.Currency
net_rate: DF.Currency
page_break: DF.Check
Expand Down
2 changes: 2 additions & 0 deletions erpnext/buying/doctype/purchase_order/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,8 @@ def update_item(obj, target, source_parent):
"field_map": {
"name": "po_detail",
"parent": "purchase_order",
"material_request": "material_request",
"material_request_item": "material_request_item",
"wip_composite_asset": "wip_composite_asset",
},
"postprocess": update_item,
Expand Down

0 comments on commit 13cb53f

Please sign in to comment.