[fix] [pos] hide custom buttons in pos view
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index f224c35..60f73b5 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -73,45 +73,14 @@
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 @@
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 @@
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() {
diff --git a/setup/doctype/item_price/item_price.txt b/setup/doctype/item_price/item_price.txt
index 2964cd9..4ff5124 100644
--- a/setup/doctype/item_price/item_price.txt
+++ b/setup/doctype/item_price/item_price.txt
@@ -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",
diff --git a/utilities/demo/demo_docs/Price_List.csv b/utilities/demo/demo_docs/Price_List.csv
index 1c61c55..fb41239 100644
--- a/utilities/demo/demo_docs/Price_List.csv
+++ b/utilities/demo/demo_docs/Price_List.csv
@@ -12,13 +12,13 @@
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 @@
,,,,,,,,,,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
diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py
index 893edb5..a526c2a 100644
--- a/utilities/demo/make_demo.py
+++ b/utilities/demo/make_demo.py
@@ -380,7 +380,7 @@
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 @@
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 @@
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()
\ No newline at end of file
+ upload(overwrite=overwrite)
\ No newline at end of file