Merge branch 'develop'
This commit is contained in:
commit
ae2e8996b0
@ -36,7 +36,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
"from_date": doc.posting_date,
|
"from_date": doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": doc.posting_date,
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report/General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
"from_date": doc.posting_date,
|
"from_date": doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": doc.posting_date,
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report/General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
|
|
||||||
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
|
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
|
||||||
|
|||||||
@ -3,20 +3,24 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt, add_days
|
||||||
from webnotes import _
|
from webnotes import _
|
||||||
|
from accounts.utils import get_balance_on
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
validate_filters(filters)
|
validate_filters(filters)
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
|
data = []
|
||||||
if filters.get("group_by"):
|
if filters.get("group_by"):
|
||||||
data = get_grouped_gle(filters)
|
data += get_grouped_gle(filters)
|
||||||
else:
|
else:
|
||||||
data = get_gl_entries(filters)
|
data += get_gl_entries(filters)
|
||||||
if data:
|
if data:
|
||||||
data.append(get_total_row(data))
|
data.append(get_total_row(data))
|
||||||
|
|
||||||
|
if filters.get("account"):
|
||||||
|
data = [get_opening_balance_row(filters)] + data + [get_closing_balance_row(filters)]
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def validate_filters(filters):
|
def validate_filters(filters):
|
||||||
@ -27,12 +31,20 @@ def validate_filters(filters):
|
|||||||
webnotes.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
webnotes.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Currency:100",
|
return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100",
|
||||||
"Credit:Currency:100", "Voucher Type::120", "Voucher No::160",
|
"Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20",
|
||||||
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
||||||
|
|
||||||
|
def get_opening_balance_row(filters):
|
||||||
|
opening_balance = get_balance_on(filters["account"], add_days(filters["from_date"], -1))
|
||||||
|
return ["", "Opening Balance", opening_balance, 0.0, "", "", ""]
|
||||||
|
|
||||||
|
def get_closing_balance_row(filters):
|
||||||
|
closing_balance = get_balance_on(filters["account"], filters["to_date"])
|
||||||
|
return ["", "Closing Balance", closing_balance, 0.0, "", "", ""]
|
||||||
|
|
||||||
def get_gl_entries(filters):
|
def get_gl_entries(filters):
|
||||||
return webnotes.conn.sql("""select
|
gl_entries = webnotes.conn.sql("""select
|
||||||
posting_date, account, debit, credit, voucher_type, voucher_no, cost_center, remarks
|
posting_date, account, debit, credit, voucher_type, voucher_no, cost_center, remarks
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%(company)s
|
where company=%(company)s
|
||||||
@ -40,6 +52,13 @@ def get_gl_entries(filters):
|
|||||||
{conditions}
|
{conditions}
|
||||||
order by posting_date, account"""\
|
order by posting_date, account"""\
|
||||||
.format(conditions=get_conditions(filters)), filters, as_list=1)
|
.format(conditions=get_conditions(filters)), filters, as_list=1)
|
||||||
|
|
||||||
|
for d in gl_entries:
|
||||||
|
icon = """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
|
||||||
|
% ("/".join(["#Form", d[4], d[5]]),)
|
||||||
|
d.insert(6, icon)
|
||||||
|
|
||||||
|
return gl_entries
|
||||||
|
|
||||||
def get_conditions(filters):
|
def get_conditions(filters):
|
||||||
conditions = []
|
conditions = []
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"app_name": "ERPNext",
|
"app_name": "ERPNext",
|
||||||
"app_version": "3.3.3",
|
"app_version": "3.3.4",
|
||||||
"base_template": "app/portal/templates/base.html",
|
"base_template": "app/portal/templates/base.html",
|
||||||
"modules": {
|
"modules": {
|
||||||
"Accounts": {
|
"Accounts": {
|
||||||
|
|||||||
@ -5,7 +5,8 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
import webnotes
|
import webnotes
|
||||||
|
webnotes.reload_doc('stock', 'doctype', 'packed_item')
|
||||||
for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
|
for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
|
||||||
webnotes.get_obj("Sales Invoice", si[0],
|
webnotes.get_obj("Sales Invoice", si[0],
|
||||||
with_children=1).update_qty(change_modified=False)
|
with_children=1).update_qty(change_modified=False)
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from webnotes.utils import fmt_money, formatdate, now_datetime, cstr, esc, \
|
|||||||
from webnotes.utils.dateutils import datetime_in_user_format
|
from webnotes.utils.dateutils import datetime_in_user_format
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
from webnotes.utils.email_lib import sendmail
|
||||||
|
|
||||||
content_sequence = [
|
content_sequence = [
|
||||||
["Income / Expenses", ["income_year_to_date", "bank_balance",
|
["Income / Expenses", ["income_year_to_date", "bank_balance",
|
||||||
@ -80,15 +81,15 @@ class DocType(DocListController):
|
|||||||
for user_id in recipients:
|
for user_id in recipients:
|
||||||
msg_for_this_receipient = self.get_msg_html(self.get_user_specific_content(user_id) + \
|
msg_for_this_receipient = self.get_msg_html(self.get_user_specific_content(user_id) + \
|
||||||
common_msg)
|
common_msg)
|
||||||
from webnotes.utils.email_lib import sendmail
|
if msg_for_this_receipient:
|
||||||
sendmail(recipients=user_id,
|
sendmail(recipients=user_id,
|
||||||
subject="[ERPNext] [{frequency} Digest] {name}".format(
|
subject="[ERPNext] [{frequency} Digest] {name}".format(
|
||||||
frequency=self.doc.frequency, name=self.doc.name),
|
frequency=self.doc.frequency, name=self.doc.name),
|
||||||
msg=msg_for_this_receipient)
|
msg=msg_for_this_receipient)
|
||||||
|
|
||||||
def get_digest_msg(self):
|
def get_digest_msg(self):
|
||||||
return self.get_msg_html(self.get_user_specific_content(webnotes.session.user) + \
|
return self.get_msg_html(self.get_user_specific_content(webnotes.session.user) + \
|
||||||
self.get_common_content())
|
self.get_common_content(), send_only_if_updates=False)
|
||||||
|
|
||||||
def get_common_content(self):
|
def get_common_content(self):
|
||||||
out = []
|
out = []
|
||||||
@ -119,14 +120,19 @@ class DocType(DocListController):
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_msg_html(self, out):
|
def get_msg_html(self, out, send_only_if_updates=True):
|
||||||
with_value = [o[1] for o in out if o[0]]
|
with_value = [o[1] for o in out if o[0]]
|
||||||
|
|
||||||
if with_value:
|
if with_value:
|
||||||
|
has_updates = True
|
||||||
with_value = "\n".join(with_value)
|
with_value = "\n".join(with_value)
|
||||||
else:
|
else:
|
||||||
|
has_updates = False
|
||||||
with_value = "<p>There were no updates in the items selected for this digest.</p><hr>"
|
with_value = "<p>There were no updates in the items selected for this digest.</p><hr>"
|
||||||
|
|
||||||
|
if not has_updates and send_only_if_updates:
|
||||||
|
return
|
||||||
|
|
||||||
# seperate out no value items
|
# seperate out no value items
|
||||||
no_value = [o[1] for o in out if not o[0]]
|
no_value = [o[1] for o in out if not o[0]]
|
||||||
if no_value:
|
if no_value:
|
||||||
|
|||||||
@ -13,10 +13,14 @@ def execute(filters=None):
|
|||||||
data = []
|
data = []
|
||||||
for sle in sl_entries:
|
for sle in sl_entries:
|
||||||
item_detail = item_details[sle.item_code]
|
item_detail = item_details[sle.item_code]
|
||||||
|
voucher_link_icon = """<a href="%s"><i class="icon icon-share"
|
||||||
|
style="cursor: pointer;"></i></a>""" \
|
||||||
|
% ("/".join(["#Form", sle.voucher_type, sle.voucher_no]),)
|
||||||
|
|
||||||
data.append([sle.date, sle.item_code, item_detail.item_name, item_detail.item_group,
|
data.append([sle.date, sle.item_code, item_detail.item_name, item_detail.item_group,
|
||||||
item_detail.brand, item_detail.description, sle.warehouse, item_detail.stock_uom,
|
item_detail.brand, item_detail.description, sle.warehouse, item_detail.stock_uom,
|
||||||
sle.actual_qty, sle.qty_after_transaction, sle.stock_value, sle.voucher_type,
|
sle.actual_qty, sle.qty_after_transaction, sle.stock_value, sle.voucher_type,
|
||||||
sle.voucher_no, sle.batch_no, sle.serial_no, sle.company])
|
sle.voucher_no, voucher_link_icon, sle.batch_no, sle.serial_no, sle.company])
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
@ -25,7 +29,7 @@ def get_columns():
|
|||||||
"Item Group:Link/Item Group:100", "Brand:Link/Brand:100",
|
"Item Group:Link/Item Group:100", "Brand:Link/Brand:100",
|
||||||
"Description::200", "Warehouse:Link/Warehouse:100",
|
"Description::200", "Warehouse:Link/Warehouse:100",
|
||||||
"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:80",
|
"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:80",
|
||||||
"Balance Value:Currency:100", "Voucher Type::100", "Voucher #::100",
|
"Balance Value:Currency:100", "Voucher Type::100", "Voucher #::100", "Link::30",
|
||||||
"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
|
"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
|
||||||
|
|
||||||
def get_stock_ledger_entries(filters):
|
def get_stock_ledger_entries(filters):
|
||||||
|
|||||||
@ -20,7 +20,7 @@ def execute(filters=None):
|
|||||||
where item_code = item.name and warehouse = wh.name
|
where item_code = item.name and warehouse = wh.name
|
||||||
order by item.name, wh.name"""\
|
order by item.name, wh.name"""\
|
||||||
.format(item_conditions=get_item_conditions(filters),
|
.format(item_conditions=get_item_conditions(filters),
|
||||||
warehouse_conditions=get_warehouse_conditions(filters)), filters, debug=1)
|
warehouse_conditions=get_warehouse_conditions(filters)), filters)
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user