fix: Rename Pick TIcket -> Pick List

This commit is contained in:
Suraj Shetty 2019-08-01 12:05:20 +05:30
parent fa9111ebe2
commit fbcc56536b
15 changed files with 118 additions and 118 deletions

View File

@ -110,7 +110,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
let allow_delivery = false; let allow_delivery = false;
if (doc.docstatus==1) { if (doc.docstatus==1) {
this.frm.add_custom_button(__('Pick Ticket'), () => this.make_pick_ticket(), __('Create')); this.frm.add_custom_button(__('Pick List'), () => this.make_pick_ticket(), __('Create'));
if(this.frm.has_perm("submit")) { if(this.frm.has_perm("submit")) {
if(doc.status === 'On Hold') { if(doc.status === 'On Hold') {

View File

@ -1001,13 +1001,13 @@ def make_inter_company_purchase_order(source_name, target_doc=None):
def make_pick_ticket(source_name, target_doc=None): def make_pick_ticket(source_name, target_doc=None):
doc = get_mapped_doc("Sales Order", source_name, { doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": { "Sales Order": {
"doctype": "Pick Ticket", "doctype": "Pick List",
"validation": { "validation": {
"docstatus": ["=", 1] "docstatus": ["=", 1]
} }
}, },
"Sales Order Item": { "Sales Order Item": {
"doctype": "Pick Ticket Reference Item", "doctype": "Pick List Reference Item",
"field_map": { "field_map": {
"item_code": "item", "item_code": "item",
"parenttype": "reference_doctype", "parenttype": "reference_doctype",

View File

@ -1,7 +1,7 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Pick Ticket', { frappe.ui.form.on('Pick List', {
setup: (frm) => { setup: (frm) => {
frm.set_query('parent_warehouse', () => { frm.set_query('parent_warehouse', () => {
return { return {
@ -16,7 +16,7 @@ frappe.ui.form.on('Pick Ticket', {
frm.add_custom_button(__('Delivery Note'), () => frm.trigger('make_delivery_note'), __('Create')); frm.add_custom_button(__('Delivery Note'), () => frm.trigger('make_delivery_note'), __('Create'));
frm.add_custom_button(__('Sales Order'), function() { frm.add_custom_button(__('Sales Order'), function() {
erpnext.utils.map_current_doc({ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_pick_ticket", method: "erpnext.selling.doctype.sales_order.sales_order.make_pick_list",
source_doctype: "Sales Order", source_doctype: "Sales Order",
target: frm, target: frm,
setters: { setters: {
@ -36,7 +36,7 @@ frappe.ui.form.on('Pick Ticket', {
}, },
make_delivery_note(frm) { make_delivery_note(frm) {
frappe.model.open_mapped_doc({ frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.pick_ticket.pick_ticket.make_delivery_note", method: "erpnext.stock.doctype.pick_list.pick_list.make_delivery_note",
frm: frm frm: frm
}); });
}, },

View File

@ -43,19 +43,19 @@
"fieldname": "item_locations", "fieldname": "item_locations",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Item Locations", "label": "Item Locations",
"options": "Pick Ticket Item" "options": "Pick List Item"
}, },
{ {
"fieldname": "reference_items", "fieldname": "reference_items",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Items To Be Picked", "label": "Items To Be Picked",
"options": "Pick Ticket Reference Item" "options": "Pick List Reference Item"
} }
], ],
"modified": "2019-08-01 10:50:17.055509", "modified": "2019-08-01 10:50:17.055509",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Pick Ticket", "name": "Pick List",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {

View File

@ -7,7 +7,7 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc from frappe.model.mapper import get_mapped_doc
class PickTicket(Document): class PickList(Document):
def set_item_locations(self): def set_item_locations(self):
reference_items = self.reference_items reference_items = self.reference_items
@ -131,14 +131,14 @@ def set_batch_no(item_doc, parent_doc):
@frappe.whitelist() @frappe.whitelist()
def make_delivery_note(source_name, target_doc=None): def make_delivery_note(source_name, target_doc=None):
target_doc = get_mapped_doc("Pick Ticket", source_name, { target_doc = get_mapped_doc("Pick List", source_name, {
"Pick Ticket": { "Pick List": {
"doctype": "Delivery Note", "doctype": "Delivery Note",
# "validation": { # "validation": {
# "docstatus": ["=", 1] # "docstatus": ["=", 1]
# } # }
}, },
"Pick Ticket Item": { "Pick List Item": {
"doctype": "Delivery Note Item", "doctype": "Delivery Note Item",
"field_map": { "field_map": {
"item": "item_code", "item": "item_code",

View File

@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
from erpnext.selling.doctype.sales_order.sales_order import make_pick_list
class TestPickList(unittest.TestCase):
def test_pick_list_picks_warehouse_for_each_item(self):
pick_list = frappe.get_doc({
'doctype': 'Pick List',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Item Home Desktop 100',
'reference_doctype': 'Sales Order',
'qty': 5,
'reference_name': '_T-Sales Order-1',
}],
})
pick_list.set_item_locations()
self.assertEqual(pick_list.items_locations[0].item, '_Test Item Home Desktop 100')
self.assertEqual(pick_list.items_locations[0].warehouse, '_Test Warehouse - _TC')
self.assertEqual(pick_list.items_locations[0].qty, 5)
def test_pick_list_skips_out_of_stock_item(self):
pick_list = frappe.get_doc({
'doctype': 'Pick List',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Item Warehouse Group Wise Reorder',
'reference_doctype': 'Sales Order',
'qty': 1000,
'reference_name': '_T-Sales Order-1',
}],
})
pick_list.set_item_locations()
self.assertEqual(pick_list.items_locations[0].item, '_Test Item Warehouse Group Wise Reorder')
self.assertEqual(pick_list.items_locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
self.assertEqual(pick_list.items_locations[0].qty, 30)
def test_pick_list_skips_items_in_expired_batch(self):
pass
def test_pick_list_shows_serial_no_for_serialized_item(self):
stock_reconciliation = frappe.get_doc({
'doctype': 'Stock Reconciliation',
'company': '_Test Company',
'items': [{
'item_code': '_Test Serialized Item',
'warehouse': '_Test Warehouse - _TC',
'qty': 5,
'serial_no': '123450\n123451\n123452\n123453\n123454'
}]
})
stock_reconciliation.submit()
pick_list = frappe.get_doc({
'doctype': 'Pick List',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Serialized Item',
'reference_doctype': 'Sales Order',
'qty': 1000,
'reference_name': '_T-Sales Order-1',
}],
})
pick_list.set_item_locations()
self.assertEqual(pick_list.items_locations[0].item, '_Test Serialized Item')
self.assertEqual(pick_list.items_locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
self.assertEqual(pick_list.items_locations[0].qty, 30)
self.assertEqual(pick_list.items_locations[0].serial_no, 30)
def test_pick_list_for_multiple_reference_doctypes(self):
pass
## records required
'''
batch no
items
sales invoice
stock entries
bin
stock ledger entry
warehouses
'''

View File

@ -132,7 +132,7 @@
"modified": "2019-07-30 23:47:53.566473", "modified": "2019-07-30 23:47:53.566473",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Pick Ticket Item", "name": "Pick List Item",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"quick_entry": 1, "quick_entry": 1,

View File

@ -6,5 +6,5 @@ from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PickTicketItem(Document): class PickListItem(Document):
pass pass

View File

@ -1,7 +1,7 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Pick Ticket Reference Item', { frappe.ui.form.on('Pick List Reference Item', {
// refresh: function(frm) { // refresh: function(frm) {
// } // }

View File

@ -46,7 +46,7 @@
"modified": "2019-07-30 23:43:30.901151", "modified": "2019-07-30 23:43:30.901151",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Pick Ticket Reference Item", "name": "Pick List Reference Item",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"sort_field": "modified", "sort_field": "modified",

View File

@ -6,5 +6,5 @@ from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class PickTicketReferenceItem(Document): class PickListReferenceItem(Document):
pass pass

View File

@ -1,100 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
from erpnext.selling.doctype.sales_order.sales_order import make_pick_ticket
class TestPickTicket(unittest.TestCase):
def test_pick_ticket_picks_warehouse_for_each_item(self):
pick_ticket = frappe.get_doc({
'doctype': 'Pick Ticket',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Item Home Desktop 100',
'reference_doctype': 'Sales Order',
'qty': 5,
'reference_name': '_T-Sales Order-1',
}],
})
pick_ticket.set_item_locations()
self.assertEqual(pick_ticket.items_locations[0].item, '_Test Item Home Desktop 100')
self.assertEqual(pick_ticket.items_locations[0].warehouse, '_Test Warehouse - _TC')
self.assertEqual(pick_ticket.items_locations[0].qty, 5)
def test_pick_ticket_skips_out_of_stock_item(self):
pick_ticket = frappe.get_doc({
'doctype': 'Pick Ticket',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Item Warehouse Group Wise Reorder',
'reference_doctype': 'Sales Order',
'qty': 1000,
'reference_name': '_T-Sales Order-1',
}],
})
pick_ticket.set_item_locations()
self.assertEqual(pick_ticket.items_locations[0].item, '_Test Item Warehouse Group Wise Reorder')
self.assertEqual(pick_ticket.items_locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
self.assertEqual(pick_ticket.items_locations[0].qty, 30)
def test_pick_ticket_skips_items_in_expired_batch(self):
pass
def test_pick_ticket_shows_serial_no_for_serialized_item(self):
stock_reconciliation = frappe.get_doc({
'doctype': 'Stock Reconciliation',
'company': '_Test Company',
'items': [{
'item_code': '_Test Serialized Item',
'warehouse': '_Test Warehouse - _TC',
'qty': 5,
'serial_no': '123450\n123451\n123452\n123453\n123454'
}]
})
stock_reconciliation.submit()
pick_ticket = frappe.get_doc({
'doctype': 'Pick Ticket',
'company': '_Test Company',
'reference_items': [{
'item': '_Test Serialized Item',
'reference_doctype': 'Sales Order',
'qty': 1000,
'reference_name': '_T-Sales Order-1',
}],
})
pick_ticket.set_item_locations()
self.assertEqual(pick_ticket.items_locations[0].item, '_Test Serialized Item')
self.assertEqual(pick_ticket.items_locations[0].warehouse, '_Test Warehouse Group-C1 - _TC')
self.assertEqual(pick_ticket.items_locations[0].qty, 30)
self.assertEqual(pick_ticket.items_locations[0].serial_no, 30)
def test_pick_ticket_for_multiple_reference_doctypes(self):
pass
## records required
'''
batch no
items
sales invoice
stock entries
bin
stock ledger entry
warehouses
'''