feat: Auto allocate advance payments only against orders (#34727)
feat: Auto allocate advance payments only againt orders
This commit is contained in:
parent
869289a6e4
commit
fd3fb64aa3
@ -118,6 +118,7 @@
|
|||||||
"paid_amount",
|
"paid_amount",
|
||||||
"advances_section",
|
"advances_section",
|
||||||
"allocate_advances_automatically",
|
"allocate_advances_automatically",
|
||||||
|
"only_include_allocated_payments",
|
||||||
"get_advances",
|
"get_advances",
|
||||||
"advances",
|
"advances",
|
||||||
"advance_tax",
|
"advance_tax",
|
||||||
@ -1550,17 +1551,24 @@
|
|||||||
"fieldname": "named_place",
|
"fieldname": "named_place",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Named Place"
|
"label": "Named Place"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"depends_on": "allocate_advances_automatically",
|
||||||
|
"description": "Advance payments allocated against orders will only be fetched",
|
||||||
|
"fieldname": "only_include_allocated_payments",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Only Include Allocated Payments"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 204,
|
"idx": 204,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-01-28 19:18:56.586321",
|
"modified": "2023-04-03 22:57:14.074982",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice",
|
"name": "Purchase Invoice",
|
||||||
"name_case": "Title Case",
|
|
||||||
"naming_rule": "By \"Naming Series\" field",
|
"naming_rule": "By \"Naming Series\" field",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
@ -120,6 +120,7 @@
|
|||||||
"account_for_change_amount",
|
"account_for_change_amount",
|
||||||
"advances_section",
|
"advances_section",
|
||||||
"allocate_advances_automatically",
|
"allocate_advances_automatically",
|
||||||
|
"only_include_allocated_payments",
|
||||||
"get_advances",
|
"get_advances",
|
||||||
"advances",
|
"advances",
|
||||||
"write_off_section",
|
"write_off_section",
|
||||||
@ -2126,6 +2127,14 @@
|
|||||||
"fieldname": "named_place",
|
"fieldname": "named_place",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Named Place"
|
"label": "Named Place"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"depends_on": "allocate_advances_automatically",
|
||||||
|
"description": "Advance payments allocated against orders will only be fetched",
|
||||||
|
"fieldname": "only_include_allocated_payments",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Only Include Allocated Payments"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
@ -2138,7 +2147,7 @@
|
|||||||
"link_fieldname": "consolidated_invoice"
|
"link_fieldname": "consolidated_invoice"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2023-03-13 11:43:15.883055",
|
"modified": "2023-04-03 22:55:14.206473",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice",
|
"name": "Sales Invoice",
|
||||||
|
@ -845,7 +845,9 @@ class AccountsController(TransactionBase):
|
|||||||
def set_advances(self):
|
def set_advances(self):
|
||||||
"""Returns list of advances against Account, Party, Reference"""
|
"""Returns list of advances against Account, Party, Reference"""
|
||||||
|
|
||||||
res = self.get_advance_entries()
|
res = self.get_advance_entries(
|
||||||
|
include_unallocated=not cint(self.get("only_include_allocated_payments"))
|
||||||
|
)
|
||||||
|
|
||||||
self.set("advances", [])
|
self.set("advances", [])
|
||||||
advance_allocated = 0
|
advance_allocated = 0
|
||||||
|
@ -55,6 +55,14 @@ frappe.ui.form.on(cur_frm.doctype, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
allocate_advances_automatically: function(frm) {
|
allocate_advances_automatically: function(frm) {
|
||||||
|
frm.trigger('fetch_advances');
|
||||||
|
},
|
||||||
|
|
||||||
|
only_include_allocated_payments: function(frm) {
|
||||||
|
frm.trigger('fetch_advances');
|
||||||
|
},
|
||||||
|
|
||||||
|
fetch_advances: function(frm) {
|
||||||
if(frm.doc.allocate_advances_automatically) {
|
if(frm.doc.allocate_advances_automatically) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user