|
|
@ -185,6 +185,7 @@ class AccountsController(TransactionBase): |
|
|
|
|
|
|
|
self.calculate_net_total() |
|
|
|
self.calculate_taxes() |
|
|
|
self.manipulate_grand_total_for_inclusive_tax() |
|
|
|
self.calculate_totals() |
|
|
|
self._cleanup() |
|
|
|
|
|
|
@ -353,6 +354,19 @@ class AccountsController(TransactionBase): |
|
|
|
self.precision(base_field, item)) |
|
|
|
item.set(base_field, value_in_company_currency) |
|
|
|
|
|
|
|
def manipulate_grand_total_for_inclusive_tax(self): |
|
|
|
# if fully inclusive taxes and diff |
|
|
|
if (self.meta.get_field("net_total_export") and self.tax_doclist |
|
|
|
and all(cint(t.included_in_print_rate) for t in self.tax_doclist)): |
|
|
|
|
|
|
|
last_tax = self.tax_doclist[-1] |
|
|
|
|
|
|
|
diff = self.net_total_export - flt(last_tax.total / self.conversion_rate, |
|
|
|
self.precision("grand_total_export")) |
|
|
|
|
|
|
|
if diff: |
|
|
|
last_tax.total = last_tax.total + flt(diff * self.conversion_rate, self.precision("total", last_tax)) |
|
|
|
|
|
|
|
def calculate_total_advance(self, parenttype, advance_parentfield): |
|
|
|
if self.doctype == parenttype and self.docstatus < 2: |
|
|
|
sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.precision("allocated_amount", adv)) |
|
|
|