[flat discount] implemented flat discount on client side
This commit is contained in:
parent
63aa5fd673
commit
c53dbc7cdf
@ -193,6 +193,56 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEquals(si.doc.grand_total, 1500)
|
self.assertEquals(si.doc.grand_total, 1500)
|
||||||
self.assertEquals(si.doc.grand_total_export, 1500)
|
self.assertEquals(si.doc.grand_total_export, 1500)
|
||||||
|
|
||||||
|
def test_flat_discount_gl_entry(self):
|
||||||
|
si = webnotes.bean(copy=test_records[3])
|
||||||
|
si.doc.flat_discount = 104.95
|
||||||
|
si.doclist.append({
|
||||||
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
"parentfield": "other_charges",
|
||||||
|
"charge_type": "On Previous Row Amount",
|
||||||
|
"account_head": "_Test Account Service Tax - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Service Tax",
|
||||||
|
"rate": 10,
|
||||||
|
"row_id": 8,
|
||||||
|
"idx": 9
|
||||||
|
})
|
||||||
|
si.insert()
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||||
|
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
|
||||||
|
order by account asc""", si.doc.name, as_dict=1)
|
||||||
|
|
||||||
|
self.assertTrue(gl_entries)
|
||||||
|
|
||||||
|
expected_values = sorted([
|
||||||
|
[si.doc.debit_to, 1500, 0.0],
|
||||||
|
[test_records[3][1]["income_account"], 0.0, 1163.45],
|
||||||
|
[test_records[3][3]["account_head"], 0.0, 130.31],
|
||||||
|
[test_records[3][4]["account_head"], 0.0, 2.61],
|
||||||
|
[test_records[3][5]["account_head"], 0.0, 1.31],
|
||||||
|
[test_records[3][6]["account_head"], 0.0, 25.96],
|
||||||
|
[test_records[3][7]["account_head"], 0.0, 145.43],
|
||||||
|
[test_records[3][8]["account_head"], 0.0, 116.35],
|
||||||
|
[test_records[3][9]["account_head"], 0.0, 100],
|
||||||
|
[test_records[3][10]["account_head"], 168.54, 0.0],
|
||||||
|
["_Test Account Service Tax - _TC", 16.88, 0.0],
|
||||||
|
])
|
||||||
|
|
||||||
|
for i, gle in enumerate(gl_entries):
|
||||||
|
self.assertEquals(expected_values[i][0], gle.account)
|
||||||
|
self.assertEquals(expected_values[i][1], gle.debit)
|
||||||
|
self.assertEquals(expected_values[i][2], gle.credit)
|
||||||
|
|
||||||
|
# cancel
|
||||||
|
si.cancel()
|
||||||
|
|
||||||
|
gle = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||||
|
where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
|
||||||
|
|
||||||
|
self.assertFalse(gle)
|
||||||
|
|
||||||
def test_inclusive_rate_validations(self):
|
def test_inclusive_rate_validations(self):
|
||||||
si = webnotes.bean(copy=test_records[2])
|
si = webnotes.bean(copy=test_records[2])
|
||||||
for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})):
|
for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})):
|
||||||
@ -418,7 +468,6 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
|
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
|
||||||
order by account asc, debit asc""", si.doc.name, as_dict=1)
|
order by account asc, debit asc""", si.doc.name, as_dict=1)
|
||||||
self.assertTrue(gl_entries)
|
self.assertTrue(gl_entries)
|
||||||
# print gl_entries
|
|
||||||
|
|
||||||
stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"})
|
stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"})
|
||||||
|
|
||||||
|
@ -360,6 +360,14 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.frm.tax_doclist.length) {
|
||||||
|
if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_flat_discount", this.frm.doctype)) {
|
||||||
|
$.each(this.frm.tax_doclist, function(i, tax) {
|
||||||
|
delete tax["tax_amount_after_flat_discount"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
calculate_outstanding_amount: function() {
|
calculate_outstanding_amount: function() {
|
||||||
|
@ -227,11 +227,11 @@ class AccountsController(TransactionBase):
|
|||||||
"charge_type": tax.charge_type,
|
"charge_type": tax.charge_type,
|
||||||
}, raise_exception=True)
|
}, raise_exception=True)
|
||||||
elif tax.charge_type == "On Previous Row Amount" and \
|
elif tax.charge_type == "On Previous Row Amount" and \
|
||||||
not cint(self.tax_doclist[tax.row_id - 1].included_in_print_rate):
|
not cint(self.tax_doclist[cint(tax.row_id) - 1].included_in_print_rate):
|
||||||
# referred row should also be inclusive
|
# referred row should also be inclusive
|
||||||
_on_previous_row_error(tax.row_id)
|
_on_previous_row_error(tax.row_id)
|
||||||
elif tax.charge_type == "On Previous Row Total" and \
|
elif tax.charge_type == "On Previous Row Total" and \
|
||||||
not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:tax.row_id - 1]]):
|
not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:cint(tax.row_id) - 1]]):
|
||||||
# all rows about the reffered tax should be inclusive
|
# all rows about the reffered tax should be inclusive
|
||||||
_on_previous_row_error("1 - %d" % (tax.row_id,))
|
_on_previous_row_error("1 - %d" % (tax.row_id,))
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
# Adjust divisional loss to the last item
|
# Adjust divisional loss to the last item
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
actual_tax_dict[tax.idx] -= current_tax_amount;
|
actual_tax_dict[tax.idx] -= current_tax_amount
|
||||||
if n == len(self.item_doclist) - 1:
|
if n == len(self.item_doclist) - 1:
|
||||||
current_tax_amount += actual_tax_dict[tax.idx]
|
current_tax_amount += actual_tax_dict[tax.idx]
|
||||||
|
|
||||||
@ -284,23 +284,28 @@ class AccountsController(TransactionBase):
|
|||||||
flt(self.tax_doclist[i-1].grand_total_for_current_item +
|
flt(self.tax_doclist[i-1].grand_total_for_current_item +
|
||||||
current_tax_amount, self.precision("total", tax))
|
current_tax_amount, self.precision("total", tax))
|
||||||
|
|
||||||
|
|
||||||
# in tax.total, accumulate grand total of each item
|
# in tax.total, accumulate grand total of each item
|
||||||
tax.total += tax.grand_total_for_current_item
|
tax.total += tax.grand_total_for_current_item
|
||||||
|
|
||||||
# set precision in the last item iteration
|
# set precision in the last item iteration
|
||||||
if n == len(self.item_doclist) - 1:
|
if n == len(self.item_doclist) - 1:
|
||||||
tax.total = flt(tax.total, self.precision("total", tax))
|
self.round_off_totals(tax)
|
||||||
tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax))
|
|
||||||
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount,
|
|
||||||
self.precision("tax_amount", tax))
|
|
||||||
|
|
||||||
# adjust discount loss in last tax iteration
|
# adjust flat discount loss in last tax iteration
|
||||||
if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied:
|
if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied:
|
||||||
flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total
|
self.adjust_flat_discount_loss(tax)
|
||||||
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount +
|
|
||||||
flat_discount_loss, self.precision("tax_amount", tax))
|
def round_off_totals(self, tax):
|
||||||
tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax))
|
tax.total = flt(tax.total, self.precision("total", tax))
|
||||||
|
tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax))
|
||||||
|
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount,
|
||||||
|
self.precision("tax_amount", tax))
|
||||||
|
|
||||||
|
def adjust_flat_discount_loss(self, tax):
|
||||||
|
flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total
|
||||||
|
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount +
|
||||||
|
flat_discount_loss, self.precision("tax_amount", tax))
|
||||||
|
tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax))
|
||||||
|
|
||||||
def get_current_tax_amount(self, item, tax, item_tax_map):
|
def get_current_tax_amount(self, item, tax, item_tax_map):
|
||||||
tax_rate = self._get_tax_rate(tax, item_tax_map)
|
tax_rate = self._get_tax_rate(tax, item_tax_map)
|
||||||
|
@ -533,12 +533,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
$.each(this.frm.tax_doclist, function(i, tax) {
|
$.each(this.frm.tax_doclist, function(i, tax) {
|
||||||
tax.item_wise_tax_detail = {};
|
tax.item_wise_tax_detail = {};
|
||||||
tax_fields = ["total", "tax_amount_for_current_item", "grand_total_for_current_item",
|
tax_fields = ["total", "tax_amount_after_flat_discount",
|
||||||
|
"tax_amount_for_current_item", "grand_total_for_current_item",
|
||||||
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
|
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
|
||||||
|
|
||||||
if (me.flat_discount_applied)
|
if (!me.flat_discount_applied)
|
||||||
tax_fields.push("tax_amount_after_flat_discount");
|
|
||||||
else
|
|
||||||
tax_fields.push("tax_amount");
|
tax_fields.push("tax_amount");
|
||||||
|
|
||||||
$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
|
$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
|
||||||
@ -551,6 +550,14 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
calculate_taxes: function() {
|
calculate_taxes: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
var actual_tax_dict = {};
|
||||||
|
|
||||||
|
// maintain actual tax rate based on idx
|
||||||
|
$.each(this.frm.tax_doclist, function(i, tax) {
|
||||||
|
if (tax.charge_type == "Actual") {
|
||||||
|
actual_tax_dict[tax.idx] = flt(tax.rate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.each(this.frm.item_doclist, function(n, item) {
|
$.each(this.frm.item_doclist, function(n, item) {
|
||||||
var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
|
var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
|
||||||
@ -559,27 +566,26 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
// tax_amount represents the amount of tax for the current step
|
// tax_amount represents the amount of tax for the current step
|
||||||
var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
|
var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
|
||||||
|
|
||||||
me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount);
|
// Adjust divisional loss to the last item
|
||||||
|
if (tax.charge_type == "Actual") {
|
||||||
// case when net total is 0 but there is an actual type charge
|
actual_tax_dict[tax.idx] -= current_tax_amount;
|
||||||
// in this case add the actual amount to tax.tax_amount
|
if (n == me.frm.item_doclist.length - 1) {
|
||||||
// and tax.grand_total_for_current_item for the first such iteration
|
current_tax_amount += actual_tax_dict[tax.idx]
|
||||||
if(tax.charge_type == "Actual" &&
|
|
||||||
!(current_tax_amount || me.frm.doc.net_total || tax.tax_amount)) {
|
|
||||||
var zero_net_total_adjustment = flt(tax.rate, precision("tax_amount", tax));
|
|
||||||
current_tax_amount += zero_net_total_adjustment;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount);
|
||||||
|
|
||||||
// store tax_amount for current item as it will be used for
|
// store tax_amount for current item as it will be used for
|
||||||
// charge type = 'On Previous Row Amount'
|
// charge type = 'On Previous Row Amount'
|
||||||
tax.tax_amount_for_current_item = current_tax_amount;
|
tax.tax_amount_for_current_item = current_tax_amount;
|
||||||
|
|
||||||
// accumulate tax amount into tax.tax_amount
|
// accumulate tax amount into tax.tax_amount
|
||||||
if (me.flat_discount_applied)
|
if (!me.flat_discount_applied)
|
||||||
tax.tax_amount_after_flat_discount += current_tax_amount;
|
|
||||||
else
|
|
||||||
tax.tax_amount += current_tax_amount;
|
tax.tax_amount += current_tax_amount;
|
||||||
|
|
||||||
|
tax.tax_amount_after_flat_discount += current_tax_amount;
|
||||||
|
|
||||||
// for buying
|
// for buying
|
||||||
if(tax.category) {
|
if(tax.category) {
|
||||||
// if just for valuation, do not add the tax amount in total
|
// if just for valuation, do not add the tax amount in total
|
||||||
@ -603,10 +609,33 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
// in tax.total, accumulate grand total for each item
|
// in tax.total, accumulate grand total for each item
|
||||||
tax.total += tax.grand_total_for_current_item;
|
tax.total += tax.grand_total_for_current_item;
|
||||||
|
|
||||||
|
// set precision in the last item iteration
|
||||||
|
if (n == me.frm.item_doclist.length - 1) {
|
||||||
|
me.round_off_totals(tax);
|
||||||
|
|
||||||
|
// adjust flat discount loss in last tax iteration
|
||||||
|
if ((i == me.frm.tax_doclist.length - 1) && me.flat_discount_applied)
|
||||||
|
me.adjust_flat_discount_loss(tax);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
round_off_totals: function(tax) {
|
||||||
|
tax.total = flt(tax.total, precision("total", tax));
|
||||||
|
tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
|
||||||
|
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount,
|
||||||
|
precision("tax_amount", tax));
|
||||||
|
},
|
||||||
|
|
||||||
|
adjust_flat_discount_loss: function(tax) {
|
||||||
|
var flat_discount_loss = this.frm.doc.grand_total - this.frm.doc.flat_discount - tax.total;
|
||||||
|
tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount +
|
||||||
|
flat_discount_loss, precision("tax_amount", tax));
|
||||||
|
tax.total = flt(tax.total + flat_discount_loss, precision("total", tax));
|
||||||
|
},
|
||||||
|
|
||||||
get_current_tax_amount: function(item, tax, item_tax_map) {
|
get_current_tax_amount: function(item, tax, item_tax_map) {
|
||||||
var tax_rate = this._get_tax_rate(tax, item_tax_map);
|
var tax_rate = this._get_tax_rate(tax, item_tax_map);
|
||||||
var current_tax_amount = 0.0;
|
var current_tax_amount = 0.0;
|
||||||
|
@ -393,8 +393,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
calculate_net_total: function() {
|
calculate_net_total: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0;
|
this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0;
|
||||||
|
|
||||||
$.each(this.frm.item_doclist, function(i, item) {
|
$.each(this.frm.item_doclist, function(i, item) {
|
||||||
me.frm.doc.net_total += item.amount;
|
me.frm.doc.net_total += item.amount;
|
||||||
me.frm.doc.net_total_export += item.export_amount;
|
me.frm.doc.net_total_export += item.export_amount;
|
||||||
@ -406,7 +406,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
calculate_totals: function() {
|
calculate_totals: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var tax_count = this.frm.tax_doclist.length;
|
var tax_count = this.frm.tax_doclist.length;
|
||||||
this.total_tax_excluding_actual = 0.0;
|
|
||||||
|
|
||||||
this.frm.doc.grand_total = flt(
|
this.frm.doc.grand_total = flt(
|
||||||
tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
|
tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
|
||||||
@ -416,34 +415,24 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||||
precision("other_charges_total"));
|
precision("other_charges_total"));
|
||||||
this.frm.doc.other_charges_total_export = flt(
|
this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export -
|
||||||
this.frm.doc.grand_total_export - this.frm.doc.net_total_export + this.frm.doc.flat_discount,
|
this.frm.doc.net_total_export + this.frm.doc.flat_discount,
|
||||||
precision("other_charges_total_export"));
|
precision("other_charges_total_export"));
|
||||||
|
|
||||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||||
this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
|
this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
|
||||||
|
|
||||||
// calculate total amount for flat discount
|
|
||||||
$.each(this.frm.tax_doclist, function(i, tax) {
|
|
||||||
if (tax.charge_type != "Actual") {
|
|
||||||
me.total_tax_excluding_actual += flt(tax.tax_amount, precision("tax_amount", tax));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.total_amount_for_flat_discount = flt(this.frm.doc.net_total +
|
|
||||||
this.total_tax_excluding_actual, precision("grand_total"));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
apply_flat_discount: function() {
|
apply_flat_discount: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var distributed_amount = 0.0;
|
var distributed_amount = 0.0;
|
||||||
|
|
||||||
if (this.frm.doc.flat_discount && this.total_amount_for_flat_discount) {
|
if (this.frm.doc.flat_discount) {
|
||||||
|
var total_amount_for_flat_discount = this.get_flat_discountable_amount();
|
||||||
// calculate item amount after flat discount
|
// calculate item amount after flat discount
|
||||||
$.each(this.frm.item_doclist, function(i, item) {
|
$.each(this.frm.item_doclist, function(i, item) {
|
||||||
distributed_amount = flt(me.frm.doc.flat_discount * item.amount / me.total_amount_for_flat_discount,
|
distributed_amount = me.frm.doc.flat_discount * item.amount / total_amount_for_flat_discount;
|
||||||
precision("amount", item));
|
item.amount = flt(item.amount - distributed_amount, precision("amount", item));
|
||||||
item.amount -= distributed_amount;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.flat_discount_applied = true;
|
this.flat_discount_applied = true;
|
||||||
@ -451,6 +440,30 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_flat_discountable_amount: function() {
|
||||||
|
var me = this;
|
||||||
|
var total_actual_tax = 0.0;
|
||||||
|
var actual_taxes_dict = {};
|
||||||
|
|
||||||
|
$.each(this.frm.tax_doclist, function(i, tax) {
|
||||||
|
if (tax.charge_type == "Actual")
|
||||||
|
actual_taxes_dict[tax.idx] = tax.tax_amount;
|
||||||
|
else if (actual_taxes_dict[tax.row_id] !== null) {
|
||||||
|
actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100;
|
||||||
|
actual_taxes_dict[tax.idx] = actual_tax_amount;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each(actual_taxes_dict, function(key, value) {
|
||||||
|
if (value)
|
||||||
|
total_actual_tax += value;
|
||||||
|
});
|
||||||
|
|
||||||
|
total_amount_for_flat_discount = flt(this.frm.doc.grand_total - total_actual_tax,
|
||||||
|
precision("grand_total"));
|
||||||
|
return total_amount_for_flat_discount;
|
||||||
|
},
|
||||||
|
|
||||||
calculate_outstanding_amount: function() {
|
calculate_outstanding_amount: function() {
|
||||||
// NOTE:
|
// NOTE:
|
||||||
// paid_amount and write_off_amount is only for POS Invoice
|
// paid_amount and write_off_amount is only for POS Invoice
|
||||||
|
@ -97,7 +97,8 @@ cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) {
|
|||||||
cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
|
||||||
return{
|
return{
|
||||||
filters:[
|
filters:[
|
||||||
['Account', 'account_type', 'in', 'Tax, Chargeable'],
|
['Account', 'account_type', 'in',
|
||||||
|
'Tax, Chargeable, Income Account, Expense Account'],
|
||||||
['Account', 'docstatus', '!=', 2]
|
['Account', 'docstatus', '!=', 2]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -154,8 +154,8 @@ class DocType(DocListController, WebsiteGenerator):
|
|||||||
if d.tax_type:
|
if d.tax_type:
|
||||||
account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
|
account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
|
||||||
|
|
||||||
if account_type not in ['Tax', 'Chargeable']:
|
if account_type not in ['Tax', 'Chargeable', 'Income Account', 'Expense Account']:
|
||||||
msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
|
msgprint("'%s' is not Tax / Chargeable / Income / Expense Account" % d.tax_type, raise_exception=1)
|
||||||
else:
|
else:
|
||||||
if d.tax_type in check_list:
|
if d.tax_type in check_list:
|
||||||
msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
|
msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user