[cleanup] SMS, and added item filter in stock balance
This commit is contained in:
parent
4ea1ade7b9
commit
614e7ab757
@ -57,8 +57,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
// var percent_paid = cint(flt(doc.base_grand_total - doc.outstanding_amount) / flt(doc.base_grand_total) * 100);
|
||||
// cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
|
||||
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
|
||||
|
||||
if(cint(doc.update_stock)!=1) {
|
||||
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
|
||||
var from_delivery_note = false;
|
||||
@ -394,10 +392,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.set_query("debit_to", function(doc) {
|
||||
return{
|
||||
|
@ -27,8 +27,6 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
||||
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Purchase Order'],
|
||||
"icon-exclamation", "btn-default");
|
||||
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms, "icon-mobile-phone", true);
|
||||
|
||||
} else if(doc.docstatus===0) {
|
||||
cur_frm.cscript.add_from_mappers();
|
||||
}
|
||||
@ -216,10 +214,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.schedule_date = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "schedule_date");
|
||||
|
@ -31,7 +31,6 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
frappe.boot.doctype_icons["Customer"], "btn-default");
|
||||
this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity,
|
||||
frappe.boot.doctype_icons["Opportunity"], "btn-default");
|
||||
cur_frm.add_custom_button(__("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone");
|
||||
}
|
||||
|
||||
if(!this.frm.doc.__islocal) {
|
||||
@ -56,8 +55,5 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,8 +81,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.add_custom_button(__('Opportunity Lost'),
|
||||
cur_frm.cscript['Declare Opportunity Lost'], "icon-remove", "btn-default");
|
||||
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms,
|
||||
"icon-mobile-phone", true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,10 +148,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.company = function(doc, cdt, cdn) {
|
||||
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
|
||||
|
@ -41,11 +41,10 @@ buying_renamed_fields = (
|
||||
def execute():
|
||||
for doctypes, fields in [[selling_doctypes, selling_renamed_fields], [buying_doctypes, buying_renamed_fields]]:
|
||||
for dt in doctypes:
|
||||
meta = frappe.get_meta(dt)
|
||||
frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
|
||||
base_net_total = frappe.db.sql("select sum(ifnull({0}, 0)) from `tab{1}`".format(fields[0][1], dt))[0][0]
|
||||
if not base_net_total:
|
||||
meta = frappe.get_meta(dt)
|
||||
frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
|
||||
|
||||
for f in fields:
|
||||
if meta.get_field(f[0]):
|
||||
rename_field(dt, f[0], f[1])
|
||||
|
@ -10,15 +10,12 @@ def execute():
|
||||
"BOM Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \
|
||||
"Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"]
|
||||
for dt in dt_list:
|
||||
frappe.reload_doctype(dt)
|
||||
names = frappe.db.sql("""select name, description from `tab{0}` doc where doc.description is not null""".format(dt),as_dict=1)
|
||||
for d in names:
|
||||
try:
|
||||
data = d.description
|
||||
image_url = find_first_image(data)
|
||||
desc = re.sub("\<img[^>]+\>", "", data)
|
||||
|
||||
frappe.db.sql("""update `tab{0}` doc set doc.description = %s, doc.image = %s
|
||||
where doc.name = %s """.format(dt),(desc, image_url, d.name))
|
||||
except:
|
||||
pass
|
||||
|
||||
data = d.description
|
||||
image_url = find_first_image(data)
|
||||
desc = re.sub("\<img[^>]+\>", "", data)
|
||||
|
||||
frappe.db.sql("""update `tab{0}` set description = %s, image = %s
|
||||
where name = %s """.format(dt),(desc, image_url, d.name))
|
||||
|
@ -56,6 +56,19 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
this.show_item_wise_taxes();
|
||||
this.set_dynamic_labels();
|
||||
erpnext.pos.make_pos_btn(this.frm);
|
||||
this.setup_sms();
|
||||
},
|
||||
|
||||
setup_sms: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped"], this.frm.doc.status)) {
|
||||
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
|
||||
}
|
||||
},
|
||||
|
||||
send_sms: function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(this.doc);
|
||||
},
|
||||
|
||||
hide_currency_and_price_list: function() {
|
||||
|
@ -25,7 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
cur_frm.add_custom_button(__('Set as Lost'),
|
||||
cur_frm.cscript['Declare Order Lost'], "icon-exclamation", "btn-default");
|
||||
}
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
|
||||
|
||||
}
|
||||
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
@ -159,7 +159,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
cur_frm.email_doc(frappe.boot.notification_settings.quotation_message);
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
this.make_maintenance_schedule, null, "btn-default");
|
||||
}
|
||||
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone", true);
|
||||
|
||||
} else {
|
||||
// un-stop
|
||||
cur_frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop");
|
||||
@ -187,7 +185,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
}
|
||||
};
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
};
|
||||
;
|
||||
|
@ -25,7 +25,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
||||
cur_frm.add_custom_button(__('Make Installation Note'), this.make_installation_note);
|
||||
|
||||
if (doc.docstatus==1) {
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
|
||||
|
||||
this.show_stock_ledger();
|
||||
this.show_general_ledger();
|
||||
}
|
||||
@ -240,8 +240,5 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,17 @@
|
||||
|
||||
frappe.provide("erpnext.item");
|
||||
|
||||
frappe.ui.form.on("Item", "refresh", function(frm) {
|
||||
if(frm.doc.is_stock_item) {
|
||||
frm.add_custom_button(__("Show Balance"), function() {
|
||||
frappe.route_options = {
|
||||
"item_code": frm.doc.name
|
||||
}
|
||||
frappe.set_route("query-report", "Stock Balance");
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
|
||||
// read only if any stock ledger entry exists
|
||||
|
@ -53,8 +53,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
|
||||
cur_frm.add_custom_button(__('Stop'),
|
||||
cur_frm.cscript['Stop Material Request'], "icon-exclamation", "btn-default");
|
||||
}
|
||||
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms,
|
||||
"icon-mobile-phone", true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -192,7 +191,4 @@ cur_frm.cscript['Unstop Material Request'] = function(){
|
||||
}
|
||||
};
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
||||
cur_frm.add_custom_button(__('Make Purchase Invoice'), this.make_purchase_invoice,
|
||||
frappe.boot.doctype_icons["Purchase Invoice"]);
|
||||
}
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms, "icon-mobile-phone", true);
|
||||
|
||||
this.show_stock_ledger();
|
||||
this.show_general_ledger();
|
||||
@ -172,10 +171,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
cur_frm.email_doc(frappe.boot.notification_settings.purchase_receipt_message);
|
||||
}
|
||||
|
||||
cur_frm.cscript.send_sms = function() {
|
||||
frappe.require("assets/erpnext/js/sms_manager.js");
|
||||
var sms_man = new SMSManager(cur_frm.doc);
|
||||
}
|
||||
|
||||
|
||||
frappe.provide("erpnext.buying");
|
||||
|
||||
|
@ -16,6 +16,13 @@ frappe.query_reports["Stock Balance"] = {
|
||||
"fieldtype": "Date",
|
||||
"width": "80",
|
||||
"default": frappe.datetime.get_today()
|
||||
},
|
||||
{
|
||||
"fieldname": "item_code",
|
||||
"label": __("Item"),
|
||||
"fieldtype": "Link",
|
||||
"width": "80",
|
||||
"options": "Item"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -53,6 +53,9 @@ def get_conditions(filters):
|
||||
else:
|
||||
frappe.throw(_("'To Date' is required"))
|
||||
|
||||
if filters.get("item_code"):
|
||||
conditions += " and item_code = '%s'" % frappe.db.escape(filters.get("item_code"))
|
||||
|
||||
return conditions
|
||||
|
||||
#get all details
|
||||
|
Loading…
x
Reference in New Issue
Block a user