commit
8c7b4549ed
@ -61,3 +61,4 @@ erpnext.patches.v4_0.update_custom_print_formats_for_renamed_fields
|
||||
erpnext.patches.v4_0.update_other_charges_in_custom_purchase_print_formats
|
||||
erpnext.patches.v4_0.create_price_list_if_missing
|
||||
execute:frappe.db.sql("update `tabItem` set end_of_life=null where end_of_life='0000-00-00'") #2014-06-16
|
||||
erpnext.patches.v4_0.update_users_report_view_settings
|
||||
|
12
erpnext/patches/v4_0/update_users_report_view_settings.py
Normal file
12
erpnext/patches/v4_0/update_users_report_view_settings.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from frappe.model import update_users_report_view_settings
|
||||
from erpnext.patches.v4_0.fields_to_be_renamed import rename_map
|
||||
|
||||
def execute():
|
||||
for dt, field_list in rename_map.items():
|
||||
for field in field_list:
|
||||
update_users_report_view_settings(dt, field[0], field[1])
|
@ -102,7 +102,6 @@ class SalesOrder(SellingController):
|
||||
self.validate_warehouse()
|
||||
|
||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||
|
||||
make_packing_list(self,'sales_order_details')
|
||||
|
||||
self.validate_with_previous_doc()
|
||||
|
@ -3,15 +3,15 @@
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
message: function () {
|
||||
var total_words = this.frm.doc.message.length;
|
||||
var total_characters = this.frm.doc.message.length;
|
||||
var total_msg = 1;
|
||||
|
||||
if (total_words > 160) {
|
||||
total_msg = cint(total_words / 160);
|
||||
total_msg = (total_words % 160 == 0 ? total_msg : total_msg + 1);
|
||||
if (total_characters > 160) {
|
||||
total_msg = cint(total_characters / 160);
|
||||
total_msg = (total_characters % 160 == 0 ? total_msg : total_msg + 1);
|
||||
}
|
||||
|
||||
this.frm.set_value("total_words", total_words);
|
||||
this.frm.set_value("total_characters", total_characters);
|
||||
this.frm.set_value("total_messages", this.frm.doc.message ? total_msg : 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,135 +1,135 @@
|
||||
{
|
||||
"allow_attach": 0,
|
||||
"allow_copy": 1,
|
||||
"creation": "2013-01-10 16:34:22",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"allow_attach": 0,
|
||||
"allow_copy": 1,
|
||||
"creation": "2013-01-10 16:34:22",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "send_to",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Send To",
|
||||
"options": "\nAll Contact\nAll Customer Contact\nAll Supplier Contact\nAll Sales Partner Contact\nAll Lead (Open)\nAll Employee (Active)\nAll Sales Person",
|
||||
"fieldname": "send_to",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Send To",
|
||||
"options": "\nAll Contact\nAll Customer Contact\nAll Supplier Contact\nAll Sales Partner Contact\nAll Lead (Open)\nAll Employee (Active)\nAll Sales Person",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.send_to=='All Customer Contact'",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Customer",
|
||||
"options": "Customer",
|
||||
"depends_on": "eval:doc.send_to=='All Customer Contact'",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Customer",
|
||||
"options": "Customer",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.send_to=='All Supplier Contact'",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Supplier",
|
||||
"options": "Supplier",
|
||||
"depends_on": "eval:doc.send_to=='All Supplier Contact'",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Supplier",
|
||||
"options": "Supplier",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Department",
|
||||
"options": "Department",
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Department",
|
||||
"options": "Department",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "branch",
|
||||
"fieldtype": "Link",
|
||||
"label": "Branch",
|
||||
"options": "Branch",
|
||||
"depends_on": "eval:doc.send_to=='All Employee (Active)'",
|
||||
"fieldname": "branch",
|
||||
"fieldtype": "Link",
|
||||
"label": "Branch",
|
||||
"options": "Branch",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "create_receiver_list",
|
||||
"fieldtype": "Button",
|
||||
"label": "Create Receiver List",
|
||||
"options": "create_receiver_list",
|
||||
"fieldname": "create_receiver_list",
|
||||
"fieldtype": "Button",
|
||||
"label": "Create Receiver List",
|
||||
"options": "create_receiver_list",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "receiver_list",
|
||||
"fieldtype": "Code",
|
||||
"label": "Receiver List",
|
||||
"fieldname": "receiver_list",
|
||||
"fieldtype": "Code",
|
||||
"label": "Receiver List",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break9",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break9",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "Messages greater than 160 characters will be split into multiple messages",
|
||||
"fieldname": "message",
|
||||
"fieldtype": "Text",
|
||||
"label": "Message",
|
||||
"permlevel": 0,
|
||||
"description": "Messages greater than 160 characters will be split into multiple messages",
|
||||
"fieldname": "message",
|
||||
"fieldtype": "Text",
|
||||
"label": "Message",
|
||||
"permlevel": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "total_words",
|
||||
"fieldtype": "Int",
|
||||
"label": "Total Characters",
|
||||
"permlevel": 0,
|
||||
"fieldname": "total_characters",
|
||||
"fieldtype": "Int",
|
||||
"label": "Total Characters",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "total_messages",
|
||||
"fieldtype": "Int",
|
||||
"label": "Total Message(s)",
|
||||
"permlevel": 0,
|
||||
"fieldname": "total_messages",
|
||||
"fieldtype": "Int",
|
||||
"label": "Total Message(s)",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "send_sms",
|
||||
"fieldtype": "Button",
|
||||
"label": "Send SMS",
|
||||
"options": "send_sms",
|
||||
"fieldname": "send_sms",
|
||||
"fieldtype": "Button",
|
||||
"label": "Send SMS",
|
||||
"options": "send_sms",
|
||||
"permlevel": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-mobile-phone",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"issingle": 1,
|
||||
"modified": "2014-05-09 02:17:41.375945",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "SMS Center",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-mobile-phone",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"issingle": 1,
|
||||
"modified": "2014-06-18 08:59:51.755566",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "SMS Center",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"export": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "System Manager",
|
||||
"submit": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"export": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "System Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 1,
|
||||
"sort_field": "modified",
|
||||
],
|
||||
"read_only": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
|
@ -12,18 +12,18 @@ from frappe.model.document import Document
|
||||
|
||||
class PackedItem(Document):
|
||||
pass
|
||||
|
||||
|
||||
def get_sales_bom_items(item_code):
|
||||
return frappe.db.sql("""select t1.item_code, t1.qty, t1.uom
|
||||
from `tabSales BOM Item` t1, `tabSales BOM` t2
|
||||
return frappe.db.sql("""select t1.item_code, t1.qty, t1.uom
|
||||
from `tabSales BOM Item` t1, `tabSales BOM` t2
|
||||
where t2.new_item_code=%s and t1.parent = t2.name""", item_code, as_dict=1)
|
||||
|
||||
def get_packing_item_details(item):
|
||||
return frappe.db.sql("""select item_name, description, stock_uom from `tabItem`
|
||||
return frappe.db.sql("""select item_name, description, stock_uom from `tabItem`
|
||||
where name = %s""", item, as_dict = 1)[0]
|
||||
|
||||
def get_bin_qty(item, warehouse):
|
||||
det = frappe.db.sql("""select actual_qty, projected_qty from `tabBin`
|
||||
det = frappe.db.sql("""select actual_qty, projected_qty from `tabBin`
|
||||
where item_code = %s and warehouse = %s""", (item, warehouse), as_dict = 1)
|
||||
return det and det[0] or ''
|
||||
|
||||
@ -55,12 +55,15 @@ def update_packing_list_item(obj, packing_item_code, qty, warehouse, line, packi
|
||||
if not pi.batch_no:
|
||||
pi.batch_no = cstr(line.get("batch_no"))
|
||||
pi.idx = packing_list_idx
|
||||
|
||||
|
||||
packing_list_idx += 1
|
||||
|
||||
|
||||
def make_packing_list(obj, item_table_fieldname):
|
||||
"""make packing list for sales bom item"""
|
||||
|
||||
if obj._action == "update_after_submit": return
|
||||
|
||||
packing_list_idx = 0
|
||||
parent_items = []
|
||||
for d in obj.get(item_table_fieldname):
|
||||
@ -68,14 +71,14 @@ def make_packing_list(obj, item_table_fieldname):
|
||||
and d.warehouse or d.warehouse
|
||||
if frappe.db.get_value("Sales BOM", {"new_item_code": d.item_code}):
|
||||
for i in get_sales_bom_items(d.item_code):
|
||||
update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty),
|
||||
update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty),
|
||||
warehouse, d, packing_list_idx)
|
||||
|
||||
if [d.item_code, d.name] not in parent_items:
|
||||
parent_items.append([d.item_code, d.name])
|
||||
|
||||
|
||||
cleanup_packing_list(obj, parent_items)
|
||||
|
||||
|
||||
def cleanup_packing_list(obj, parent_items):
|
||||
"""Remove all those child items which are no longer present in main item table"""
|
||||
delete_list = []
|
||||
@ -86,10 +89,9 @@ def cleanup_packing_list(obj, parent_items):
|
||||
|
||||
if not delete_list:
|
||||
return obj
|
||||
|
||||
|
||||
packing_details = obj.get("packing_details")
|
||||
obj.set("packing_details", [])
|
||||
for d in packing_details:
|
||||
if d not in delete_list:
|
||||
obj.append("packing_details", d)
|
||||
|
@ -221,7 +221,7 @@ class StockEntry(StockController):
|
||||
if not d.bom_no:
|
||||
if not flt(d.incoming_rate) or d.s_warehouse or self.purpose == "Sales Return":
|
||||
incoming_rate = self.get_incoming_rate(args)
|
||||
if incoming_rate:
|
||||
if flt(incoming_rate) > 0:
|
||||
d.incoming_rate = incoming_rate
|
||||
|
||||
d.amount = flt(d.transfer_qty) * flt(d.incoming_rate)
|
||||
|
Loading…
x
Reference in New Issue
Block a user