From 75b00e39582b94a4cf816b9deb04c0f0e4c795f2 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 8 Jul 2015 12:15:28 +0530 Subject: [PATCH] Mode of Payment added to POS Profile --- .../doctype/pos_profile/pos_profile.json | 108 ++++++++++-------- .../doctype/sales_invoice/sales_invoice.py | 1 + erpnext/public/js/pos/pos.js | 3 +- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json index ad224f1908..0c5a4bbc7e 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.json +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -77,6 +77,51 @@ "read_only": 0, "reqd": 1 }, + { + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "read_only": 0, + "reqd": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms and Conditions", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "read_only": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "in_filter": 0, + "label": "Print Heading", + "oldfieldname": "select_print_heading", + "oldfieldtype": "Select", + "options": "Print Heading", + "permlevel": 0, + "read_only": 0 + }, { "fieldname": "column_break0", "fieldtype": "Column Break", @@ -105,6 +150,14 @@ "read_only": 0, "reqd": 0 }, + { + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "label": "Mode of Payment", + "options": "Mode of Payment", + "permlevel": 0, + "precision": "" + }, { "fieldname": "cash_bank_account", "fieldtype": "Link", @@ -139,17 +192,6 @@ "read_only": 0, "reqd": 0 }, - { - "fieldname": "warehouse", - "fieldtype": "Link", - "label": "Warehouse", - "oldfieldname": "warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "read_only": 0, - "reqd": 0 - }, { "fieldname": "cost_center", "fieldtype": "Link", @@ -161,16 +203,6 @@ "read_only": 0, "reqd": 1 }, - { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "charge", - "oldfieldtype": "Link", - "options": "Sales Taxes and Charges Template", - "permlevel": 0, - "read_only": 0 - }, { "fieldname": "write_off_account", "fieldtype": "Link", @@ -190,43 +222,19 @@ "reqd": 1 }, { - "allow_on_submit": 1, - "fieldname": "letter_head", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Letter Head", - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms and Conditions", - "oldfieldname": "tc_name", + "label": "Taxes and Charges", + "oldfieldname": "charge", "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "read_only": 0 - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "in_filter": 0, - "label": "Print Heading", - "oldfieldname": "select_print_heading", - "oldfieldtype": "Select", - "options": "Print Heading", + "options": "Sales Taxes and Charges Template", "permlevel": 0, "read_only": 0 } ], "icon": "icon-cog", "idx": 1, - "modified": "2015-05-20 05:38:44.482696", + "modified": "2015-07-07 08:56:04.381471", "modified_by": "Administrator", "module": "Accounts", "name": "POS Profile", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 604370b326..c620ff7725 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -169,6 +169,7 @@ class SalesInvoice(SellingController): if pos: if not for_validate and not self.customer: self.customer = pos.customer + self.mode_of_payment = pos.mode_of_payment # self.set_customer_defaults() for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name', diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js index 164e88359d..70f302387b 100644 --- a/erpnext/public/js/pos/pos.js +++ b/erpnext/public/js/pos/pos.js @@ -401,7 +401,8 @@ erpnext.pos.PointOfSale = Class.extend({ this.with_modes_of_payment(function() { // prefer cash payment! - var default_mode = me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined; + var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment : + me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined; // show payment wizard var dialog = new frappe.ui.Dialog({