fix: Label and UX fixes while creating payment entry against customer (#20465)

* fix: Label and UX fixes while creating payment entry against customer

* fix: filter
This commit is contained in:
Deepesh Garg 2020-02-03 15:58:50 +05:30 committed by GitHub
parent 4fca6cae34
commit 9e1fbaf59e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,5 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"creation": "2017-05-29 21:35:13.136357",
@ -82,7 +83,7 @@
"default": "0",
"fieldname": "is_default",
"fieldtype": "Check",
"label": "Is the Default Account"
"label": "Is Default Account"
},
{
"default": "0",
@ -211,7 +212,8 @@
"read_only": 1
}
],
"modified": "2019-10-02 01:34:12.417601",
"links": [],
"modified": "2020-01-29 20:42:26.458316",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Account",

View File

@ -102,7 +102,9 @@ class PaymentEntry(AccountsController):
self.bank = bank_data.bank
self.bank_account_no = bank_data.bank_account_no
self.set(field, bank_data.account)
if not self.get(field):
self.set(field, bank_data.account)
def validate_allocated_amount(self):
for d in self.get("references"):

View File

@ -55,6 +55,14 @@ frappe.ui.form.on("Customer", {
}
}
})
frm.set_query('default_bank_account', function() {
return {
filters: {
'is_company_account': 1
}
}
});
},
customer_primary_address: function(frm){
if(frm.doc.customer_primary_address){

View File

@ -1,4 +1,5 @@
{
"actions": [],
"allow_events_in_timeline": 1,
"allow_import": 1,
"allow_rename": 1,
@ -122,7 +123,7 @@
{
"fieldname": "default_bank_account",
"fieldtype": "Link",
"label": "Default Bank Account",
"label": "Default Company Bank Account",
"options": "Bank Account"
},
{
@ -470,7 +471,8 @@
"icon": "fa fa-user",
"idx": 363,
"image_field": "image",
"modified": "2020-01-24 15:07:48.815546",
"links": [],
"modified": "2020-01-29 20:36:37.879581",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",

View File

@ -54,6 +54,7 @@ class Customer(TransactionBase):
self.validate_credit_limit_on_change()
self.set_loyalty_program()
self.check_customer_group_change()
self.validate_default_bank_account()
# set loyalty program tier
if frappe.db.exists('Customer', self.name):
@ -72,6 +73,11 @@ class Customer(TransactionBase):
if self.customer_group != frappe.db.get_value('Customer', self.name, 'customer_group'):
frappe.flags.customer_group_changed = True
def validate_default_bank_account(self):
if self.default_bank_account:
is_company_account = frappe.db.get_value('Bank Account', self.default_bank_account, 'is_company_account')
frappe.throw(_("{0} is not a company bank account").format(frappe.bold(self.default_bank_account)))
def on_update(self):
self.validate_name_with_customer_group()
self.create_primary_contact()