[fix] [pos] hide custom buttons in pos view
This commit is contained in:
parent
c96c13af4e
commit
2e1f94f222
@ -73,45 +73,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
if(!from_delivery_note)
|
||||
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
|
||||
}
|
||||
|
||||
|
||||
if(doc.outstanding_amount!=0)
|
||||
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
|
||||
}
|
||||
|
||||
if (doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(wn._('From Sales Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
source_doctype: "Sales Order",
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
customer: cur_frm.doc.customer || undefined,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
cur_frm.add_custom_button(wn._('From Delivery Note'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
source_doctype: "Delivery Note",
|
||||
get_query: function() {
|
||||
var filters = {
|
||||
company: cur_frm.doc.company
|
||||
};
|
||||
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
|
||||
return {
|
||||
query: "controllers.queries.get_delivery_notes_to_be_billed",
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
cur_frm.cscript.sales_order_btn();
|
||||
cur_frm.cscript.delivery_note_btn();
|
||||
}
|
||||
|
||||
// Show POS button only if it enabled from features setup
|
||||
@ -119,6 +88,43 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.cscript.pos_btn();
|
||||
},
|
||||
|
||||
sales_order_btn: function() {
|
||||
this.$sales_order_btn = cur_frm.add_custom_button(wn._('From Sales Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
source_doctype: "Sales Order",
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
customer: cur_frm.doc.customer || undefined,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
delivery_note_btn: function() {
|
||||
this.$delivery_note_btn = cur_frm.add_custom_button(wn._('From Delivery Note'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
source_doctype: "Delivery Note",
|
||||
get_query: function() {
|
||||
var filters = {
|
||||
company: cur_frm.doc.company
|
||||
};
|
||||
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
|
||||
return {
|
||||
query: "controllers.queries.get_delivery_notes_to_be_billed",
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
pos_btn: function() {
|
||||
if(cur_frm.$pos_btn)
|
||||
cur_frm.$pos_btn.remove();
|
||||
@ -126,9 +132,17 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
if(!cur_frm.pos_active) {
|
||||
var btn_label = wn._("POS View"),
|
||||
icon = "icon-desktop";
|
||||
|
||||
cur_frm.cscript.sales_order_btn();
|
||||
cur_frm.cscript.delivery_note_btn();
|
||||
} else {
|
||||
var btn_label = wn._("Invoice View"),
|
||||
icon = "icon-file-text";
|
||||
|
||||
if (cur_frm.doc.docstatus===0) {
|
||||
this.$delivery_note_btn.remove();
|
||||
this.$sales_order_btn.remove();
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.$pos_btn = cur_frm.add_custom_button(btn_label, function() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-02 16:29:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-11 12:38:24",
|
||||
"modified": "2013-09-13 11:50:02",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -44,7 +44,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Ref Rate",
|
||||
"label": "Rate",
|
||||
"oldfieldname": "ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
|
@ -12,13 +12,13 @@ Only mandatory fields are necessary for new records. You can delete non-mandator
|
||||
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,
|
||||
,,,,,,,,,,,
|
||||
DocType:,Price List,,,,~,For Territory,valid_for_territories,~,Item Price,item_prices,
|
||||
Column Labels:,ID,Price List Name,Currency,Valid for Buying or Selling?,,ID,Territory,,ID,Item Code,Ref Rate
|
||||
Column Labels:,ID,Price List Name,Currency,Valid for Buying or Selling?,,ID,Territory,,ID,Item Code,Rate
|
||||
Column Name:,name,price_list_name,currency,buying_or_selling,~,name,territory,~,name,item_code,ref_rate
|
||||
Mandatory:,Yes,Yes,Yes,Yes,,Yes,Yes,,Yes,Yes,Yes
|
||||
Type:,Data (text),Data,Link,Select,,Data,Link,,Data,Link,Currency
|
||||
Info:,,,Valid Currency,"One of: Buying, Selling",,Leave blank for new records,Valid Territory,,Leave blank for new records,Valid Item,
|
||||
Start entering data below this line,,,,,,,,,,,
|
||||
,,Standard Buying,USD,Buying,,,United States,,,Base Bearing Plate,15
|
||||
,Standard Buying,Standard Buying,USD,Buying,,,United States,,,Base Bearing Plate,15
|
||||
,,,,,,,,,,Base Plate,20
|
||||
,,,,,,,,,,Bearing Block,10
|
||||
,,,,,,,,,,Bearing Collar,20
|
||||
@ -31,7 +31,7 @@ Start entering data below this line,,,,,,,,,,,
|
||||
,,,,,,,,,,Stand,40
|
||||
,,,,,,,,,,Upper Bearing Plate,50
|
||||
,,,,,,,,,,Wing Sheet,22
|
||||
,,Standard Selling,USD,Selling,,,United States,,,Wind Turbine,21
|
||||
,Standard Selling,Standard Selling,USD,Selling,,,United States,,,Wind Turbine,21
|
||||
,,,,,,,,,,Wind Mill A Series,28
|
||||
,,,,,,,,,,Wind MIll C Series,14
|
||||
,,,,,,,,,,Base Bearing Plate,28
|
||||
|
|
@ -380,7 +380,7 @@ def make_items():
|
||||
import_data("BOM", submit=True)
|
||||
|
||||
def make_price_lists():
|
||||
import_data("Price_List")
|
||||
import_data("Price_List", overwrite=True)
|
||||
|
||||
def make_customers_suppliers_contacts():
|
||||
import_data(["Customer", "Supplier", "Contact", "Address", "Lead"])
|
||||
@ -404,7 +404,7 @@ def make_bank_account():
|
||||
webnotes.set_value("Company", company, "default_bank_account", ba.doc.name)
|
||||
webnotes.conn.commit()
|
||||
|
||||
def import_data(dt, submit=False):
|
||||
def import_data(dt, submit=False, overwrite=False):
|
||||
if not isinstance(dt, (tuple, list)):
|
||||
dt = [dt]
|
||||
|
||||
@ -414,4 +414,4 @@ def import_data(dt, submit=False):
|
||||
if submit:
|
||||
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
|
||||
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
|
||||
upload()
|
||||
upload(overwrite=overwrite)
|
Loading…
x
Reference in New Issue
Block a user