fix: Cost center filter on payment reconciliation
This commit is contained in:
		
							parent
							
								
									1622faad40
								
							
						
					
					
						commit
						ab94b73e93
					
				| @ -38,6 +38,15 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo | |||||||
| 				] | 				] | ||||||
| 			}; | 			}; | ||||||
| 		}); | 		}); | ||||||
|  | 
 | ||||||
|  | 		this.frm.set_query("cost_center", () => { | ||||||
|  | 			return { | ||||||
|  | 				"filters": { | ||||||
|  | 					"company": this.frm.doc.company, | ||||||
|  | 					"is_group": 0 | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	refresh() { | 	refresh() { | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ | |||||||
|   "invoice_limit", |   "invoice_limit", | ||||||
|   "payment_limit", |   "payment_limit", | ||||||
|   "bank_cash_account", |   "bank_cash_account", | ||||||
|  |   "cost_center", | ||||||
|   "sec_break1", |   "sec_break1", | ||||||
|   "invoices", |   "invoices", | ||||||
|   "column_break_15", |   "column_break_15", | ||||||
| @ -178,13 +179,19 @@ | |||||||
|   { |   { | ||||||
|    "fieldname": "column_break_11", |    "fieldname": "column_break_11", | ||||||
|    "fieldtype": "Column Break" |    "fieldtype": "Column Break" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |    "fieldname": "cost_center", | ||||||
|  |    "fieldtype": "Link", | ||||||
|  |    "label": "Cost Center", | ||||||
|  |    "options": "Cost Center" | ||||||
|   } |   } | ||||||
|  ], |  ], | ||||||
|  "hide_toolbar": 1, |  "hide_toolbar": 1, | ||||||
|  "icon": "icon-resize-horizontal", |  "icon": "icon-resize-horizontal", | ||||||
|  "issingle": 1, |  "issingle": 1, | ||||||
|  "links": [], |  "links": [], | ||||||
|  "modified": "2021-10-04 20:27:11.114194", |  "modified": "2022-04-29 15:37:10.246831", | ||||||
|  "modified_by": "Administrator", |  "modified_by": "Administrator", | ||||||
|  "module": "Accounts", |  "module": "Accounts", | ||||||
|  "name": "Payment Reconciliation", |  "name": "Payment Reconciliation", | ||||||
| @ -209,5 +216,6 @@ | |||||||
|  ], |  ], | ||||||
|  "sort_field": "modified", |  "sort_field": "modified", | ||||||
|  "sort_order": "DESC", |  "sort_order": "DESC", | ||||||
|  |  "states": [], | ||||||
|  "track_changes": 1 |  "track_changes": 1 | ||||||
| } | } | ||||||
| @ -332,6 +332,9 @@ class PaymentReconciliation(Document): | |||||||
| 	def get_conditions(self, get_invoices=False, get_payments=False, get_return_invoices=False): | 	def get_conditions(self, get_invoices=False, get_payments=False, get_return_invoices=False): | ||||||
| 		condition = " and company = '{0}' ".format(self.company) | 		condition = " and company = '{0}' ".format(self.company) | ||||||
| 
 | 
 | ||||||
|  | 		if self.get("cost_center") and (get_invoices or get_payments or get_return_invoices): | ||||||
|  | 			condition = " and cost_center = '{0}' ".format(self.cost_center) | ||||||
|  | 
 | ||||||
| 		if get_invoices: | 		if get_invoices: | ||||||
| 			condition += ( | 			condition += ( | ||||||
| 				" and posting_date >= {0}".format(frappe.db.escape(self.from_invoice_date)) | 				" and posting_date >= {0}".format(frappe.db.escape(self.from_invoice_date)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user