Skip to content

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait committed Dec 13, 2016
2 parents 67b6e2f + 9d56d59 commit 3bfe01d
Show file tree
Hide file tree
Showing 19 changed files with 506 additions and 165 deletions.
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe

__version__ = '7.1.23'
__version__ = '7.1.24'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/account/account_tree.js
Expand Up @@ -34,7 +34,7 @@ frappe.treeview_settings["Account"] = {
description: __("Optional. This setting will be used to filter in various transactions.")
},
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
depends_on: 'eval:doc.is_group==1&&doc.account_type=="Tax"'},
depends_on: 'eval:doc.is_group==0&&doc.account_type=="Tax"'},
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse",
depends_on: 'eval:(!doc.is_group&&doc.account_type=="Stock")',
get_query: function() {
Expand Down
29 changes: 27 additions & 2 deletions erpnext/accounts/doctype/payment_request/payment_request.json
Expand Up @@ -32,6 +32,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
Expand All @@ -58,6 +59,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -86,6 +88,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -112,6 +115,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -138,6 +142,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -163,6 +168,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -190,6 +196,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -217,6 +224,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -245,6 +253,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -273,6 +282,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -300,6 +310,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -325,6 +336,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -351,6 +363,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -378,6 +391,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -404,6 +418,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
Expand All @@ -416,7 +431,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "payment_url",
"fieldtype": "Data",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
Expand All @@ -430,6 +445,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -457,6 +473,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -484,6 +501,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -511,6 +529,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -537,6 +556,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -564,6 +584,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
Expand Down Expand Up @@ -591,6 +612,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
Expand All @@ -617,6 +639,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
Expand All @@ -634,7 +657,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-09-02 04:07:15.279949",
"modified": "2016-12-12 13:30:42.858205",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",
Expand All @@ -651,6 +674,7 @@
"export": 1,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
Expand All @@ -671,6 +695,7 @@
"export": 1,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
Expand Down
24 changes: 0 additions & 24 deletions erpnext/accounts/doctype/pos_profile/pos_profile.js
Expand Up @@ -26,30 +26,6 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
});
});

frappe.ui.form.on("POS Profile", {
setup: function(frm) {
frm.trigger("get_query_for_groups")
},

get_query_for_groups: function(frm) {
frm.fields_dict['item_groups'].grid.get_field('item_group').get_query = function(frm, cdt, cdn) {
return{
filters: {
'is_group': 0
}
}
}

frm.fields_dict['customer_groups'].grid.get_field('customer_group').get_query = function(frm, cdt, cdn) {
return{
filters: {
'is_group': 0
}
}
}
}
})

// Income Account
// --------------------------------
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
Expand Down
13 changes: 11 additions & 2 deletions erpnext/accounts/doctype/pricing_rule/pricing_rule.py
Expand Up @@ -126,6 +126,8 @@ def get_pricing_rule_for_item(args):
})

if args.ignore_pricing_rule or not args.item_code:
if args.name and args.get("pricing_rule"):
item_details = remove_pricing_rule(args, item_details)
return item_details

if not (args.item_group and args.brand):
Expand Down Expand Up @@ -166,9 +168,16 @@ def get_pricing_rule_for_item(args):
else:
item_details.discount_percentage = pricing_rule.discount_percentage
elif args.get('pricing_rule'):
if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage':
item_details.discount_percentage = 0.0
item_details = remove_pricing_rule(args, item_details)

return item_details

def remove_pricing_rule(args, item_details):
pricing_rule = frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), ['price_or_discount', 'margin_type'], as_dict=1)
if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
item_details.discount_percentage = 0.0

if pricing_rule and pricing_rule.margin_type in ['Percentage', 'Amount']:
item_details.margin_rate_or_amount = 0.0
item_details.margin_type = None

Expand Down
21 changes: 13 additions & 8 deletions erpnext/accounts/doctype/sales_invoice/pos.py
Expand Up @@ -115,9 +115,9 @@ def get_items_list(pos_profile):
item_groups = []
if pos_profile.get('item_groups'):
# Get items based on the item groups defined in the POS profile

cond = "item_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('item_groups'))))
item_groups = [d.item_group for d in pos_profile.get('item_groups')]
for d in pos_profile.get('item_groups'):
item_groups.extend(get_child_nodes('Item Group', d.item_group))
cond = "item_group in (%s)"%(', '.join(['%s']*len(item_groups)))

return frappe.db.sql("""
select
Expand All @@ -135,14 +135,19 @@ def get_customers_list(pos_profile):
customer_groups = []
if pos_profile.get('customer_groups'):
# Get customers based on the customer groups defined in the POS profile

cond = "customer_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('customer_groups'))))
customer_groups = [d.customer_group for d in pos_profile.get('customer_groups')]
for d in pos_profile.get('customer_groups'):
customer_groups.extend(get_child_nodes('Customer Group', d.customer_group))
cond = "customer_group in (%s)"%(', '.join(['%s']*len(customer_groups)))

return frappe.db.sql(""" select name, customer_name, customer_group,
territory from tabCustomer where disabled = 0
and {cond}""".format(cond=cond), tuple(customer_groups), as_dict=1) or {}

def get_child_nodes(group_type, root):
lft, rgt = frappe.db.get_value(group_type, root, ["lft", "rgt"])
return frappe.db.sql_list(""" Select name from `tab{tab}` where
lft >= {lft} and rgt <= {rgt}""".format(tab=group_type, lft=lft, rgt=rgt))

def get_serial_no_data(pos_profile, company):
# get itemwise serial no data
# example {'Nokia Lumia 1020': {'SN0001': 'Pune'}}
Expand Down Expand Up @@ -240,8 +245,7 @@ def make_invoice(doc_list):

for docs in doc_list:
for name, doc in docs.items():
if not frappe.db.exists('Sales Invoice',
{'offline_pos_name': name, 'docstatus': ("<", "2")}):
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
validate_records(doc)
si_doc = frappe.new_doc('Sales Invoice')
si_doc.offline_pos_name = name
Expand Down Expand Up @@ -286,6 +290,7 @@ def submit_invoice(si_doc, name):
try:
si_doc.insert()
si_doc.submit()
frappe.db.commit()
except Exception, e:
if frappe.message_log: frappe.message_log.pop()
frappe.db.rollback()
Expand Down
1 change: 0 additions & 1 deletion erpnext/hr/doctype/salary_slip/salary_slip.py
Expand Up @@ -223,7 +223,6 @@ def get_leave_details(self, joining_date=None, relieving_date=None, lwp=None):
["date_of_joining", "relieving_date"])

holidays = self.get_holidays_for_employee(self.start_date, self.end_date)

working_days = date_diff(self.end_date, self.start_date) + 1
if not cint(frappe.db.get_value("HR Settings", None, "include_holidays_in_total_working_days")):
working_days -= len(holidays)
Expand Down

0 comments on commit 3bfe01d

Please sign in to comment.