[fix] [minor] precision in gl entry based on currency format

This commit is contained in:
Nabin Hait 2013-12-17 14:45:55 +05:30
parent 3ddd0d89df
commit 9d6e10c910
5 changed files with 37 additions and 36 deletions

View File

@ -399,9 +399,10 @@ class DocType(SellingController):
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):

View File

@ -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"
},
@ -37,11 +37,20 @@
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"reqd": 1
},
{
"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",
@ -72,6 +81,24 @@
"reqd": 1,
"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",
@ -80,7 +107,7 @@
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"reqd": 0
"reqd": 1
},
{
"doctype": "DocField",
@ -104,15 +131,6 @@
"options": "Company:company:default_currency",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "row_id",
"fieldtype": "Data",
"hidden": 0,
"label": "Enter Row",
"oldfieldname": "row_id",
"oldfieldtype": "Data"
},
{
"doctype": "DocField",
"fieldname": "item_wise_tax_detail",
@ -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"
}
]

View File

@ -24,10 +24,6 @@ def process_gl_map(gl_map, merge_entries=True):
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)

View File

@ -205,8 +205,8 @@ class SellingController(StockController):
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"):

View File

@ -515,7 +515,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
}
});
};
setup_field_label_map(["net_total", "other_charges_total", "grand_total",
"rounded_total", "in_words",
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],