Merge pull request #3753 from nabinhait/return1

[fix] Actual tax amount should be negative while creating return entry
This commit is contained in:
Nabin Hait 2015-07-30 11:50:45 +05:30
commit 01a3a81f71
3 changed files with 6 additions and 8 deletions

View File

@ -109,6 +109,11 @@ def make_return_doc(doctype, source_name, target_doc=None):
doc.ignore_pricing_rule = 1
if doctype == "Sales Invoice":
doc.is_pos = 0
for tax in doc.get("taxes"):
if tax.charge_type == "Actual":
tax.tax_amount = -1 * tax.tax_amount
doc.run_method("calculate_taxes_and_totals")
def update_item(source_doc, target_doc, source_parent):

View File

@ -78,9 +78,6 @@ class calculate_taxes_and_totals(object):
validate_taxes_and_charges(tax)
validate_inclusive_tax(tax, self.doc)
if self.doc.meta.get_field("is_return") and self.doc.is_return and tax.charge_type == "Actual":
tax.tax_amount = -1 * tax.tax_amount
tax.item_wise_tax_detail = {}
tax_fields = ["total", "tax_amount_after_discount_amount",
"tax_amount_for_current_item", "grand_total_for_current_item",

View File

@ -95,10 +95,6 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
"tax_amount_for_current_item", "grand_total_for_current_item",
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
if (frappe.meta.get_docfield(me.frm.doc.doctype, "is_return") && me.frm.doc.is_return
&& tax.charge_type == "Actual")
tax.tax_amount = -1 * tax.tax_amount;
if (cstr(tax.charge_type) != "Actual" &&
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total"))
tax_fields.push("tax_amount");