mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-14 17:33:09 +00:00
Merge branch 'develop' into payment-terms
This commit is contained in:
@@ -24,6 +24,11 @@ frappe.ui.form.on('Batch', {
|
||||
frm.trigger('make_dashboard');
|
||||
}
|
||||
},
|
||||
item: (frm) => {
|
||||
frappe.db.get_value('Item', {name: frm.doc.item}, 'has_expiry_date', (r) => {
|
||||
frm.toggle_reqd('expiry_date', r.has_expiry_date);
|
||||
});
|
||||
},
|
||||
make_dashboard: (frm) => {
|
||||
if(!frm.is_new()) {
|
||||
frappe.call({
|
||||
|
||||
@@ -3610,7 +3610,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-09-19 11:21:59.084183",
|
||||
"modified": "2017-11-03 05:31:56.636424",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note",
|
||||
@@ -3727,5 +3727,5 @@
|
||||
"timeline_field": "customer",
|
||||
"title_field": "title",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"track_seen": 1
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -91,7 +91,7 @@ class Item(WebsiteGenerator):
|
||||
self.validate_barcode()
|
||||
self.cant_change()
|
||||
self.validate_warehouse_for_reorder()
|
||||
self.update_item_desc()
|
||||
self.update_bom_item_desc()
|
||||
self.synced_with_hub = 0
|
||||
|
||||
self.validate_has_variants()
|
||||
@@ -599,13 +599,27 @@ class Item(WebsiteGenerator):
|
||||
row.label = label
|
||||
row.description = desc
|
||||
|
||||
def update_item_desc(self):
|
||||
if frappe.db.get_value('BOM',self.name, 'description') != self.description:
|
||||
frappe.db.sql("""update `tabBOM` set description = %s where item = %s and docstatus < 2""",(self.description, self.name))
|
||||
frappe.db.sql("""update `tabBOM Item` set description = %s where
|
||||
item_code = %s and docstatus < 2""",(self.description, self.name))
|
||||
frappe.db.sql("""update `tabBOM Explosion Item` set description = %s where
|
||||
item_code = %s and docstatus < 2""",(self.description, self.name))
|
||||
def update_bom_item_desc(self):
|
||||
if self.is_new(): return
|
||||
|
||||
if self.db_get('description') != self.description:
|
||||
frappe.db.sql("""
|
||||
update `tabBOM`
|
||||
set description = %s
|
||||
where item = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
frappe.db.sql("""
|
||||
update `tabBOM Item`
|
||||
set description = %s
|
||||
where item_code = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
frappe.db.sql("""
|
||||
update `tabBOM Explosion Item`
|
||||
set description = %s
|
||||
where item_code = %s and docstatus < 2
|
||||
""", (self.description, self.name))
|
||||
|
||||
def update_template_item(self):
|
||||
"""Set Show in Website for Template Item if True for its Variant"""
|
||||
@@ -624,7 +638,8 @@ class Item(WebsiteGenerator):
|
||||
template_item.save()
|
||||
|
||||
def update_variants(self):
|
||||
if self.flags.dont_update_variants:
|
||||
if self.flags.dont_update_variants or \
|
||||
frappe.db.get_single_value('Item Variant Settings', 'do_not_update_variants'):
|
||||
return
|
||||
if self.has_variants:
|
||||
updated = []
|
||||
|
||||
@@ -12,6 +12,66 @@
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_3",
|
||||
"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,
|
||||
"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,
|
||||
"description": "If enabled then system will not update the fields of variants from the template but will copy the data of below mentioned fields while making new variant",
|
||||
"fieldname": "do_not_update_variants",
|
||||
"fieldtype": "Check",
|
||||
"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": "Do not Update Variants",
|
||||
"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,
|
||||
@@ -84,8 +144,8 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-09-11 12:05:16.288601",
|
||||
"modified_by": "rohit@erpnext.com",
|
||||
"modified": "2017-11-08 11:38:12.821404",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Variant Settings",
|
||||
"name_case": "",
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt, cint
|
||||
from frappe import _
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model import no_value_fields
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cint, flt
|
||||
|
||||
|
||||
class PackingSlip(Document):
|
||||
|
||||
@@ -84,11 +86,12 @@ class PackingSlip(Document):
|
||||
* No. of Cases of this packing slip
|
||||
"""
|
||||
|
||||
# also pick custom fields from delivery note
|
||||
rows = [d.item_code for d in self.get("items")]
|
||||
|
||||
custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname) for d in \
|
||||
frappe.get_meta("Delivery Note Item").get_custom_fields()])
|
||||
# also pick custom fields from delivery note
|
||||
custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname)
|
||||
for d in frappe.get_meta("Delivery Note Item").get_custom_fields()
|
||||
if d.fieldtype not in no_value_fields])
|
||||
|
||||
if custom_fields:
|
||||
custom_fields = ', ' + custom_fields
|
||||
|
||||
@@ -64,6 +64,8 @@ class Warehouse(NestedSet):
|
||||
where parent_warehouse = %s""", self.name)
|
||||
|
||||
def before_rename(self, old_name, new_name, merge=False):
|
||||
super(Warehouse, self).before_rename(old_name, new_name, merge)
|
||||
|
||||
# Add company abbr if not provided
|
||||
new_warehouse = erpnext.encode_company_abbr(new_name, self.company)
|
||||
|
||||
@@ -77,19 +79,21 @@ class Warehouse(NestedSet):
|
||||
return new_warehouse
|
||||
|
||||
def after_rename(self, old_name, new_name, merge=False):
|
||||
super(Warehouse, self).after_rename(old_name, new_name, merge)
|
||||
|
||||
new_warehouse_name = self.get_new_warehouse_name_without_abbr(new_name)
|
||||
self.db_set("warehouse_name", new_warehouse_name)
|
||||
|
||||
|
||||
if merge:
|
||||
self.recalculate_bin_qty(new_name)
|
||||
|
||||
|
||||
def get_new_warehouse_name_without_abbr(self, name):
|
||||
company_abbr = frappe.db.get_value("Company", self.company, "abbr")
|
||||
parts = name.rsplit(" - ", 1)
|
||||
|
||||
|
||||
if parts[-1].lower() == company_abbr.lower():
|
||||
name = parts[0]
|
||||
|
||||
|
||||
return name
|
||||
|
||||
def recalculate_bin_qty(self, new_name):
|
||||
@@ -135,25 +139,19 @@ class Warehouse(NestedSet):
|
||||
return 1
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_children():
|
||||
def get_children(doctype, parent=None, company=None, is_root=False):
|
||||
from erpnext.stock.utils import get_stock_value_on
|
||||
doctype = frappe.local.form_dict.get('doctype')
|
||||
company = frappe.local.form_dict.get('company')
|
||||
|
||||
parent_field = 'parent_' + doctype.lower().replace(' ', '_')
|
||||
parent = frappe.form_dict.get("parent") or ""
|
||||
|
||||
if parent == "Warehouses":
|
||||
if is_root:
|
||||
parent = ""
|
||||
|
||||
warehouses = frappe.db.sql("""select name as value,
|
||||
is_group as expandable
|
||||
from `tab{doctype}`
|
||||
from `tabWarehouse`
|
||||
where docstatus < 2
|
||||
and ifnull(`{parent_field}`,'') = %s
|
||||
and ifnull(`parent_warehouse`,'') = %s
|
||||
and (`company` = %s or company is null or company = '')
|
||||
order by name""".format(doctype=frappe.db.escape(doctype),
|
||||
parent_field=frappe.db.escape(parent_field)), (parent, company), as_dict=1)
|
||||
order by name""", (parent, company), as_dict=1)
|
||||
|
||||
# return warehouses
|
||||
for wh in warehouses:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-02-22 18:01:55",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-09-18 12:28:49.322622",
|
||||
"modified": "2017-11-06 13:05:38.965229",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Ordered Items To Be Delivered",
|
||||
|
||||
Reference in New Issue
Block a user