[new] Create multiple warehouse address and fetch address to stock entry (#13109)
* [new] Create multiple warehouse address and fetch address to stock entry * [fix] Deleted unwanted field and added patch to link warehouse details to Address * [fix] Codacy fixed * [fix] Modified patch for warehouse address * [fix] Modified patch for warehouse address * [fix] Patch updated and removed contact details from stock entry * [fix] Patch Updated
This commit is contained in:
parent
a6a4e86dc8
commit
35b665cb26
@ -492,3 +492,4 @@ erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13
|
|||||||
erpnext.patches.v10_0.set_b2c_limit
|
erpnext.patches.v10_0.set_b2c_limit
|
||||||
erpnext.patches.v10_0.set_auto_created_serial_no_in_stock_entry
|
erpnext.patches.v10_0.set_auto_created_serial_no_in_stock_entry
|
||||||
erpnext.patches.v10_0.update_territory_and_customer_group
|
erpnext.patches.v10_0.update_territory_and_customer_group
|
||||||
|
erpnext.patches.v10_0.update_warehouse_address_details
|
37
erpnext/patches/v10_0/update_warehouse_address_details.py
Normal file
37
erpnext/patches/v10_0/update_warehouse_address_details.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Copyright (c) 2017, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
warehouse = frappe.db.sql("""select name, email_id, phone_no, mobile_no, address_line_1,
|
||||||
|
address_line_2, city, state, pin from `tabWarehouse` where ifnull(address_line_1, '') != ''
|
||||||
|
or ifnull(mobile_no, '') != ''
|
||||||
|
or ifnull(email_id, '') != '' """, as_dict=1)
|
||||||
|
|
||||||
|
for d in warehouse:
|
||||||
|
try:
|
||||||
|
address = frappe.new_doc('Address')
|
||||||
|
address.name = d.name
|
||||||
|
address.address_title = d.name
|
||||||
|
address.address_line1 = d.address_line_1
|
||||||
|
address.city = d.city
|
||||||
|
address.state = d.state
|
||||||
|
address.pincode = d.pin
|
||||||
|
address.db_insert()
|
||||||
|
address.append('links',{'link_doctype':'Warehouse','link_name':d.name})
|
||||||
|
address.links[0].db_insert()
|
||||||
|
if d.name and (d.email_id or d.mobile_no or d.phone_no):
|
||||||
|
contact = frappe.new_doc('Contact')
|
||||||
|
contact.name = d.name
|
||||||
|
contact.first_name = d.name
|
||||||
|
contact.mobile_no = d.mobile_no
|
||||||
|
contact.email_id = d.email_id
|
||||||
|
contact.phone = d.phone_no
|
||||||
|
contact.db_insert()
|
||||||
|
contact.append('links',{'link_doctype':'Warehouse','link_name':d.name})
|
||||||
|
contact.links[0].db_insert()
|
||||||
|
except frappe.DuplicateEntryError:
|
||||||
|
pass
|
||||||
|
|
@ -278,6 +278,14 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
frm.set_value("total_additional_costs",
|
frm.set_value("total_additional_costs",
|
||||||
flt(total_additional_costs, precision("total_additional_costs")));
|
flt(total_additional_costs, precision("total_additional_costs")));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
source_warehouse_address: function(frm) {
|
||||||
|
erpnext.utils.get_address_display(frm, 'source_warehouse_address', 'source_address_display', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
target_warehouse_address: function(frm) {
|
||||||
|
erpnext.utils.get_address_display(frm, 'target_warehouse_address', 'target_address_display', false);
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
frappe.ui.form.on('Stock Entry Detail', {
|
frappe.ui.form.on('Stock Entry Detail', {
|
||||||
|
@ -737,6 +737,68 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"depends_on": "from_warehouse",
|
||||||
|
"fieldname": "source_warehouse_address",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Source Warehouse Address",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Address",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "source_address_display",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Source Warehouse Address",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -797,6 +859,68 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"depends_on": "to_warehouse",
|
||||||
|
"fieldname": "target_warehouse_address",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Target Warehouse Name",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Address",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "target_address_display",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Target Warehouse Address",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -1739,7 +1863,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-06-13 14:28:47.818067",
|
"modified": "2018-03-01 12:27:12.884611",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry",
|
"name": "Stock Entry",
|
||||||
|
@ -5,6 +5,15 @@
|
|||||||
frappe.ui.form.on("Warehouse", {
|
frappe.ui.form.on("Warehouse", {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
||||||
|
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||||
|
|
||||||
|
|
||||||
|
if(!frm.doc.__islocal) {
|
||||||
|
frappe.contacts.render_address_and_contact(frm);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
frappe.contacts.clear_address_and_contact(frm);
|
||||||
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__("Stock Balance"), function() {
|
frm.add_custom_button(__("Stock Balance"), function() {
|
||||||
frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name});
|
frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name});
|
||||||
|
@ -226,6 +226,125 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "address_and_contact",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Address and Contact",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "address_html",
|
||||||
|
"fieldtype": "HTML",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Address HTML",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "column_break_10",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "contact_html",
|
||||||
|
"fieldtype": "HTML",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Contact HTML",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -699,7 +818,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-01-23 16:45:45.546649",
|
"modified": "2018-02-28 09:15:33.463838",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Warehouse",
|
"name": "Warehouse",
|
||||||
|
@ -7,6 +7,7 @@ from frappe.utils import cint, validate_email_add
|
|||||||
from frappe import throw, _
|
from frappe import throw, _
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
from erpnext.stock import get_warehouse_account
|
from erpnext.stock import get_warehouse_account
|
||||||
|
from frappe.contacts.address_and_contact import load_address_and_contact
|
||||||
|
|
||||||
class Warehouse(NestedSet):
|
class Warehouse(NestedSet):
|
||||||
nsm_parent_field = 'parent_warehouse'
|
nsm_parent_field = 'parent_warehouse'
|
||||||
@ -25,10 +26,8 @@ class Warehouse(NestedSet):
|
|||||||
|
|
||||||
if account:
|
if account:
|
||||||
self.set_onload('account', account)
|
self.set_onload('account', account)
|
||||||
|
load_address_and_contact(self)
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
if self.email_id:
|
|
||||||
validate_email_add(self.email_id, True)
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.update_nsm_model()
|
self.update_nsm_model()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user