fix: Add multiple fixes

This commit is contained in:
Deepesh Garg 2021-06-09 22:55:10 +05:30
parent 9e648183db
commit 911818a9e2
9 changed files with 21 additions and 14 deletions

View File

@ -160,7 +160,7 @@
"default": "0",
"fieldname": "included_in_paid_amount",
"fieldtype": "Check",
"label": "Included In Paid Amount"
"label": "Considered In Paid Amount"
},
{
"fieldname": "allocated_amount",
@ -186,7 +186,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-06-08 07:04:44.287002",
"modified": "2021-06-09 11:46:58.373170",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Advance Taxes and Charges",

View File

@ -1133,7 +1133,7 @@ frappe.ui.form.on('Payment Entry', {
let tax_rate = tax.rate;
if (tax.charge_type == "Actual") {
current_tax_fraction = tax.tax_amount/frm.doc.paid_amount_after_tax;
current_tax_fraction = tax.tax_amount/(frm.doc.paid_amount_after_tax + frm.doc.tax_amount);
} else if(tax.charge_type == "On Paid Amount") {
current_tax_fraction = (tax_rate / 100.0);
} else if(tax.charge_type == "On Previous Row Amount") {

View File

@ -681,13 +681,16 @@
"hide_border": 1
},
{
"depends_on": "eval:doc.apply_tax_withholding_amount",
"description": "Provisional tax account for advance tax. Taxes are parked in this account until payments are allocated to invoices",
"fieldname": "advance_tax_account",
"fieldtype": "Link",
"label": "Advance Tax Account",
"mandatory_depends_on": "doc.base_total_taxes_and_charges",
"mandatory_depends_on": "eval:doc.apply_tax_withholding_amount",
"options": "Account"
},
{
"depends_on": "eval:doc.received_amount",
"fieldname": "received_amount_after_tax",
"fieldtype": "Currency",
"label": "Received Amount After Tax",
@ -704,7 +707,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-05-31 01:54:18.378910",
"modified": "2021-06-09 11:55:04.215050",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",

View File

@ -400,6 +400,9 @@ class PaymentEntry(AccountsController):
if not self.apply_tax_withholding_amount:
return
if not self.advance_tax_account:
frappe.throw(_("Advance TDS account is mandatory for advance TDS deduction"))
reference_doclist = []
net_total = self.paid_amount
included_in_paid_amount = 0
@ -916,7 +919,7 @@ class PaymentEntry(AccountsController):
tax_rate = tax.rate
if tax.charge_type == 'Actual':
current_tax_fraction = tax.tax_amount/self.paid_amount_after_tax
current_tax_fraction = tax.tax_amount/ (self.paid_amount_after_tax + tax.tax_amount)
elif tax.charge_type == "On Paid Amount":
current_tax_fraction = tax_rate / 100.0

View File

@ -68,9 +68,6 @@ class PurchaseInvoice(BuyingController):
super(PurchaseInvoice, self).validate()
# apply tax withholding only if checked and applicable
self.set_tax_withholding()
if not self.is_return:
self.po_required()
self.pr_required()

View File

@ -975,6 +975,7 @@ class TestPurchaseInvoice(unittest.TestCase):
# Create Payment Entry Against the order
payment_entry = get_payment_entry(dt='Purchase Order', dn=po.name)
payment_entry.paid_from = 'Cash - _TC'
payment_entry.save()
payment_entry.submit()

View File

@ -221,13 +221,13 @@
"description": "If checked, the tax amount will be considered as already included in the Paid Amount in Payment Entry",
"fieldname": "included_in_paid_amount",
"fieldtype": "Check",
"label": "Included In Paid Amount"
"label": "Considered In Paid Amount"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2021-05-31 03:41:38.298937",
"modified": "2021-06-09 11:48:25.335733",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",

View File

@ -198,14 +198,14 @@
"description": "If checked, the tax amount will be considered as already included in the Paid Amount in Payment Entry",
"fieldname": "included_in_paid_amount",
"fieldtype": "Check",
"label": "Included In Paid Amount"
"label": "Considered In Paid Amount"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-31 05:40:32.856780",
"modified": "2021-06-09 11:48:04.691596",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",

View File

@ -116,6 +116,8 @@ class AccountsController(TransactionBase):
if self.doctype == 'Purchase Invoice':
self.calculate_paid_amount()
# apply tax withholding only if checked and applicable
self.set_tax_withholding()
if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
@ -742,7 +744,8 @@ class AccountsController(TransactionBase):
def allocate_advance_taxes(self, gl_entries):
tax_map = self.get_tax_map()
for pe in self.get("advances"):
if pe.reference_type == "Payment Entry":
if pe.reference_type == "Payment Entry" and \
frappe.db.get_value('Payment Entry', pe.reference_name, 'advance_tax_account'):
pe = frappe.get_doc("Payment Entry", pe.reference_name)
for tax in pe.get("taxes"):
account_currency = get_account_currency(tax.account_head)