Merge branch 'develop' into lms-refactor
This commit is contained in:
commit
318ba2b538
@ -1,5 +1,5 @@
|
||||
<div align="center">
|
||||
<img src="https://raw.githubusercontent.com/frappe/erpnext/develop/erpnext/public/images/erp-icon.svg" height="128">
|
||||
<img src="https://raw.githubusercontent.com/frappe/erpnext/develop/erpnext/public/images/erpnext-logo.png" height="128">
|
||||
<h2>ERPNext</h2>
|
||||
<p align="center">
|
||||
<p>ERP made simple</p>
|
||||
|
@ -30,6 +30,20 @@ frappe.ui.form.on('Payment Entry', {
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.set_query("party_bank_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"is_company_account":0
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.set_query("bank_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"is_company_account":1
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.set_query("contact_person", function() {
|
||||
if (frm.doc.party) {
|
||||
return {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -967,3 +967,37 @@ def get_party_and_account_balance(company, date, paid_from=None, paid_to=None, p
|
||||
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center),
|
||||
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center)
|
||||
})
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_payment_order(source_name, target_doc=None):
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
def set_missing_values(source, target):
|
||||
target.payment_order_type = "Payment Entry"
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
target_doc.bank_account = source_parent.party_bank_account
|
||||
target_doc.amount = source_parent.base_paid_amount
|
||||
target_doc.account = source_parent.paid_to
|
||||
target_doc.payment_entry = source_parent.name
|
||||
target_doc.supplier = source_parent.party
|
||||
target_doc.mode_of_payment = source_parent.mode_of_payment
|
||||
|
||||
|
||||
doclist = get_mapped_doc("Payment Entry", source_name, {
|
||||
"Payment Entry": {
|
||||
"doctype": "Payment Order",
|
||||
"validation": {
|
||||
"docstatus": ["=", 1]
|
||||
}
|
||||
},
|
||||
"Payment Entry Reference": {
|
||||
"doctype": "Payment Order Reference",
|
||||
"validation": {
|
||||
"docstatus": ["=", 1]
|
||||
},
|
||||
"postprocess": update_item
|
||||
},
|
||||
|
||||
}, target_doc, set_missing_values)
|
||||
|
||||
return doclist
|
||||
|
@ -2,23 +2,79 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Payment Order', {
|
||||
setup: function(frm) {
|
||||
frm.set_query("company_bank_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"is_company_account":1
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus == 0) {
|
||||
frm.add_custom_button(__('Payment Request'), function() {
|
||||
frm.trigger("get_from_payment_request");
|
||||
}, __("Get from"));
|
||||
|
||||
frm.add_custom_button(__('Payment Entry'), function() {
|
||||
frm.trigger("get_from_payment_entry");
|
||||
}, __("Get from"));
|
||||
|
||||
frm.trigger('remove_button');
|
||||
}
|
||||
|
||||
// payment Entry
|
||||
if (frm.doc.docstatus==1) {
|
||||
frm.add_custom_button(__('Create Payment Entries'),
|
||||
function() {
|
||||
frm.trigger("make_payment_records");
|
||||
});
|
||||
if (frm.doc.docstatus===1 && frm.doc.payment_order_type==='Payment Request') {
|
||||
frm.add_custom_button(__('Create Payment Entries'), function() {
|
||||
frm.trigger("make_payment_records");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
remove_row_if_empty: function(frm) {
|
||||
// remove if first row is empty
|
||||
if (frm.doc.references.length > 0 && !frm.doc.references[0].reference_name) {
|
||||
frm.doc.references = [];
|
||||
}
|
||||
},
|
||||
|
||||
remove_button: function(frm) {
|
||||
// remove custom button of order type that is not imported
|
||||
|
||||
let label = ["Payment Request", "Payment Entry"];
|
||||
|
||||
if (frm.doc.references.length > 0 && frm.doc.payment_order_type) {
|
||||
label = label.reduce(x => {
|
||||
x!= frm.doc.payment_order_type;
|
||||
return x;
|
||||
});
|
||||
frm.remove_custom_button(label, "Get from");
|
||||
}
|
||||
},
|
||||
|
||||
get_from_payment_entry: function(frm) {
|
||||
frm.trigger("remove_row_if_empty");
|
||||
erpnext.utils.map_current_doc({
|
||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.make_payment_order",
|
||||
source_doctype: "Payment Entry",
|
||||
target: frm,
|
||||
date_field: "posting_date",
|
||||
setters: {
|
||||
party: frm.doc.supplier || ""
|
||||
},
|
||||
get_query_filters: {
|
||||
bank: frm.doc.bank,
|
||||
docstatus: 1,
|
||||
bank_account: frm.doc.company_bank_account,
|
||||
paid_from: frm.doc.account,
|
||||
status: ["=", "Initiated"],
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get_from_payment_request: function(frm) {
|
||||
frm.trigger("remove_row_if_empty");
|
||||
erpnext.utils.map_current_doc({
|
||||
method: "erpnext.accounts.doctype.payment_request.payment_request.make_payment_order",
|
||||
source_doctype: "Payment Request",
|
||||
@ -79,5 +135,4 @@ frappe.ui.form.on('Payment Order', {
|
||||
|
||||
dialog.show();
|
||||
},
|
||||
|
||||
});
|
||||
});
|
@ -1,375 +1,151 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 0,
|
||||
"creation": "2018-07-20 16:43:08.505978",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"autoname": "naming_series:",
|
||||
"creation": "2018-07-20 16:43:08.505978",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"naming_series",
|
||||
"company",
|
||||
"payment_order_type",
|
||||
"party",
|
||||
"column_break_2",
|
||||
"posting_date",
|
||||
"company_bank",
|
||||
"company_bank_account",
|
||||
"account",
|
||||
"section_break_5",
|
||||
"references",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "PMO-",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Series",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "PMO-",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "PMO-",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 1,
|
||||
"options": "PMO-",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "party",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"depends_on": "eval: doc.payment_order_type=='Payment Request';",
|
||||
"fieldname": "party",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Supplier",
|
||||
"options": "Supplier"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Today",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Posting Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "Today",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "bank",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Bank",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Bank",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"allow_bulk_edit": 1,
|
||||
"fieldname": "references",
|
||||
"fieldtype": "Table",
|
||||
"label": "Payment Order Reference",
|
||||
"options": "Payment Order Reference",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "references",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Payment Order Reference",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Order Reference",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Payment Order",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Payment Order",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "payment_order_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Payment Order Type",
|
||||
"options": "\nPayment Request\nPayment Entry",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "company_bank_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company Bank Account",
|
||||
"options": "Bank Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "company_bank_account",
|
||||
"fetch_from": "company_bank_account.bank",
|
||||
"fieldname": "company_bank",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Bank",
|
||||
"options": "Bank"
|
||||
},
|
||||
{
|
||||
"depends_on": "company_bank_account",
|
||||
"fetch_from": "company_bank_account.account",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Data",
|
||||
"label": "Account"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-07-31 18:48:00.681271",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Order",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-05-14 17:12:24.912666",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Order",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -11,18 +11,20 @@ from frappe.model.document import Document
|
||||
|
||||
class PaymentOrder(Document):
|
||||
def on_submit(self):
|
||||
self.update_payment_request_status()
|
||||
self.update_payment_status()
|
||||
|
||||
def on_cancel(self):
|
||||
self.update_payment_request_status(cancel=True)
|
||||
self.update_payment_status(cancel=True)
|
||||
|
||||
def update_payment_request_status(self, cancel=False):
|
||||
def update_payment_status(self, cancel=False):
|
||||
status = 'Payment Ordered'
|
||||
if cancel:
|
||||
status = 'Initiated'
|
||||
|
||||
ref_field = "status" if self.payment_order_type == "Payment Request" else "payment_order_status"
|
||||
|
||||
for d in self.references:
|
||||
frappe.db.set_value('Payment Request', d.payment_request, 'status', status)
|
||||
frappe.db.set_value(self.payment_order_type, d.get(frappe.scrub(self.payment_order_type)), ref_field, status)
|
||||
|
||||
def get_mop_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql(""" select mode_of_payment from `tabPayment Order Reference`
|
||||
@ -60,7 +62,7 @@ def make_journal_entry(doc, supplier, mode_of_payment=None):
|
||||
je.voucher_type = 'Bank Entry'
|
||||
if mode_of_payment and mode_of_payment_type.get(mode_of_payment) == 'Cash':
|
||||
je.voucher_type = "Cash Entry"
|
||||
|
||||
|
||||
paid_amt = 0
|
||||
party_account = get_party_account('Supplier', supplier, doc.company)
|
||||
for d in doc.references:
|
||||
@ -84,4 +86,4 @@ def make_journal_entry(doc, supplier, mode_of_payment=None):
|
||||
|
||||
je.flags.ignore_mandatory = True
|
||||
je.save()
|
||||
frappe.msgprint(_("{0} {1} created").format(je.doctype, je.name))
|
||||
frappe.msgprint(_("{0} {1} created").format(je.doctype, je.name))
|
29
erpnext/accounts/doctype/payment_order/regional/india.js
Normal file
29
erpnext/accounts/doctype/payment_order/regional/india.js
Normal file
@ -0,0 +1,29 @@
|
||||
frappe.ui.form.on('Payment Order', {
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus==1 && frm.doc.payment_order_type==='Payment Entry') {
|
||||
frm.add_custom_button(__('Generate Text File'), function() {
|
||||
frm.trigger("generate_text_and_download_file");
|
||||
});
|
||||
}
|
||||
},
|
||||
generate_text_and_download_file: (frm) => {
|
||||
return frappe.call({
|
||||
method: "erpnext.regional.india.bank_remittance_txt.generate_report",
|
||||
args: {
|
||||
name: frm.doc.name
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
{
|
||||
frm.reload_doc();
|
||||
const a = document.createElement('a');
|
||||
let file_obj = r.message;
|
||||
a.href = file_obj.file_url;
|
||||
a.target = '_blank';
|
||||
a.download = file_obj.file_name;
|
||||
a.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -1,433 +1,126 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2018-07-20 16:38:06.630813",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"creation": "2018-07-20 16:38:06.630813",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"reference_doctype",
|
||||
"reference_name",
|
||||
"amount",
|
||||
"column_break_4",
|
||||
"supplier",
|
||||
"payment_request",
|
||||
"payment_entry",
|
||||
"mode_of_payment",
|
||||
"bank_account_details",
|
||||
"bank_account",
|
||||
"column_break_10",
|
||||
"account",
|
||||
"payment_reference"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "reference_doctype",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "reference_doctype",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"options": "DocType",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "reference_doctype",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Name",
|
||||
"options": "reference_doctype",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Supplier",
|
||||
"options": "Supplier",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "payment_request",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Payment Request",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Request",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "payment_request",
|
||||
"fieldtype": "Link",
|
||||
"label": "Payment Request",
|
||||
"options": "Payment Request",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "payment_request.mode_of_payment",
|
||||
"fieldname": "mode_of_payment",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Mode of Payment",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Mode of Payment",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fetch_from": "payment_request.mode_of_payment",
|
||||
"fieldname": "mode_of_payment",
|
||||
"fieldtype": "Link",
|
||||
"label": "Mode of Payment",
|
||||
"options": "Mode of Payment",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "bank_account_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Bank Account Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "bank_account_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Bank Account Details"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "bank_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Bank Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Bank Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "bank_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Bank Account",
|
||||
"options": "Bank Account",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_10",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_10",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Account",
|
||||
"options": "Account",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "payment_reference",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Payment Reference",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "payment_reference",
|
||||
"fieldtype": "Data",
|
||||
"label": "Payment Reference",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "payment_entry",
|
||||
"fieldtype": "Link",
|
||||
"label": "Payment Entry",
|
||||
"options": "Payment Entry",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-07-31 17:21:37.698644",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Order Reference",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"istable": 1,
|
||||
"modified": "2019-05-08 13:56:25.724557",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Order Reference",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -14,7 +14,6 @@ from frappe.integrations.utils import get_payment_gateway_controller
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
from erpnext.erpnext_integrations.stripe_integration import create_stripe_subscription
|
||||
from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
class PaymentRequest(Document):
|
||||
def validate(self):
|
||||
@ -426,7 +425,9 @@ def get_subscription_details(reference_doctype, reference_name):
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_payment_order(source_name, target_doc=None):
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
def set_missing_values(source, target):
|
||||
target.payment_order_type = "Payment Request"
|
||||
target.append('references', {
|
||||
'reference_doctype': source.reference_doctype,
|
||||
'reference_name': source.reference_name,
|
||||
@ -444,4 +445,4 @@ def make_payment_order(source_name, target_doc=None):
|
||||
}
|
||||
}, target_doc, set_missing_values)
|
||||
|
||||
return doclist
|
||||
return doclist
|
@ -463,8 +463,8 @@ def get_timeline_data(doctype, name):
|
||||
after = add_years(None, -1).strftime('%Y-%m-%d')
|
||||
group_by='group by date(creation)'
|
||||
|
||||
data = get_communication_data(doctype, name,
|
||||
fields=fields, after=after, group_by=group_by, as_dict=False)
|
||||
data = get_communication_data(doctype, name, after=after, group_by='group by date(`tabCommunication`.creation)',
|
||||
fields='date(`tabCommunication`.creation), count(`tabCommunication`.name)',as_dict=False)
|
||||
|
||||
# fetch and append data from Activity Log
|
||||
data += frappe.db.sql("""select {fields}
|
||||
|
@ -211,6 +211,11 @@ frappe.query_reports["General Ledger"] = {
|
||||
"label": __("Currency"),
|
||||
"fieldtype": "Select",
|
||||
"options": erpnext.get_presentation_currency_list()
|
||||
},
|
||||
{
|
||||
"fieldname": "show_opening_entries",
|
||||
"label": __("Show Opening Entries"),
|
||||
"fieldtype": "Check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -283,7 +283,8 @@ def get_accountwise_gle(filters, gl_entries, gle_map):
|
||||
|
||||
from_date, to_date = getdate(filters.from_date), getdate(filters.to_date)
|
||||
for gle in gl_entries:
|
||||
if gle.posting_date < from_date or cstr(gle.is_opening) == "Yes":
|
||||
if (gle.posting_date < from_date or
|
||||
(cstr(gle.is_opening) == "Yes" and not filters.get("show_opening_entries"))):
|
||||
update_value_in_dict(gle_map[gle.get(group_by)].totals, 'opening', gle)
|
||||
update_value_in_dict(totals, 'opening', gle)
|
||||
|
||||
|
@ -17,6 +17,13 @@ frappe.ui.form.on("Supplier", {
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.set_query("default_bank_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"is_company_account":1
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh: function (frm) {
|
||||
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Supplier' }
|
||||
|
@ -80,6 +80,7 @@ class StockController(AccountsController):
|
||||
"cost_center": item_row.cost_center,
|
||||
"remarks": self.get("remarks") or "Accounting Entry for Stock",
|
||||
"debit": flt(sle.stock_value_difference, 2),
|
||||
"is_opening": item_row.get("is_opening"),
|
||||
}, warehouse_account[sle.warehouse]["account_currency"]))
|
||||
|
||||
# to target warehouse / expense account
|
||||
@ -89,7 +90,8 @@ class StockController(AccountsController):
|
||||
"cost_center": item_row.cost_center,
|
||||
"remarks": self.get("remarks") or "Accounting Entry for Stock",
|
||||
"credit": flt(sle.stock_value_difference, 2),
|
||||
"project": item_row.get("project") or self.get("project")
|
||||
"project": item_row.get("project") or self.get("project"),
|
||||
"is_opening": item_row.get("is_opening")
|
||||
}))
|
||||
elif sle.warehouse not in warehouse_with_no_account:
|
||||
warehouse_with_no_account.append(sle.warehouse)
|
||||
@ -123,8 +125,17 @@ class StockController(AccountsController):
|
||||
|
||||
def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
|
||||
if self.doctype == "Stock Reconciliation":
|
||||
return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account,
|
||||
"cost_center": default_cost_center }) for voucher_detail_no, sle in sle_map.items()]
|
||||
reconciliation_purpose = frappe.db.get_value(self.doctype, self.name, "purpose")
|
||||
is_opening = "Yes" if reconciliation_purpose == "Opening Stock" else "No"
|
||||
details = []
|
||||
for voucher_detail_no, sle in sle_map.items():
|
||||
details.append(frappe._dict({
|
||||
"name": voucher_detail_no,
|
||||
"expense_account": default_expense_account,
|
||||
"cost_center": default_cost_center,
|
||||
"is_opening": is_opening
|
||||
}))
|
||||
return details
|
||||
else:
|
||||
details = self.get("items")
|
||||
|
||||
|
@ -110,7 +110,7 @@ class Lead(SellingController):
|
||||
def set_lead_name(self):
|
||||
if not self.lead_name:
|
||||
# Check for leads being created through data import
|
||||
if not self.company_name:
|
||||
if not self.company_name and not self.flags.ignore_mandatory:
|
||||
frappe.throw(_("A Lead requires either a person's name or an organization's name"))
|
||||
|
||||
self.lead_name = self.company_name
|
||||
|
@ -15,11 +15,11 @@ class TrainingFeedback(Document):
|
||||
|
||||
def on_submit(self):
|
||||
training_event = frappe.get_doc("Training Event", self.training_event)
|
||||
status = None
|
||||
event_status = None
|
||||
for e in training_event.employees:
|
||||
if e.employee == self.employee:
|
||||
status = 'Feedback Submitted'
|
||||
event_status = 'Feedback Submitted'
|
||||
break
|
||||
|
||||
if status:
|
||||
frappe.db.set_value("Training Event", self.training_event, "status", status)
|
||||
if event_status:
|
||||
frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)
|
||||
|
@ -602,3 +602,4 @@ erpnext.patches.v11_1.set_salary_details_submittable
|
||||
erpnext.patches.v11_1.rename_depends_on_lwp
|
||||
execute:frappe.delete_doc("Report", "Inactive Items")
|
||||
erpnext.patches.v11_1.delete_scheduling_tool
|
||||
erpnext.patches.v12_0.make_custom_fields_for_bank_remittance
|
@ -0,0 +1,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.regional.india.setup import make_custom_fields
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
make_custom_fields()
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
BIN
erpnext/public/images/erpnext-logo.png
Normal file
BIN
erpnext/public/images/erpnext-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
190
erpnext/regional/india/bank_remittance.py
Normal file
190
erpnext/regional/india/bank_remittance.py
Normal file
@ -0,0 +1,190 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cint,cstr, today
|
||||
from frappe import _
|
||||
import re
|
||||
import datetime
|
||||
from collections import OrderedDict
|
||||
|
||||
def create_bank_remittance_txt(name):
|
||||
payment_order = frappe.get_cached_doc("Payment Order", name)
|
||||
|
||||
no_of_records = len(payment_order.get("references"))
|
||||
total_amount = sum(entry.get("amount") for entry in payment_order.get("references"))
|
||||
|
||||
product_code, client_code, company_email = frappe.db.get_value("Company",
|
||||
filters={'name' : payment_order.company},
|
||||
fieldname=['product_code', 'client_code', 'email'])
|
||||
|
||||
header, file_name = get_header_row(payment_order, client_code)
|
||||
batch = get_batch_row(payment_order, no_of_records, total_amount, product_code)
|
||||
|
||||
detail = []
|
||||
for ref_doc in payment_order.get("references"):
|
||||
detail += get_detail_row(ref_doc, payment_order, company_email)
|
||||
|
||||
trailer = get_trailer_row(no_of_records, total_amount)
|
||||
detail_records = "\n".join(detail)
|
||||
|
||||
return "\n".join([header, batch, detail_records, trailer]), file_name
|
||||
|
||||
@frappe.whitelist()
|
||||
def generate_report(name):
|
||||
data, file_name = create_bank_remittance_txt(name)
|
||||
|
||||
f = frappe.get_doc({
|
||||
'doctype': 'File',
|
||||
'file_name': file_name,
|
||||
'content': data,
|
||||
"attached_to_doctype": 'Payment Order',
|
||||
"attached_to_name": name,
|
||||
'is_private': True
|
||||
})
|
||||
f.save()
|
||||
return {
|
||||
'file_url': f.file_url,
|
||||
'file_name': file_name
|
||||
}
|
||||
|
||||
def generate_file_name(name, company_account, date):
|
||||
''' generate file name with format (account_code)_mmdd_(payment_order_no) '''
|
||||
bank, acc_no = frappe.db.get_value("Bank Account", {"name": company_account}, ['bank', 'bank_account_no'])
|
||||
return bank[:1]+str(acc_no)[-4:]+'_'+date.strftime("%m%d")+sanitize_data(name, '')[4:]+'.txt'
|
||||
|
||||
def get_header_row(doc, client_code):
|
||||
''' Returns header row and generated file name '''
|
||||
file_name = generate_file_name(doc.name, doc.company_bank_account, doc.posting_date)
|
||||
header = ["H"]
|
||||
header.append(validate_field_size(client_code, "Client Code", 20))
|
||||
header += [''] * 3
|
||||
header.append(validate_field_size(file_name, "File Name", 20))
|
||||
return "~".join(header), file_name
|
||||
|
||||
def get_batch_row(doc, no_of_records, total_amount, product_code):
|
||||
batch = ["B"]
|
||||
batch.append(validate_field_size(no_of_records, "No Of Records", 5))
|
||||
batch.append(validate_amount(format(total_amount, '0.2f'), 17))
|
||||
batch.append(sanitize_data(doc.name, '_')[:20])
|
||||
batch.append(format_date(doc.posting_date))
|
||||
batch.append(validate_field_size(product_code,"Product Code", 20))
|
||||
return "~".join(batch)
|
||||
|
||||
def get_detail_row(ref_doc, payment_entry, company_email):
|
||||
|
||||
payment_date = format_date(payment_entry.posting_date)
|
||||
payment_entry = frappe.get_cached_doc('Payment Entry', ref_doc.payment_entry)
|
||||
supplier_bank_details = frappe.get_cached_doc('Bank Account', ref_doc.bank_account)
|
||||
company_bank_acc_no = frappe.db.get_value("Bank Account", {'name': payment_entry.bank_account}, ['bank_account_no'])
|
||||
|
||||
addr_link = frappe.db.get_value('Dynamic Link',
|
||||
{
|
||||
'link_doctype': 'Supplier',
|
||||
'link_name': 'Sample Supplier',
|
||||
'parenttype':'Address',
|
||||
'parent': ('like', '%-Billing')
|
||||
}, 'parent')
|
||||
|
||||
supplier_billing_address = frappe.get_cached_doc('Address', addr_link)
|
||||
email = ','.join(filter(None, [supplier_billing_address.email_id, company_email]))
|
||||
|
||||
detail = OrderedDict(
|
||||
record_identifier='D',
|
||||
payment_ref_no=sanitize_data(ref_doc.payment_entry),
|
||||
payment_type=cstr(payment_entry.mode_of_payment)[:10],
|
||||
amount=str(validate_amount(format(ref_doc.amount, '.2f'),13)),
|
||||
payment_date=payment_date,
|
||||
instrument_date=payment_date,
|
||||
instrument_number='',
|
||||
dr_account_no_client=str(validate_field_size(company_bank_acc_no, "Company Bank Account", 20)),
|
||||
dr_description='',
|
||||
dr_ref_no='',
|
||||
cr_ref_no='',
|
||||
bank_code_indicator='M',
|
||||
beneficiary_code='',
|
||||
beneficiary_name=sanitize_data(validate_information(payment_entry, "party", 160), ' '),
|
||||
beneficiary_bank=sanitize_data(validate_information(supplier_bank_details, "bank", 10)),
|
||||
beneficiary_branch_code=cstr(validate_information(supplier_bank_details, "branch_code", 11)),
|
||||
beneficiary_acc_no=validate_information(supplier_bank_details, "bank_account_no", 20),
|
||||
location='',
|
||||
print_location='',
|
||||
beneficiary_address_1=validate_field_size(sanitize_data(cstr(supplier_billing_address.address_line1), ' '), " Beneficiary Address 1", 50),
|
||||
beneficiary_address_2=validate_field_size(sanitize_data(cstr(supplier_billing_address.address_line2), ' '), " Beneficiary Address 2", 50),
|
||||
beneficiary_address_3='',
|
||||
beneficiary_address_4='',
|
||||
beneficiary_address_5='',
|
||||
beneficiary_city=validate_field_size(cstr(supplier_billing_address.city), "Beneficiary City", 20),
|
||||
beneficiary_zipcode=validate_field_size(cstr(supplier_billing_address.pincode), "Pin Code", 6),
|
||||
beneficiary_state=validate_field_size(cstr(supplier_billing_address.state), "Beneficiary State", 20),
|
||||
beneficiary_email=cstr(email)[:255],
|
||||
beneficiary_mobile=validate_field_size(cstr(supplier_billing_address.phone), "Beneficiary Mobile", 10),
|
||||
payment_details_1='',
|
||||
payment_details_2='',
|
||||
payment_details_3='',
|
||||
payment_details_4='',
|
||||
delivery_mode=''
|
||||
)
|
||||
detail_record = ["~".join(list(detail.values()))]
|
||||
|
||||
detail_record += get_advice_rows(payment_entry)
|
||||
return detail_record
|
||||
|
||||
def get_advice_rows(payment_entry):
|
||||
''' Returns multiple advice rows for a single detail entry '''
|
||||
payment_entry_date = payment_entry.posting_date.strftime("%b%y%d%m").upper()
|
||||
mode_of_payment = payment_entry.mode_of_payment
|
||||
advice_rows = []
|
||||
for record in payment_entry.references:
|
||||
advice = ['E']
|
||||
advice.append(cstr(mode_of_payment))
|
||||
advice.append(cstr(record.total_amount))
|
||||
advice.append('')
|
||||
advice.append(cstr(record.outstanding_amount))
|
||||
advice.append(record.reference_name)
|
||||
advice.append(format_date(record.due_date))
|
||||
advice.append(payment_entry_date)
|
||||
advice_rows.append("~".join(advice))
|
||||
return advice_rows
|
||||
|
||||
def get_trailer_row(no_of_records, total_amount):
|
||||
''' Returns trailer row '''
|
||||
trailer = ["T"]
|
||||
trailer.append(validate_field_size(no_of_records, "No of Records", 5))
|
||||
trailer.append(validate_amount(format(total_amount, "0.2f"), 17))
|
||||
return "~".join(trailer)
|
||||
|
||||
def sanitize_data(val, replace_str=''):
|
||||
''' Remove all the non-alphanumeric characters from string '''
|
||||
pattern = re.compile('[\W_]+')
|
||||
return pattern.sub(replace_str, val)
|
||||
|
||||
def format_date(val):
|
||||
''' Convert a datetime object to DD/MM/YYYY format '''
|
||||
return val.strftime("%d/%m/%Y")
|
||||
|
||||
def validate_amount(val, max_int_size):
|
||||
''' Validate amount to be within the allowed limits '''
|
||||
int_size = len(str(val).split('.')[0])
|
||||
|
||||
if int_size > max_int_size:
|
||||
frappe.throw(_("Amount for a single transaction exceeds maximum allowed amount, create a separate payment order by splitting the transactions"))
|
||||
|
||||
return val
|
||||
|
||||
def validate_information(obj, attr, max_size):
|
||||
''' Checks if the information is not set in the system and is within the size '''
|
||||
if hasattr(obj, attr):
|
||||
return validate_field_size(getattr(obj, attr), frappe.unscrub(attr), max_size)
|
||||
|
||||
else:
|
||||
frappe.throw(_("{0} is mandatory for generating remittance payments, set the field and try again".format(frappe.unscrub(attr))))
|
||||
|
||||
def validate_field_size(val, label, max_size):
|
||||
''' check the size of the val '''
|
||||
if len(cstr(val)) > max_size:
|
||||
frappe.throw(_("{0} field is limited to size {1}".format(label, max_size)))
|
||||
return cstr(val)
|
@ -281,7 +281,15 @@ def make_custom_fields(update=True):
|
||||
dict(fieldname='hra_component', label='HRA Component',
|
||||
fieldtype='Link', options='Salary Component', insert_after='basic_component'),
|
||||
dict(fieldname='arrear_component', label='Arrear Component',
|
||||
fieldtype='Link', options='Salary Component', insert_after='hra_component')
|
||||
fieldtype='Link', options='Salary Component', insert_after='hra_component'),
|
||||
dict(fieldname='bank_remittance_section', label='Bank Remittance Settings',
|
||||
fieldtype='Section Break', collapsible=1, insert_after='arrear_component'),
|
||||
dict(fieldname='client_code', label='Client Code', fieldtype='Data',
|
||||
insert_after='bank_remittance_section'),
|
||||
dict(fieldname='remittance_column_break', fieldtype='Column Break',
|
||||
insert_after='client_code'),
|
||||
dict(fieldname='product_code', label='Product Code', fieldtype='Data',
|
||||
insert_after='remittance_column_break'),
|
||||
],
|
||||
'Employee Tax Exemption Declaration':[
|
||||
dict(fieldname='hra_section', label='HRA Exemption',
|
||||
@ -566,4 +574,4 @@ def get_tds_details(accounts, fiscal_year):
|
||||
doctype="Tax Withholding Category", accounts=accounts,
|
||||
rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20,
|
||||
"single_threshold": 2500, "cumulative_threshold": 0}])
|
||||
]
|
||||
]
|
@ -75,7 +75,7 @@ def prepare_invoice(invoice, progressive_number):
|
||||
invoice.tax_data = tax_data
|
||||
|
||||
#Check if stamp duty (Bollo) of 2 EUR exists.
|
||||
stamp_duty_charge_row = next((tax for tax in invoice.taxes if tax.charge_type == _("Actual") and tax.tax_amount == 2.0 ), None)
|
||||
stamp_duty_charge_row = next((tax for tax in invoice.taxes if tax.charge_type == "Actual" and tax.tax_amount == 2.0 ), None)
|
||||
if stamp_duty_charge_row:
|
||||
invoice.stamp_duty = stamp_duty_charge_row.tax_amount
|
||||
|
||||
@ -222,7 +222,7 @@ def sales_invoice_validate(doc):
|
||||
#Validate customer details
|
||||
customer = frappe.get_doc("Customer", doc.customer)
|
||||
|
||||
if customer.customer_type == _("Individual"):
|
||||
if customer.customer_type == "Individual":
|
||||
doc.customer_fiscal_code = customer.fiscal_code
|
||||
if not doc.customer_fiscal_code:
|
||||
frappe.throw(_("Please set Fiscal Code for the customer '%s'" % doc.customer), title=_("E-Invoicing Information Missing"))
|
||||
|
@ -113,8 +113,9 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non
|
||||
data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1)
|
||||
data = adjust_qty_for_expired_items(data)
|
||||
|
||||
for item in data:
|
||||
set_product_info_for_website(item)
|
||||
if cint(frappe.db.get_single_value("Shopping Cart Settings", "enabled")):
|
||||
for item in data:
|
||||
set_product_info_for_website(item)
|
||||
|
||||
return data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user