fix: Added Item Reference field to link tables and update work_order_qty
This commit is contained in:
parent
82905166d9
commit
b7ca913904
@ -201,6 +201,7 @@ class ProductionPlan(Document):
|
||||
pi.sales_order = data.parent
|
||||
pi.sales_order_item = data.name
|
||||
pi.description = data.description
|
||||
pi.item_reference = data.name
|
||||
|
||||
|
||||
elif self.get_items_from == "Material Request":
|
||||
|
@ -27,7 +27,8 @@
|
||||
"column_break_19",
|
||||
"material_request",
|
||||
"material_request_item",
|
||||
"product_bundle_item"
|
||||
"product_bundle_item",
|
||||
"item_reference"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -206,12 +207,18 @@
|
||||
"options": "Item",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item_reference",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Item Reference"
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-04-22 12:10:01.102440",
|
||||
"modified": "2021-04-28 19:14:57.772123",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan Item",
|
||||
|
@ -382,8 +382,10 @@ class WorkOrder(Document):
|
||||
|
||||
prod_plan = frappe.get_doc('Production Plan', self.production_plan)
|
||||
pp_ref = prod_plan.prod_plan_ref
|
||||
pp_item = frappe.get_doc('Production Plan Item', self.production_plan_item)
|
||||
item_ref = pp_item.item_reference
|
||||
for p in pp_ref:
|
||||
if p.item_ref == self.production_plan_item:
|
||||
if p.item_ref == item_ref:
|
||||
work_order_qty = int(p.qty) if not cancel else 0
|
||||
frappe.db.set_value('Sales Order Item',
|
||||
p.sales_order_item, 'work_order_qty', flt(work_order_qty/total_bundle_qty, 2))
|
||||
|
Loading…
x
Reference in New Issue
Block a user