Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait committed Apr 25, 2017
2 parents 398f144 + 8590d5b commit e7125c0
Show file tree
Hide file tree
Showing 31 changed files with 741 additions and 264 deletions.
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe

__version__ = '8.0.16'
__version__ = '8.0.17'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/journal_entry/journal_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def get_values(self):

def update_expense_claim(self):
for d in self.accounts:
if d.reference_type=="Expense Claim" and d.party:
if d.reference_type=="Expense Claim" and d.reference_name:
doc = frappe.get_doc("Expense Claim", d.reference_name)
update_reimbursed_amount(doc)

Expand Down
18 changes: 15 additions & 3 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldtype": "Link",
"options": "Customer"
},
{
"fieldname":"customer_group",
"label": __("Customer Group"),
"fieldtype": "Link",
"options": "Customer Group"
},
{
"fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"),
"fieldtype": "Select",
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
},
{
"fieldtype": "Break",
},
{
"fieldname":"report_date",
"label": __("As on Date"),
Expand All @@ -29,9 +44,6 @@ frappe.query_reports["Accounts Receivable"] = {
"options": 'Posting Date' + NEWLINE + 'Due Date',
"default": "Posting Date"
},
{
"fieldtype": "Break",
},
{
"fieldname":"range1",
"label": __("Ageing Range 1"),
Expand Down
33 changes: 26 additions & 7 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def get_columns(self, party_naming_by, args):
"width": 100
})
if args.get("party_type") == "Customer":
columns += [_("Territory") + ":Link/Territory:80"]
columns += [
_("Territory") + ":Link/Territory:80",
_("Customer Group") + ":Link/Customer Group:120"
]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]

Expand Down Expand Up @@ -139,7 +142,7 @@ def get_data(self, party_naming_by, args):

# customer territory / supplier type
if args.get("party_type") == "Customer":
row += [self.get_territory(gle.party)]
row += [self.get_territory(gle.party), self.get_customer_group(gle.party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(gle.party)]

Expand Down Expand Up @@ -186,19 +189,22 @@ def get_party_name(self, party_type, party_name):

def get_territory(self, party_name):
return self.get_party_map("Customer").get(party_name, {}).get("territory") or ""

def get_customer_group(self, party_name):
return self.get_party_map("Customer").get(party_name, {}).get("customer_group") or ""

def get_supplier_type(self, party_name):
return self.get_party_map("Supplier").get(party_name, {}).get("supplier_type") or ""

def get_party_map(self, party_type):
if not hasattr(self, "party_map"):
if party_type == "Customer":
self.party_map = dict(((r.name, r) for r in frappe.db.sql("""select {0}, {1}, {2} from `tab{3}`"""
.format("name", "customer_name", "territory", party_type), as_dict=True)))

select_fields = "name, customer_name, territory, customer_group"
elif party_type == "Supplier":
self.party_map = dict(((r.name, r) for r in frappe.db.sql("""select {0}, {1}, {2} from `tab{3}`"""
.format("name", "supplier_name", "supplier_type", party_type), as_dict=True)))
select_fields = "name, supplier_name, supplier_type"

self.party_map = dict(((r.name, r) for r in frappe.db.sql("select {0} from `tab{1}`"
.format(select_fields, party_type), as_dict=True)))

return self.party_map

Expand Down Expand Up @@ -251,6 +257,19 @@ def prepare_conditions(self, party_type):
conditions.append("party=%s")
values.append(self.filters.get(party_type_field))

if party_type_field=="customer":
if self.filters.get("customer_group"):
lft, rgt = frappe.db.get_value("Customer Group",
self.filters.get("customer_group"), ["lft", "rgt"])

conditions.append("""party in (select name from tabCustomer
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
and name=tabCustomer.customer_group))""".format(lft, rgt))

if self.filters.get("credit_days_based_on"):
conditions.append("party in (select name from tabCustomer where credit_days_based_on=%s)")
values.append(self.filters.get("credit_days_based_on"))

return " and ".join(conditions), values

def get_gl_entries_for(self, party, party_type, against_voucher_type, against_voucher):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldtype": "Link",
"options": "Customer"
},
{
"fieldname":"customer_group",
"label": __("Customer Group"),
"fieldtype": "Link",
"options": "Customer Group"
},
{
"fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"),
"fieldtype": "Select",
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
},
{
"fieldtype": "Break",
},
{
"fieldname":"report_date",
"label": __("Date"),
Expand All @@ -29,9 +44,6 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"options": 'Posting Date' + NEWLINE + 'Due Date',
"default": "Posting Date"
},
{
"fieldtype": "Break",
},
{
"fieldname":"range1",
"label": __("Ageing Range 1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def get_columns(self, party_naming_by, args):
str(self.filters.range3) + _("-Above") + ":Currency/currency:100"]

if args.get("party_type") == "Customer":
columns += [_("Territory") + ":Link/Territory:80"]
columns += [
_("Territory") + ":Link/Territory:80",
_("Customer Group") + ":Link/Customer Group:120"
]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]

