fix: pass planned start date to created work order (#27031)

* fix: pass planned start date to created workorder

* test: production plan to work order start date

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
Alan 2021-08-19 18:49:20 +05:30 committed by GitHub
parent c60d5523bc
commit 9225f02599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -346,6 +346,7 @@ class ProductionPlan(Document):
"production_plan" : self.name,
"production_plan_item" : d.name,
"product_bundle_item" : d.product_bundle_item,
"planned_start_date" : d.planned_start_date,
"make_work_order_for_sub_assembly_items": d.get("make_work_order_for_sub_assembly_items", 0)
}

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import nowdate, now_datetime, flt
from frappe.utils import nowdate, now_datetime, flt, add_to_date
from erpnext.stock.doctype.item.test_item import create_item
from erpnext.manufacturing.doctype.production_plan.production_plan import get_sales_orders
from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
@ -61,6 +61,21 @@ class TestProductionPlan(unittest.TestCase):
pln = frappe.get_doc('Production Plan', pln.name)
pln.cancel()
def test_production_plan_start_date(self):
planned_date = add_to_date(date=None, days=3)
plan = create_production_plan(item_code='Test Production Item 1', planned_start_date=planned_date)
plan.make_work_order()
work_orders = frappe.get_all('Work Order', fields = ['name', 'planned_start_date'],
filters = {'production_plan': plan.name})
self.assertEqual(work_orders[0].planned_start_date, planned_date)
for wo in work_orders:
frappe.delete_doc('Work Order', wo.name)
frappe.get_doc('Production Plan', plan.name).cancel()
def test_production_plan_for_existing_ordered_qty(self):
sr1 = create_stock_reconciliation(item_code="Raw Material Item 1",
target="_Test Warehouse - _TC", qty=1, rate=110)