[precision] [fixes]
This commit is contained in:
parent
aab81626ce
commit
5af812a832
@ -466,9 +466,9 @@ class DocType(BuyingController):
|
|||||||
# expense will be booked in sales invoice
|
# expense will be booked in sales invoice
|
||||||
stock_item_and_auto_inventory_accounting = True
|
stock_item_and_auto_inventory_accounting = True
|
||||||
|
|
||||||
valuation_amt = (flt(item.amount, self.precision.item.amount) +
|
valuation_amt = (flt(item.amount, self.precision("amount", item.parentfield)) +
|
||||||
flt(item.item_tax_amount, self.precision.item.item_tax_amount) +
|
flt(item.item_tax_amount, self.precision("item_tax_amount", item.parentfield)) +
|
||||||
flt(item.rm_supp_cost, self.precision.item.rm_supp_cost))
|
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item.parentfield)))
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
|
@ -137,8 +137,8 @@ class BuyingController(StockController):
|
|||||||
def _set_base(item, print_field, base_field):
|
def _set_base(item, print_field, base_field):
|
||||||
"""set values in base currency"""
|
"""set values in base currency"""
|
||||||
item.fields[base_field] = flt((flt(item.fields[print_field],
|
item.fields[base_field] = flt((flt(item.fields[print_field],
|
||||||
self.precision_of(print_field, item.parentfield)) * self.doc.conversion_rate),
|
self.precision(print_field, item.parentfield)) * self.doc.conversion_rate),
|
||||||
self.precision_of(base_field, item.parentfield))
|
self.precision(base_field, item.parentfield))
|
||||||
|
|
||||||
# hack! - cleaned up in _cleanup()
|
# hack! - cleaned up in _cleanup()
|
||||||
if self.doc.doctype != "Purchase Invoice":
|
if self.doc.doctype != "Purchase Invoice":
|
||||||
@ -158,19 +158,19 @@ class BuyingController(StockController):
|
|||||||
else:
|
else:
|
||||||
if item.import_ref_rate:
|
if item.import_ref_rate:
|
||||||
item.import_rate = flt(item.import_ref_rate * (1.0 - (item.discount_rate / 100.0)),
|
item.import_rate = flt(item.import_ref_rate * (1.0 - (item.discount_rate / 100.0)),
|
||||||
self.precision_of("import_rate", item.parentfield))
|
self.precision("import_rate", item.parentfield))
|
||||||
else:
|
else:
|
||||||
# assume that print rate and discount_rate are specified
|
# assume that print rate and discount_rate are specified
|
||||||
item.import_ref_rate = flt(item.import_rate / (1.0 - (item.discount_rate / 100.0)),
|
item.import_ref_rate = flt(item.import_rate / (1.0 - (item.discount_rate / 100.0)),
|
||||||
self.precision_of("import_ref_rate", item.parentfield))
|
self.precision("import_ref_rate", item.parentfield))
|
||||||
|
|
||||||
item.import_amount = flt(item.import_rate * item.qty,
|
item.import_amount = flt(item.import_rate * item.qty,
|
||||||
self.precision_of("import_amount", item.parentfield))
|
self.precision("import_amount", item.parentfield))
|
||||||
|
|
||||||
_set_base(item, "import_ref_rate", "purchase_ref_rate")
|
_set_base(item, "import_ref_rate", "purchase_ref_rate")
|
||||||
_set_base(item, "import_rate", "rate")
|
_set_base(item, "import_rate", "rate")
|
||||||
_set_base(item, "import_amount", "amount")
|
_set_base(item, "import_amount", "amount")
|
||||||
|
|
||||||
def initialize_taxes(self):
|
def initialize_taxes(self):
|
||||||
for tax in self.tax_doclist:
|
for tax in self.tax_doclist:
|
||||||
# initialize totals to 0
|
# initialize totals to 0
|
||||||
@ -193,9 +193,9 @@ class BuyingController(StockController):
|
|||||||
self.doc.net_total += item.amount
|
self.doc.net_total += item.amount
|
||||||
self.doc.net_total_import += item.import_amount
|
self.doc.net_total_import += item.import_amount
|
||||||
|
|
||||||
self.doc.net_total = flt(self.doc.net_total, self.precision_of("net_total"))
|
self.doc.net_total = flt(self.doc.net_total, self.precision("net_total"))
|
||||||
self.doc.net_total_import = flt(self.doc.net_total_import,
|
self.doc.net_total_import = flt(self.doc.net_total_import,
|
||||||
self.precision_of("net_total_import"))
|
self.precision("net_total_import"))
|
||||||
|
|
||||||
def calculate_taxes(self):
|
def calculate_taxes(self):
|
||||||
for item in self.item_doclist:
|
for item in self.item_doclist:
|
||||||
@ -213,7 +213,7 @@ class BuyingController(StockController):
|
|||||||
# and tax.grand_total_for_current_item for the first such iteration
|
# and tax.grand_total_for_current_item for the first such iteration
|
||||||
if not (current_tax_amount or self.doc.net_total or tax.tax_amount) and \
|
if not (current_tax_amount or self.doc.net_total or tax.tax_amount) and \
|
||||||
tax.charge_type=="Actual":
|
tax.charge_type=="Actual":
|
||||||
zero_net_total_adjustment = flt(tax.rate, self.precision_of("tax_amount", tax.parentfield))
|
zero_net_total_adjustment = flt(tax.rate, self.precision("tax_amount", tax.parentfield))
|
||||||
current_tax_amount += zero_net_total_adjustment
|
current_tax_amount += zero_net_total_adjustment
|
||||||
|
|
||||||
# store tax_amount for current item as it will be used for
|
# store tax_amount for current item as it will be used for
|
||||||
@ -235,12 +235,12 @@ class BuyingController(StockController):
|
|||||||
# item's amount, previously applied tax and the current tax on that item
|
# item's amount, previously applied tax and the current tax on that item
|
||||||
if i==0:
|
if i==0:
|
||||||
tax.grand_total_for_current_item = flt(item.amount +
|
tax.grand_total_for_current_item = flt(item.amount +
|
||||||
current_tax_amount, self.precision_of("total", tax.parentfield))
|
current_tax_amount, self.precision("total", tax.parentfield))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tax.grand_total_for_current_item = \
|
tax.grand_total_for_current_item = \
|
||||||
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_of("total", tax.parentfield))
|
current_tax_amount, self.precision("total", tax.parentfield))
|
||||||
|
|
||||||
# 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
|
||||||
@ -252,20 +252,20 @@ class BuyingController(StockController):
|
|||||||
def calculate_totals(self):
|
def calculate_totals(self):
|
||||||
if self.tax_doclist:
|
if self.tax_doclist:
|
||||||
self.doc.grand_total = flt(self.tax_doclist[-1].total,
|
self.doc.grand_total = flt(self.tax_doclist[-1].total,
|
||||||
self.precision_of("grand_total"))
|
self.precision("grand_total"))
|
||||||
self.doc.grand_total_import = flt(
|
self.doc.grand_total_import = flt(
|
||||||
self.doc.grand_total / self.doc.conversion_rate,
|
self.doc.grand_total / self.doc.conversion_rate,
|
||||||
self.precision_of("grand_total_import"))
|
self.precision("grand_total_import"))
|
||||||
else:
|
else:
|
||||||
self.doc.grand_total = flt(self.doc.net_total,
|
self.doc.grand_total = flt(self.doc.net_total,
|
||||||
self.precision_of("grand_total"))
|
self.precision("grand_total"))
|
||||||
self.doc.grand_total_import = flt(
|
self.doc.grand_total_import = flt(
|
||||||
self.doc.grand_total / self.doc.conversion_rate,
|
self.doc.grand_total / self.doc.conversion_rate,
|
||||||
self.precision_of("grand_total_import"))
|
self.precision("grand_total_import"))
|
||||||
|
|
||||||
self.doc.total_tax = \
|
self.doc.total_tax = \
|
||||||
flt(self.doc.grand_total - self.doc.net_total,
|
flt(self.doc.grand_total - self.doc.net_total,
|
||||||
self.precision_of("total_tax"))
|
self.precision("total_tax"))
|
||||||
|
|
||||||
if self.meta.get_field("rounded_total"):
|
if self.meta.get_field("rounded_total"):
|
||||||
self.doc.rounded_total = round(self.doc.grand_total)
|
self.doc.rounded_total = round(self.doc.grand_total)
|
||||||
@ -276,11 +276,11 @@ class BuyingController(StockController):
|
|||||||
def calculate_outstanding_amount(self):
|
def calculate_outstanding_amount(self):
|
||||||
if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus == 0:
|
if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus == 0:
|
||||||
self.doc.total_advance = flt(self.doc.total_advance,
|
self.doc.total_advance = flt(self.doc.total_advance,
|
||||||
self.precision_of("total_advance"))
|
self.precision("total_advance"))
|
||||||
self.doc.total_amount_to_pay = flt(self.doc.grand_total - flt(self.doc.write_off_amount,
|
self.doc.total_amount_to_pay = flt(self.doc.grand_total - flt(self.doc.write_off_amount,
|
||||||
self.precision_of("write_off_amount")), self.precision_of("total_amount_to_pay"))
|
self.precision("write_off_amount")), self.precision("total_amount_to_pay"))
|
||||||
self.doc.outstanding_amount = flt(self.doc.total_amount_to_pay - self.doc.total_advance,
|
self.doc.outstanding_amount = flt(self.doc.total_amount_to_pay - self.doc.total_advance,
|
||||||
self.precision_of("outstanding_amount"))
|
self.precision("outstanding_amount"))
|
||||||
|
|
||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
for tax in self.tax_doclist:
|
for tax in self.tax_doclist:
|
||||||
@ -294,6 +294,11 @@ class BuyingController(StockController):
|
|||||||
item.purchase_rate = item.rate
|
item.purchase_rate = item.rate
|
||||||
del item.fields["rate"]
|
del item.fields["rate"]
|
||||||
|
|
||||||
|
# reset fieldname of rate
|
||||||
|
if self.doc.doctype != "Purchase Invoice":
|
||||||
|
df = self.meta.get_field("rate", parentfield=self.fname)
|
||||||
|
df.fieldname = "purchase_rate"
|
||||||
|
|
||||||
def validate_on_previous_row(self, tax):
|
def validate_on_previous_row(self, tax):
|
||||||
"""
|
"""
|
||||||
validate if a valid row id is mentioned in case of
|
validate if a valid row id is mentioned in case of
|
||||||
@ -319,7 +324,7 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
# distribute the tax amount proportionally to each item row
|
# distribute the tax amount proportionally to each item row
|
||||||
actual = flt(tax.rate, self.precision_of("tax_amount", tax.parentfield))
|
actual = flt(tax.rate, self.precision("tax_amount", tax.parentfield))
|
||||||
current_tax_amount = (self.doc.net_total
|
current_tax_amount = (self.doc.net_total
|
||||||
and ((item.amount / self.doc.net_total) * actual)
|
and ((item.amount / self.doc.net_total) * actual)
|
||||||
or 0)
|
or 0)
|
||||||
@ -332,11 +337,11 @@ class BuyingController(StockController):
|
|||||||
current_tax_amount = (tax_rate / 100.0) * \
|
current_tax_amount = (tax_rate / 100.0) * \
|
||||||
self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
|
self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
|
||||||
|
|
||||||
return flt(current_tax_amount, self.precision_of("tax_amount", tax.parentfield))
|
return flt(current_tax_amount, self.precision("tax_amount", tax.parentfield))
|
||||||
|
|
||||||
def _get_tax_rate(self, tax, item_tax_map):
|
def _get_tax_rate(self, tax, item_tax_map):
|
||||||
if item_tax_map.has_key(tax.account_head):
|
if item_tax_map.has_key(tax.account_head):
|
||||||
return flt(item_tax_map.get(tax.account_head), self.precision_of("rate", tax.parentfield))
|
return flt(item_tax_map.get(tax.account_head), self.precision("rate", tax.parentfield))
|
||||||
else:
|
else:
|
||||||
return tax.rate
|
return tax.rate
|
||||||
|
|
||||||
@ -350,26 +355,31 @@ class BuyingController(StockController):
|
|||||||
if tax.category in ["Valuation", "Valuation and Total"] and \
|
if tax.category in ["Valuation", "Valuation and Total"] and \
|
||||||
item.item_code in self.stock_items:
|
item.item_code in self.stock_items:
|
||||||
item.item_tax_amount += flt(current_tax_amount,
|
item.item_tax_amount += flt(current_tax_amount,
|
||||||
self.precision_of("item_tax_amount", item.parentfield))
|
self.precision("item_tax_amount", item.parentfield))
|
||||||
|
|
||||||
# update valuation rate
|
# update valuation rate
|
||||||
def update_valuation_rate(self, parentfield):
|
def update_valuation_rate(self, parentfield):
|
||||||
for d in self.doclist.get({"parentfield": parentfield}):
|
for item in self.doclist.get({"parentfield": parentfield}):
|
||||||
d.conversion_factor = d.conversion_factor or flt(webnotes.conn.get_value(
|
item.conversion_factor = item.conversion_factor or flt(webnotes.conn.get_value(
|
||||||
"UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom},
|
"UOM Conversion Detail", {"parent": item.item_code, "uom": item.uom},
|
||||||
"conversion_factor")) or 1
|
"conversion_factor")) or 1
|
||||||
if d.item_code and d.qty:
|
if item.item_code and item.qty:
|
||||||
|
if self.doc.doctype == "Purchase Invoice":
|
||||||
|
purchase_rate = flt(item.rate, self.precision("rate", item.parentfield))
|
||||||
|
else:
|
||||||
|
purchase_rate = flt(item.purchase_rate, self.precision("purchase_rate", item.parentfield))
|
||||||
|
|
||||||
# if no item code, which is sometimes the case in purchase invoice,
|
# if no item code, which is sometimes the case in purchase invoice,
|
||||||
# then it is not possible to track valuation against it
|
# then it is not possible to track valuation against it
|
||||||
d.valuation_rate = flt((flt(d.purchase_rate, self.precision.item.purchase_rate) or
|
item.valuation_rate = flt(
|
||||||
flt(d.rate, self.precision.item.rate) +
|
(purchase_rate + \
|
||||||
(flt(d.item_tax_amount, self.precision.item.item_tax_amount) +
|
(flt(item.item_tax_amount, self.precision("item_tax_amount", item.parentfield)) +
|
||||||
flt(d.rm_supp_cost, self.precision.item.rm_supp_cost)) /
|
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item.parentfield))
|
||||||
flt(d.qty, self.precision.item.qty)) /
|
) / flt(item.qty, self.precision("qty", item.parentfield))
|
||||||
flt(d.conversion_factor, self.precision.item.conversion_factor),
|
) / flt(item.conversion_factor, self.precision("conversion_factor", item.parentfield)),
|
||||||
self.precision.item.valuation_rate)
|
self.precision("valuation_rate", item.parentfield))
|
||||||
else:
|
else:
|
||||||
d.valuation_rate = 0.0
|
item.valuation_rate = 0.0
|
||||||
|
|
||||||
def validate_for_subcontracting(self):
|
def validate_for_subcontracting(self):
|
||||||
if not self.doc.is_subcontracted and self.sub_contracted_items:
|
if not self.doc.is_subcontracted and self.sub_contracted_items:
|
||||||
|
@ -122,12 +122,12 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
if cumulated_tax_fraction:
|
if cumulated_tax_fraction:
|
||||||
item.basic_rate = flt((item.export_rate * self.doc.conversion_rate) /
|
item.basic_rate = flt((item.export_rate * self.doc.conversion_rate) /
|
||||||
(1 + cumulated_tax_fraction), self.precision_of("basic_rate", item.parentfield))
|
(1 + cumulated_tax_fraction), self.precision("basic_rate", item.parentfield))
|
||||||
|
|
||||||
item.amount = flt(item.basic_rate * item.qty, self.precision_of("amount", item.parentfield))
|
item.amount = flt(item.basic_rate * item.qty, self.precision("amount", item.parentfield))
|
||||||
|
|
||||||
item.base_ref_rate = flt(item.basic_rate / (1 - (item.adj_rate / 100.0)),
|
item.base_ref_rate = flt(item.basic_rate / (1 - (item.adj_rate / 100.0)),
|
||||||
self.precision_of("base_ref_rate", item.parentfield))
|
self.precision("base_ref_rate", item.parentfield))
|
||||||
|
|
||||||
def get_current_tax_fraction(self, tax, item_tax_map):
|
def get_current_tax_fraction(self, tax, item_tax_map):
|
||||||
"""
|
"""
|
||||||
@ -156,8 +156,8 @@ class SellingController(StockController):
|
|||||||
def _set_base(item, print_field, base_field):
|
def _set_base(item, print_field, base_field):
|
||||||
"""set values in base currency"""
|
"""set values in base currency"""
|
||||||
item.fields[base_field] = flt((flt(item.fields[print_field],
|
item.fields[base_field] = flt((flt(item.fields[print_field],
|
||||||
self.precision_of(print_field, item.parentfield)) * self.doc.conversion_rate),
|
self.precision(print_field, item.parentfield)) * self.doc.conversion_rate),
|
||||||
self.precision_of(base_field, item.parentfield))
|
self.precision(base_field, item.parentfield))
|
||||||
|
|
||||||
for item in self.item_doclist:
|
for item in self.item_doclist:
|
||||||
self.round_floats_in_doc(item, item.parentfield)
|
self.round_floats_in_doc(item, item.parentfield)
|
||||||
@ -168,14 +168,14 @@ class SellingController(StockController):
|
|||||||
else:
|
else:
|
||||||
if item.ref_rate:
|
if item.ref_rate:
|
||||||
item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)),
|
item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)),
|
||||||
self.precision_of("export_rate", item.parentfield))
|
self.precision("export_rate", item.parentfield))
|
||||||
else:
|
else:
|
||||||
# assume that print rate and discount are specified
|
# assume that print rate and discount are specified
|
||||||
item.ref_rate = flt(item.export_rate / (1.0 - (item.adj_rate / 100.0)),
|
item.ref_rate = flt(item.export_rate / (1.0 - (item.adj_rate / 100.0)),
|
||||||
self.precision_of("ref_rate", item.parentfield))
|
self.precision("ref_rate", item.parentfield))
|
||||||
|
|
||||||
item.export_amount = flt(item.export_rate * item.qty,
|
item.export_amount = flt(item.export_rate * item.qty,
|
||||||
self.precision_of("export_amount", item.parentfield))
|
self.precision("export_amount", item.parentfield))
|
||||||
|
|
||||||
_set_base(item, "ref_rate", "base_ref_rate")
|
_set_base(item, "ref_rate", "base_ref_rate")
|
||||||
_set_base(item, "export_rate", "basic_rate")
|
_set_base(item, "export_rate", "basic_rate")
|
||||||
@ -199,9 +199,9 @@ class SellingController(StockController):
|
|||||||
self.doc.net_total += item.amount
|
self.doc.net_total += item.amount
|
||||||
self.doc.net_total_export += item.export_amount
|
self.doc.net_total_export += item.export_amount
|
||||||
|
|
||||||
self.doc.net_total = flt(self.doc.net_total, self.precision_of("net_total"))
|
self.doc.net_total = flt(self.doc.net_total, self.precision("net_total"))
|
||||||
self.doc.net_total_export = flt(self.doc.net_total_export,
|
self.doc.net_total_export = flt(self.doc.net_total_export,
|
||||||
self.precision_of("net_total_export"))
|
self.precision("net_total_export"))
|
||||||
|
|
||||||
def calculate_taxes(self):
|
def calculate_taxes(self):
|
||||||
for item in self.item_doclist:
|
for item in self.item_doclist:
|
||||||
@ -216,7 +216,7 @@ class SellingController(StockController):
|
|||||||
# and tax.grand_total_for_current_item for the first such iteration
|
# and tax.grand_total_for_current_item for the first such iteration
|
||||||
if not (current_tax_amount or self.doc.net_total or tax.tax_amount) and \
|
if not (current_tax_amount or self.doc.net_total or tax.tax_amount) and \
|
||||||
tax.charge_type=="Actual":
|
tax.charge_type=="Actual":
|
||||||
zero_net_total_adjustment = flt(tax.rate, self.precision_of("tax_amount", tax.parentfield))
|
zero_net_total_adjustment = flt(tax.rate, self.precision("tax_amount", tax.parentfield))
|
||||||
current_tax_amount += zero_net_total_adjustment
|
current_tax_amount += zero_net_total_adjustment
|
||||||
|
|
||||||
# store tax_amount for current item as it will be used for
|
# store tax_amount for current item as it will be used for
|
||||||
@ -231,12 +231,12 @@ class SellingController(StockController):
|
|||||||
# item's amount, previously applied tax and the current tax on that item
|
# item's amount, previously applied tax and the current tax on that item
|
||||||
if i==0:
|
if i==0:
|
||||||
tax.grand_total_for_current_item = flt(item.amount +
|
tax.grand_total_for_current_item = flt(item.amount +
|
||||||
current_tax_amount, self.precision_of("total", tax.parentfield))
|
current_tax_amount, self.precision("total", tax.parentfield))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tax.grand_total_for_current_item = \
|
tax.grand_total_for_current_item = \
|
||||||
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_of("total", tax.parentfield))
|
current_tax_amount, self.precision("total", tax.parentfield))
|
||||||
|
|
||||||
# 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
|
||||||
@ -247,9 +247,9 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
def calculate_totals(self):
|
def calculate_totals(self):
|
||||||
self.doc.grand_total = flt(self.tax_doclist and \
|
self.doc.grand_total = flt(self.tax_doclist and \
|
||||||
self.tax_doclist[-1].total or self.doc.net_total, self.precision_of("grand_total"))
|
self.tax_doclist[-1].total or self.doc.net_total, self.precision("grand_total"))
|
||||||
self.doc.grand_total_export = flt(self.doc.grand_total / self.doc.conversion_rate,
|
self.doc.grand_total_export = flt(self.doc.grand_total / self.doc.conversion_rate,
|
||||||
self.precision_of("grand_total_export"))
|
self.precision("grand_total_export"))
|
||||||
|
|
||||||
self.doc.rounded_total = round(self.doc.grand_total)
|
self.doc.rounded_total = round(self.doc.grand_total)
|
||||||
self.doc.rounded_total_export = round(self.doc.grand_total_export)
|
self.doc.rounded_total_export = round(self.doc.grand_total_export)
|
||||||
@ -259,7 +259,7 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
# distribute the tax amount proportionally to each item row
|
# distribute the tax amount proportionally to each item row
|
||||||
actual = flt(tax.rate, self.precision_of("tax_amount", tax.parentfield))
|
actual = flt(tax.rate, self.precision("tax_amount", tax.parentfield))
|
||||||
current_tax_amount = (self.doc.net_total
|
current_tax_amount = (self.doc.net_total
|
||||||
and ((item.amount / self.doc.net_total) * actual)
|
and ((item.amount / self.doc.net_total) * actual)
|
||||||
or 0)
|
or 0)
|
||||||
@ -272,7 +272,7 @@ class SellingController(StockController):
|
|||||||
current_tax_amount = (tax_rate / 100.0) * \
|
current_tax_amount = (tax_rate / 100.0) * \
|
||||||
self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
|
self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
|
||||||
|
|
||||||
return flt(current_tax_amount, self.precision_of("tax_amount", tax.parentfield))
|
return flt(current_tax_amount, self.precision("tax_amount", tax.parentfield))
|
||||||
|
|
||||||
def validate_on_previous_row(self, tax):
|
def validate_on_previous_row(self, tax):
|
||||||
"""
|
"""
|
||||||
@ -334,7 +334,7 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
def _get_tax_rate(self, tax, item_tax_map):
|
def _get_tax_rate(self, tax, item_tax_map):
|
||||||
if item_tax_map.has_key(tax.account_head):
|
if item_tax_map.has_key(tax.account_head):
|
||||||
return flt(item_tax_map.get(tax.account_head), self.precision_of("rate", tax.parentfield))
|
return flt(item_tax_map.get(tax.account_head), self.precision("rate", tax.parentfield))
|
||||||
else:
|
else:
|
||||||
return tax.rate
|
return tax.rate
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user