Merge branch 'master' of github.com:webnotes/erpnext into edge
This commit is contained in:
commit
6685fbd348
@ -26,6 +26,10 @@ cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = fun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.state.get_query = function(doc) {
|
||||||
|
return {filters: { country: "India"}}
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
|
get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
|
||||||
|
@ -68,7 +68,7 @@ class DocType:
|
|||||||
self.set_total_invoiced_amount()
|
self.set_total_invoiced_amount()
|
||||||
|
|
||||||
def set_total_invoiced_amount(self):
|
def set_total_invoiced_amount(self):
|
||||||
total = sum([flt(d.total) for d in getlist(self.doclist, 'invoice_details')])
|
total = sum([flt(d.grand_total) for d in getlist(self.doclist, 'invoice_details')])
|
||||||
webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
|
webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
|
||||||
|
|
||||||
def get_invoice_details(self, invoice_no):
|
def get_invoice_details(self, invoice_no):
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-19 10:23:34",
|
"creation": "2013-01-30 12:49:46",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 16:27:57",
|
"modified": "2013-02-13 11:29:18",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -127,9 +127,9 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "state",
|
"fieldname": "state",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Link",
|
||||||
"label": "State",
|
"label": "State",
|
||||||
"options": "link:State\ncountry='India'",
|
"options": "State",
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
@ -171,7 +171,7 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Amended From",
|
"label": "Amended From",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Sales Invoice",
|
"options": "C-Form",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
|
@ -423,7 +423,7 @@ class DocType(BuyingController):
|
|||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": self.doc.credit_to,
|
"account": self.doc.credit_to,
|
||||||
"against": self.doc.against_expense_account,
|
"against": self.doc.against_expense_account,
|
||||||
"credit": self.doc.grand_total,
|
"credit": self.doc.total_amount_to_pay,
|
||||||
"remarks": self.doc.remarks,
|
"remarks": self.doc.remarks,
|
||||||
"against_voucher": self.doc.name,
|
"against_voucher": self.doc.name,
|
||||||
"against_voucher_type": self.doc.doctype,
|
"against_voucher_type": self.doc.doctype,
|
||||||
|
@ -77,7 +77,8 @@ cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
|
|||||||
d.add_deduct_tax = '';
|
d.add_deduct_tax = '';
|
||||||
}
|
}
|
||||||
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
||||||
alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
|
console.log([d.category, d.add_deduct_tax]);
|
||||||
|
msgprint("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'");
|
||||||
d.add_deduct_tax = '';
|
d.add_deduct_tax = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,10 @@ def save_entries(gl_map, cancel, adv_adj, update_outstanding):
|
|||||||
for entry in gl_map:
|
for entry in gl_map:
|
||||||
gle = Document('GL Entry', fielddata=entry)
|
gle = Document('GL Entry', fielddata=entry)
|
||||||
|
|
||||||
|
# round off upto 2 decimal
|
||||||
|
gle.debit = flt(gle.debit, 2)
|
||||||
|
gle.credit = flt(gle.credit, 2)
|
||||||
|
|
||||||
# toggle debit, credit if negative entry
|
# toggle debit, credit if negative entry
|
||||||
if flt(gle.debit) < 0 or flt(gle.credit) < 0:
|
if flt(gle.debit) < 0 or flt(gle.credit) < 0:
|
||||||
_swap(gle)
|
_swap(gle)
|
||||||
|
@ -778,10 +778,10 @@ cur_frm.cscript.calc_doc_values = function(doc, tname, fname, other_fname) {
|
|||||||
|
|
||||||
var calculate_outstanding = function(doc) {
|
var calculate_outstanding = function(doc) {
|
||||||
// total amount to pay
|
// total amount to pay
|
||||||
doc.total_amount_to_pay = flt(flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted));
|
doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.write_off_amount);
|
||||||
|
|
||||||
// outstanding amount
|
// outstanding amount
|
||||||
if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_advance);
|
if(doc.docstatus==0) doc.outstanding_amount = doc.total_amount_to_pay - flt(doc.total_advance);
|
||||||
|
|
||||||
refresh_many(['total_amount_to_pay', 'outstanding_amount']);
|
refresh_many(['total_amount_to_pay', 'outstanding_amount']);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-02-02 14:40:08",
|
"creation": "2013-02-08 13:17:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-02-08 11:27:22",
|
"modified": "2013-02-13 12:32:27",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -29,9 +29,7 @@
|
|||||||
"parent": "Leave Application",
|
"parent": "Leave Application",
|
||||||
"parentfield": "permissions",
|
"parentfield": "permissions",
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"read": 1,
|
"read": 1
|
||||||
"report": 1,
|
|
||||||
"write": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -215,7 +213,18 @@
|
|||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"match": "employee",
|
"match": "employee",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"role": "Employee"
|
"report": 1,
|
||||||
|
"role": "Employee",
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 1,
|
||||||
|
"role": "All",
|
||||||
|
"submit": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
@ -223,8 +232,10 @@
|
|||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"report": 1,
|
||||||
"role": "HR User",
|
"role": "HR User",
|
||||||
"submit": 1
|
"submit": 1,
|
||||||
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
@ -233,13 +244,10 @@
|
|||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"match": "leave_approver:user",
|
"match": "leave_approver:user",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"report": 1,
|
||||||
"role": "Leave Approver",
|
"role": "Leave Approver",
|
||||||
"submit": 1
|
"submit": 1,
|
||||||
},
|
"write": 1
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"permlevel": 2,
|
|
||||||
"role": "HR User"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
@ -247,7 +255,25 @@
|
|||||||
"create": 0,
|
"create": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"permlevel": 2,
|
"permlevel": 2,
|
||||||
|
"report": 1,
|
||||||
|
"role": "HR User",
|
||||||
|
"submit": 0,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 2,
|
||||||
|
"report": 1,
|
||||||
"role": "Leave Approver",
|
"role": "Leave Approver",
|
||||||
"submit": 0
|
"submit": 0,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 2,
|
||||||
|
"role": "Employee"
|
||||||
}
|
}
|
||||||
]
|
]
|
15
patches/february_2013/fix_outstanding.py
Normal file
15
patches/february_2013/fix_outstanding.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
from webnotes.utils import flt
|
||||||
|
for dt in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
|
records = webnotes.conn.sql("""select name, outstanding_amount from `tab%s`
|
||||||
|
where docstatus = 1""" % dt)
|
||||||
|
for r in records:
|
||||||
|
outstanding = webnotes.conn.sql("""
|
||||||
|
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) from `tabGL Entry`
|
||||||
|
where against_voucher = %s and against_voucher_type = %s
|
||||||
|
and ifnull(is_cancelled, 'No') = 'No'""", (r[0], dt))
|
||||||
|
if flt(r[1]) != abs(flt(outstanding[0][0])):
|
||||||
|
# print r, outstanding
|
||||||
|
webnotes.conn.sql("update `tab%s` set outstanding_amount = %s where name = %s" %
|
||||||
|
(dt, '%s', '%s'), (abs(flt(outstanding[0][0])), si[0]))
|
22
patches/february_2013/gle_floating_point_issue_revisited.py
Normal file
22
patches/february_2013/gle_floating_point_issue_revisited.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
from webnotes.utils import flt
|
||||||
|
|
||||||
|
records = webnotes.conn.sql("""select name, grand_total, debit_to from `tabSales Invoice`
|
||||||
|
where docstatus = 1""", as_dict=1)
|
||||||
|
|
||||||
|
for r in records:
|
||||||
|
gle = webnotes.conn.sql("""select name, debit from `tabGL Entry`
|
||||||
|
where account = %s and voucher_type = 'Sales Invoice' and voucher_no = %s
|
||||||
|
and ifnull(is_cancelled, 'No') = 'No' limit 1""", (r.debit_to, r.name), as_dict=1)
|
||||||
|
if gle:
|
||||||
|
diff = round((flt(r.grand_total) - flt(gle[0]['debit'])), 2)
|
||||||
|
|
||||||
|
if abs(diff) == 0.01:
|
||||||
|
# print r.name, r.grand_total, gle[0]['debit']
|
||||||
|
webnotes.conn.sql("""update `tabGL Entry` set debit = debit + %s
|
||||||
|
where name = %s""", (diff, gle[0]['name']))
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update `tabGL Entry` set credit = credit - %s
|
||||||
|
where voucher_type = 'Sales Invoice' and voucher_no = %s
|
||||||
|
and credit > 0 limit 1""", (diff, r.name))
|
@ -167,5 +167,5 @@ patch_list = [
|
|||||||
"patches.february_2013.account_negative_balance",
|
"patches.february_2013.account_negative_balance",
|
||||||
"patches.february_2013.remove_account_utils_folder",
|
"patches.february_2013.remove_account_utils_folder",
|
||||||
"patches.february_2013.update_company_in_leave_application",
|
"patches.february_2013.update_company_in_leave_application",
|
||||||
"execute:webnotes.conn.sql_ddl('alter table tabSeries change `name` `name` varchar(100)')"
|
"execute:webnotes.conn.sql_ddl('alter table tabSeries change `name` `name` varchar(100)')",
|
||||||
]
|
]
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-28 10:06:02",
|
"creation": "2013-01-29 19:25:56",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 14:55:57",
|
"modified": "2013-02-13 09:56:28",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -110,6 +110,7 @@
|
|||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default": "This is the default number format. For currencies, please set the number format in the currency master.",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "number_format",
|
"fieldname": "number_format",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
@ -407,6 +408,11 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "SMS Sender Name"
|
"label": "SMS Sender Name"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user