When a new company is made, cash account should be automatically set for Mode of Payment
This commit is contained in:
parent
a6be7c71ed
commit
8c9c9cfc5f
@ -593,7 +593,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,8 @@ class Company(Document):
|
||||
|
||||
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 @@ class Company(Document):
|
||||
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 = [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user