[fix] [minor] precision in gl entry based on currency format
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index b1834d5..bfba30f 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -399,9 +399,10 @@
if not self.doc.cash_bank_account and flt(self.doc.paid_amount):
msgprint("Cash/Bank Account is mandatory for POS, for making payment entry")
raise Exception
- if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
- msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
- raise Exception
+ if flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) \
+ - flt(self.doc.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
+ webnotes.throw(_("""(Paid amount + Write Off Amount) can not be \
+ greater than Grand Total"""))
def validate_item_code(self):
diff --git a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
index fbba643..b006c1d 100644
--- a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
+++ b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-04-24 11:39:32",
"docstatus": 0,
- "modified": "2013-07-10 14:54:21",
+ "modified": "2013-12-17 12:38:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -39,9 +39,18 @@
},
{
"doctype": "DocField",
+ "fieldname": "row_id",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "label": "Enter Row",
+ "oldfieldname": "row_id",
+ "oldfieldtype": "Data"
+ },
+ {
+ "doctype": "DocField",
"fieldname": "account_head",
"fieldtype": "Link",
- "in_list_view": 1,
+ "in_list_view": 0,
"label": "Account Head",
"oldfieldname": "account_head",
"oldfieldtype": "Link",
@@ -54,7 +63,7 @@
"doctype": "DocField",
"fieldname": "cost_center",
"fieldtype": "Link",
- "in_list_view": 1,
+ "in_list_view": 0,
"label": "Cost Center",
"oldfieldname": "cost_center_other_charges",
"oldfieldtype": "Link",
@@ -73,6 +82,24 @@
"width": "300px"
},
{
+ "allow_on_submit": 0,
+ "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
+ "doctype": "DocField",
+ "fieldname": "included_in_print_rate",
+ "fieldtype": "Check",
+ "label": "Is this Tax included in Basic Rate?",
+ "no_copy": 0,
+ "print_hide": 1,
+ "print_width": "150px",
+ "report_hide": 1,
+ "width": "150px"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break"
+ },
+ {
"doctype": "DocField",
"fieldname": "rate",
"fieldtype": "Float",
@@ -80,7 +107,7 @@
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
- "reqd": 0
+ "reqd": 1
},
{
"doctype": "DocField",
@@ -106,15 +133,6 @@
},
{
"doctype": "DocField",
- "fieldname": "row_id",
- "fieldtype": "Data",
- "hidden": 0,
- "label": "Enter Row",
- "oldfieldname": "row_id",
- "oldfieldtype": "Data"
- },
- {
- "doctype": "DocField",
"fieldname": "item_wise_tax_detail",
"fieldtype": "Small Text",
"hidden": 1,
@@ -134,18 +152,5 @@
"oldfieldtype": "Data",
"print_hide": 1,
"search_index": 1
- },
- {
- "allow_on_submit": 0,
- "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
- "doctype": "DocField",
- "fieldname": "included_in_print_rate",
- "fieldtype": "Check",
- "label": "Is this Tax included in Basic Rate?",
- "no_copy": 0,
- "print_hide": 1,
- "print_width": "150px",
- "report_hide": 1,
- "width": "150px"
}
]
\ No newline at end of file
diff --git a/accounts/general_ledger.py b/accounts/general_ledger.py
index 87814b1..bc0ac1d 100644
--- a/accounts/general_ledger.py
+++ b/accounts/general_ledger.py
@@ -24,10 +24,6 @@
gl_map = merge_similar_entries(gl_map)
for entry in gl_map:
- # round off upto 2 decimal
- entry.debit = flt(entry.debit, 2)
- entry.credit = flt(entry.credit, 2)
-
# toggle debit, credit if negative entry
if flt(entry.debit) < 0:
entry.credit = flt(entry.credit) - flt(entry.debit)
diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py
index fd4ca40..67c1462 100644
--- a/controllers/selling_controller.py
+++ b/controllers/selling_controller.py
@@ -205,8 +205,8 @@
self.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount",
"paid_amount"])
total_amount_to_pay = self.doc.grand_total - self.doc.write_off_amount
- self.doc.outstanding_amount = flt(total_amount_to_pay - self.doc.total_advance - self.doc.paid_amount,
- self.precision("outstanding_amount"))
+ self.doc.outstanding_amount = flt(total_amount_to_pay - self.doc.total_advance \
+ - self.doc.paid_amount, self.precision("outstanding_amount"))
def calculate_commission(self):
if self.meta.get_field("commission_rate"):
diff --git a/selling/sales_common.js b/selling/sales_common.js
index d6c8fdd..dddc2b5 100644
--- a/selling/sales_common.js
+++ b/selling/sales_common.js
@@ -515,7 +515,6 @@
}
});
};
-
setup_field_label_map(["net_total", "other_charges_total", "grand_total",
"rounded_total", "in_words",
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],