Expand Down Expand Up @@ -58,7 +61,7 @@ def get_data(self, party_naming_by, args):
]

if args.get("party_type") == "Customer":
row += [self.get_territory(party)]
row += [self.get_territory(party), self.get_customer_group(party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(party)]

Expand Down Expand Up @@ -107,7 +110,7 @@ def get_voucherwise_data(self, party_naming_by, args):
if args.get("party_type") == "Supplier":
cols += ["supplier_type", "remarks"]
if args.get("party_type") == "Customer":
cols += ["territory", "remarks"]
cols += ["territory", "customer_group", "remarks"]

return self.make_data_dict(cols, voucherwise_data)

Expand Down
21 changes: 10 additions & 11 deletions erpnext/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from __future__ import unicode_literals

import frappe
import frappe.defaults
from frappe.utils import nowdate, cstr, flt, cint, now, getdate
from frappe import throw, _
from frappe.utils import formatdate
from frappe.utils import formatdate, get_number_format_info

# imported to enable erpnext.accounts.utils.get_account_currency
from erpnext.accounts.doctype.account.account import get_account_currency
import frappe.defaults
from erpnext.accounts.report.financial_statements import sort_root_accounts

class FiscalYearError(frappe.ValidationError): pass
Expand Down Expand Up @@ -537,15 +537,14 @@ def get_stock_and_account_difference(account_list=None, posting_date=None):

return difference

def get_currency_precision(currency=None):
if not currency:
currency = frappe.db.get_value("Company",
frappe.db.get_default("Company"), "default_currency", cache=True)
currency_format = frappe.db.get_value("Currency", currency, "number_format", cache=True)

from frappe.utils import get_number_format_info
return get_number_format_info(currency_format)[2]

def get_currency_precision():
precision = cint(frappe.db.get_default("currency_precision"))
if not precision:
number_format = frappe.db.get_default("number_format") or "#,###.##"
precision = get_number_format_info(number_format)[2]

return precision

def get_stock_rbnb_difference(posting_date, company):
stock_items = frappe.db.sql_list("""select distinct item_code
from `tabStock Ledger Entry` where company=%s""", company)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "9",
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"print_width": "100px",
Expand Down Expand Up @@ -1659,7 +1659,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-04-18 18:49:08.604055",
"modified": "2017-04-25 18:49:08.604055",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
Expand Down
10 changes: 8 additions & 2 deletions erpnext/hr/doctype/expense_claim/expense_claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({
});
},

expense_type: function(frm, cdt, cdn) {
expense_type: function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!doc.company) {
d.expense_type = "";
frappe.msgprint(__("Please set the Company"));
this.frm.refresh_fields()
return;
}

return frappe.call({
method: "erpnext.hr.doctype.expense_claim.expense_claim.get_expense_claim_account",
args: {
"expense_claim_type": d.expense_type,
"company": frm.company
"company": doc.company
},
callback: function(r) {
if (r.message) {
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,4 @@ erpnext.patches.v8_0.rename_is_sample_item_to_allow_zero_valuation_rate
erpnext.patches.v8_0.set_null_to_serial_nos_for_disabled_sales_invoices
erpnext.patches.v8_0.enable_booking_asset_depreciation_automatically
erpnext.patches.v8_0.set_project_copied_from
erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import frappe

def execute():
""" set status as Paid in Expense Claim if total_sactioned_amount
and total_amount_reimbursed is equal """

frappe.db.sql("""
update
`tabExpense Claim`
set status = 'Paid'
where
total_sanctioned_amount = total_amount_reimbursed
""")
3 changes: 3 additions & 0 deletions erpnext/public/css/erpnext.css
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ body[data-route="pos"] .item-list {
body[data-route="pos"] .item-list .image-field {
height: 140px;
}
body[data-route="pos"] .item-list .image-field .placeholder-text {
font-size: 50px;
}
body[data-route="pos"] .item-list .pos-item-wrapper {
position: relative;
}
Expand Down
4 changes: 4 additions & 0 deletions erpnext/public/less/erpnext.less
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ body[data-route="pos"] {

.image-field {
height: 140px;

.placeholder-text {
font-size: 50px;
}
}

.pos-item-wrapper {
Expand Down
3 changes: 2 additions & 1 deletion erpnext/schools/doctype/assessment_plan/assessment_plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ frappe.ui.form.on("Assessment Plan", {
if (frm.doc.docstatus == 1) {
frm.add_custom_button(__("Assessment Result"), function() {
frappe.route_options = {
assessment_plan: frm.doc.name
assessment_plan: frm.doc.name,
student_batch: frm.doc.student_batch
}
frappe.set_route("Form", "Assessment Result Tool");
});
Expand Down
Loading

0 comments on commit e7125c0

Please sign in to comment.