Added ability to disable auto creation of Sales Invoice when customer pays a payment request (#10706)

This commit is contained in:
Neil Trini Lasrado 2017-09-18 17:12:16 +05:30 committed by Nabin Hait
parent b98359f4a7
commit d258372f9e
4 changed files with 67 additions and 2 deletions

View File

@ -286,6 +286,37 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "If checked, Sales Invoice will not be created when a customer makes a payment against a Payment Request",
"fieldname": "disable_sales_invoice_auto_creation",
"fieldtype": "Check",
"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": "Disable Sales Invoice Auto Creation",
"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,
"unique": 0
}
],
"has_web_view": 0,
@ -299,7 +330,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-06-16 17:39:50.614522",
"modified": "2017-09-06 09:16:53.577666",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",

View File

@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Accounts Settings", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Accounts Settings
() => frappe.tests.make('Accounts Settings', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestAccountsSettings(unittest.TestCase):
pass

View File

@ -92,7 +92,8 @@ class PaymentRequest(Document):
frappe.set_user("Administrator")
payment_entry = self.create_payment_entry()
self.make_invoice()
if not frappe.db.get_single_value("Accounts Settings", "disable_sales_invoice_auto_creation"):
self.make_invoice()
return payment_entry