fix: Make pick list submittable and add few fields

- Add material request & item fields
- Add pick_list field to Stock Entry
- Add purpose field to pick list
This commit is contained in:
Suraj Shetty 2019-08-22 16:41:14 +05:30
parent 8d55f81baa
commit 687b1a5b1f
4 changed files with 111 additions and 10 deletions

View File

@ -5,6 +5,7 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"purpose",
"items_based_on", "items_based_on",
"customer", "customer",
"work_order", "work_order",
@ -15,7 +16,8 @@
"section_break_4", "section_break_4",
"items", "items",
"section_break_6", "section_break_6",
"locations" "locations",
"amended_from"
], ],
"fields": [ "fields": [
{ {
@ -87,16 +89,36 @@
"description": "Qty of raw materials will be decided based on the qty of the Finished Goods Item", "description": "Qty of raw materials will be decided based on the qty of the Finished Goods Item",
"fieldname": "for_qty", "fieldname": "for_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Qty of Finished Goods Item" "label": "Qty of Finished Goods Item",
"read_only": 1
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Pick List",
"print_hide": 1,
"read_only": 1
},
{
"default": "Material Transfer for manufacturing",
"fieldname": "purpose",
"fieldtype": "Select",
"label": "Purpose",
"options": "Material Transfer for manufacturing\nMaterial Issue\nMaterial Transfer\nDelivery against Sales Order"
} }
], ],
"modified": "2019-08-22 09:50:01.099449", "is_submittable": 1,
"modified": "2019-08-22 13:36:18.912659",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Pick List", "name": "Pick List",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 1,
"cancel": 1,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
@ -104,8 +126,54 @@
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager", "role": "Stock Manager",
"share": 1, "share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Stock User",
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Manufacturing Manager",
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Manufacturing User",
"share": 1,
"submit": 1,
"write": 1 "write": 1
} }
], ],

View File

@ -237,6 +237,7 @@ def create_stock_entry(pick_list):
work_order = frappe.get_doc("Work Order", pick_list.get('work_order')) work_order = frappe.get_doc("Work Order", pick_list.get('work_order'))
stock_entry = frappe.new_doc('Stock Entry') stock_entry = frappe.new_doc('Stock Entry')
stock_entry.pick_list = pick_list.get('name')
stock_entry.purpose = 'Material Transfer For Manufacture' stock_entry.purpose = 'Material Transfer For Manufacture'
stock_entry.set_stock_entry_type() stock_entry.set_stock_entry_type()
stock_entry.work_order = work_order.name stock_entry.work_order = work_order.name
@ -264,12 +265,17 @@ def create_stock_entry(pick_list):
item.s_warehouse = location.warehouse item.s_warehouse = location.warehouse
item.t_warehouse = wip_warehouse item.t_warehouse = wip_warehouse
item.qty = location.qty item.qty = location.qty
item.transfer_qty = location.stock_qty
item.uom = location.uom item.uom = location.uom
item.conversion_factor = location.conversion_factor item.conversion_factor = location.conversion_factor
item.stock_uom = location.stock_uom item.stock_uom = location.stock_uom
stock_entry.append('items', item) stock_entry.append('items', item)
stock_entry.set_incoming_rate()
stock_entry.set_actual_qty()
stock_entry.calculate_rate_and_amount(update_finished_item_rate=False)
return stock_entry.as_dict() return stock_entry.as_dict()
@frappe.whitelist() @frappe.whitelist()
@ -281,7 +287,7 @@ def get_pending_work_orders(doctype, txt, searchfield, start, page_length, filte
`tabWork Order` `tabWork Order`
WHERE WHERE
`status` not in ('Completed', 'Stopped') `status` not in ('Completed', 'Stopped')
AND `qty` > `produced_qty` AND `qty` > `material_transferred_for_manufacturing`
AND `docstatus` = 1 AND `docstatus` = 1
AND `company` = %(company)s AND `company` = %(company)s
AND `name` like %(txt)s AND `name` like %(txt)s
@ -296,3 +302,6 @@ def get_pending_work_orders(doctype, txt, searchfield, start, page_length, filte
'page_length': frappe.utils.cint(page_length), 'page_length': frappe.utils.cint(page_length),
'company': filters.get('company') 'company': filters.get('company')
}, as_dict=as_dict) }, as_dict=as_dict)
def get_item_details(item_code):
pass

View File

@ -14,7 +14,9 @@
"conversion_factor", "conversion_factor",
"reference_section", "reference_section",
"sales_order", "sales_order",
"sales_order_item" "sales_order_item",
"material_request",
"material_request_item"
], ],
"fields": [ "fields": [
{ {
@ -65,21 +67,34 @@
"fieldname": "sales_order", "fieldname": "sales_order",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Sales Order", "label": "Sales Order",
"options": "Sales Order" "options": "Sales Order",
"read_only": 1
}, },
{ {
"fieldname": "sales_order_item", "fieldname": "sales_order_item",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Sales Order Item" "label": "Sales Order Item",
"read_only": 1
}, },
{ {
"fieldname": "conversion_factor", "fieldname": "conversion_factor",
"fieldtype": "Float", "fieldtype": "Float",
"label": "UOM Conversion Factor" "label": "UOM Conversion Factor"
},
{
"fieldname": "material_request",
"fieldtype": "Link",
"label": "Material Request",
"options": "Material Request"
},
{
"fieldname": "material_request_item",
"fieldtype": "Data",
"label": "Material Request Item"
} }
], ],
"istable": 1, "istable": 1,
"modified": "2019-08-14 18:38:28.867113", "modified": "2019-08-22 14:19:19.725540",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Pick List Reference Item", "name": "Pick List Reference Item",

View File

@ -17,6 +17,7 @@
"purchase_order", "purchase_order",
"delivery_note_no", "delivery_note_no",
"sales_invoice_no", "sales_invoice_no",
"pick_list",
"purchase_receipt_no", "purchase_receipt_no",
"col2", "col2",
"posting_date", "posting_date",
@ -613,12 +614,20 @@
{ {
"fieldname": "dimension_col_break", "fieldname": "dimension_col_break",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "pick_list",
"fieldtype": "Link",
"hidden": 1,
"label": "Pick List",
"options": "Pick List",
"read_only": 1
} }
], ],
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-07-14 17:41:39.257508", "modified": "2019-08-22 13:09:55.344036",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Stock Entry", "name": "Stock Entry",