fix: sider fixes

This commit is contained in:
Anuja Pawar 2021-07-14 15:06:56 +05:30
parent 1dfb5eb535
commit b37ff0d3cf
3 changed files with 21 additions and 22 deletions

View File

@ -8,18 +8,17 @@ frappe.ui.form.on('South Africa VAT Settings', {
filters: { filters: {
country: "South Africa", country: "South Africa",
} }
} };
}); });
frm.set_query("account", "vat_accounts", function(doc, cdt, cdn) { frm.set_query("account", "vat_accounts", function(doc, cdt, cdn) {
var row = locals[cdt][cdn]; var row = locals[cdt][cdn];
console.log(row);
return { return {
filters: { filters: {
company: frm.doc.company, company: frm.doc.company,
account_type: "Tax", account_type: "Tax",
is_group: 0 is_group: 0
} }
} };
}) });
} }
}); });

View File

@ -2,10 +2,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json import frappe
import json
from frappe import _ from frappe import _
from frappe.utils import flt, formatdate, now_datetime, getdate from frappe.utils import formatdate
from datetime import date
def execute(filters=None): def execute(filters=None):
return VATAuditReport(filters).run() return VATAuditReport(filters).run()
@ -39,7 +39,7 @@ class VATAuditReport(object):
return self.columns, self.data return self.columns, self.data
def get_sa_vat_accounts(self): def get_sa_vat_accounts(self):
self.sa_vat_accounts = frappe.get_list("South Africa VAT Account", \ self.sa_vat_accounts = frappe.get_list("South Africa VAT Account",
filters = {"parent":self.filters.company}, pluck="account") filters = {"parent":self.filters.company}, pluck="account")
if not self.sa_vat_accounts and not frappe.flags.in_test and not frappe.flags.in_migrate: if not self.sa_vat_accounts and not frappe.flags.in_test and not frappe.flags.in_migrate:
frappe.throw(_("Please set VAT Accounts in South Africa VAT Settings")) frappe.throw(_("Please set VAT Accounts in South Africa VAT Settings"))
@ -84,7 +84,7 @@ class VATAuditReport(object):
def get_items_based_on_tax_rate(self,doctype): def get_items_based_on_tax_rate(self,doctype):
self.items_based_on_tax_rate = frappe._dict() self.items_based_on_tax_rate = frappe._dict()
self.tax_doctype = "Purchase Taxes and Charges" if doctype=="Purchase Invoice" \ self.tax_doctype = "Purchase Taxes and Charges" if doctype=="Purchase Invoice" \
else "Sales Taxes and Charges" else "Sales Taxes and Charges"
self.tax_details = frappe.db.sql(""" self.tax_details = frappe.db.sql("""
SELECT SELECT
@ -125,10 +125,10 @@ class VATAuditReport(object):
item_amount_map = self.item_tax_rate.setdefault(parent, {}) \ item_amount_map = self.item_tax_rate.setdefault(parent, {}) \
.setdefault(item_code, []) .setdefault(item_code, [])
amount_dict = { amount_dict = {
"tax_rate": tax_rate, "tax_rate": tax_rate,
"gross_amount": gross_amount, "gross_amount": gross_amount,
"tax_amount": tax_amount, "tax_amount": tax_amount,
"net_amount": net_amount "net_amount": net_amount
} }
item_amount_map.append(amount_dict) item_amount_map.append(amount_dict)
@ -139,19 +139,19 @@ class VATAuditReport(object):
for opts in (("company", " and company=%(company)s"), for opts in (("company", " and company=%(company)s"),
("from_date", " and posting_date>=%(from_date)s"), ("from_date", " and posting_date>=%(from_date)s"),
("to_date", " and posting_date<=%(to_date)s")): ("to_date", " and posting_date<=%(to_date)s")):
if self.filters.get(opts[0]): if self.filters.get(opts[0]):
conditions += opts[1] conditions += opts[1]
return conditions return conditions
def get_data(self,doctype): def get_data(self,doctype):
consolidated_data = self.get_consolidated_data() consolidated_data = self.get_consolidated_data()
section_name = _("Purchases ") if doctype == "Purchase Invoice" else _("Sales ") section_name = _("Purchases") if doctype == "Purchase Invoice" else _("Sales")
for rate, section in consolidated_data.items(): for rate, section in consolidated_data.items():
rate = int(rate) rate = int(rate)
label = frappe.bold(_("Standard Rate ") + section_name + str(rate) + "%") label = frappe.bold(_("Standard Rate ") + section_name + " " + str(rate) + "%")
section_head = {"posting_date": label } section_head = {"posting_date": label}
total_gross = total_tax = total_net = 0 total_gross = total_tax = total_net = 0
self.data.append(section_head) self.data.append(section_head)
for row in section.get("data"): for row in section.get("data"):
@ -178,11 +178,11 @@ class VATAuditReport(object):
for item in items: for item in items:
row = {} row = {}
item_details = self.item_tax_rate.get(inv).get(item) item_details = self.item_tax_rate.get(inv).get(item)
row["account"] = inv_data.get("account") row["account"] = inv_data.get("account")
row["posting_date"] = formatdate(inv_data.get("posting_date"), 'dd-mm-yyyy') row["posting_date"] = formatdate(inv_data.get("posting_date"), 'dd-mm-yyyy')
row["invoice_number"] = inv row["invoice_number"] = inv
row["party"] = inv_data.get("party") row["party"] = inv_data.get("party")
row["remarks"] = inv_data.get("remarks") row["remarks"] = inv_data.get("remarks")
row["gross_amount"]= item_details[0].get("gross_amount") row["gross_amount"]= item_details[0].get("gross_amount")
row["tax_amount"]= item_details[0].get("tax_amount") row["tax_amount"]= item_details[0].get("tax_amount")
row["net_amount"]= item_details[0].get("net_amount") row["net_amount"]= item_details[0].get("net_amount")

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, os, json # import frappe, os, json
from frappe.permissions import add_permission, update_permission_property from frappe.permissions import add_permission, update_permission_property
def setup(): def setup():