When a new company is made, cash account should be automatically set for Mode of Payment
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index a4078bd..c0f82bc 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -593,7 +593,7 @@
this.remove_item = []
$.each(this.frm.doc["items"] || [], function(i, d) {
- if(d.serial_no){
+ if(d.serial_no && field == 'qty'){
me.validate_serial_no_qty(d, item_code, field, value)
}
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 7f506d5..94a0101 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -78,6 +78,8 @@
if not frappe.local.flags.ignore_chart_of_accounts:
self.set_default_accounts()
+ if self.default_cash_account:
+ self.mode_of_payment()
if self.default_currency:
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
@@ -162,6 +164,16 @@
if account:
self.db_set(fieldname, account)
+ def mode_of_payment(self):
+ cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
+ if cash:
+ mode_of_payment = frappe.get_doc('Mode of Payment', cash)
+ mode_of_payment.append('accounts', {
+ 'company': self.name,
+ 'default_account': self.default_cash_account
+ })
+ mode_of_payment.save(ignore_permissions=True)
+
def create_default_cost_center(self):
cc_list = [
{