Merge branch 'hotfix' of https://github.com/frappe/erpnext into hotfix

This commit is contained in:
scmmishra 2019-03-29 20:05:40 +05:30
commit 6f82f96816
7 changed files with 35 additions and 26 deletions

View File

@ -42,8 +42,8 @@ class BankReconciliation(Document):
select select
"Payment Entry" as payment_document, name as payment_entry, "Payment Entry" as payment_document, name as payment_entry,
reference_no as cheque_number, reference_date as cheque_date, reference_no as cheque_number, reference_date as cheque_date,
if(paid_from=%(account)s, paid_amount, "") as credit, if(paid_from=%(account)s, paid_amount, 0) as credit,
if(paid_from=%(account)s, "", received_amount) as debit, if(paid_from=%(account)s, 0, received_amount) as debit,
posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date, posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
from `tabPayment Entry` from `tabPayment Entry`

View File

@ -452,7 +452,7 @@ class SalarySlip(TransactionBase):
self.set_loan_repayment() self.set_loan_repayment()
self.net_pay = flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment)) self.net_pay = (flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment))) * flt(self.payment_days / self.total_working_days)
self.rounded_total = rounded(self.net_pay, self.rounded_total = rounded(self.net_pay,
self.precision("net_pay") if disable_rounded_total else 0) self.precision("net_pay") if disable_rounded_total else 0)

View File

@ -159,6 +159,13 @@ class Task(NestedSet):
self.update_nsm_model() self.update_nsm_model()
def update_status(self):
if self.status not in ('Cancelled', 'Closed') and self.exp_end_date:
from datetime import datetime
if self.exp_end_date < datetime.now().date():
self.db_set('status', 'Overdue')
self.update_project()
@frappe.whitelist() @frappe.whitelist()
def check_if_child_exists(name): def check_if_child_exists(name):
child_tasks = frappe.get_all("Task", filters={"parent_task": name}) child_tasks = frappe.get_all("Task", filters={"parent_task": name})
@ -186,10 +193,9 @@ def set_multiple_status(names, status):
task.save() task.save()
def set_tasks_as_overdue(): def set_tasks_as_overdue():
frappe.db.sql("""update tabTask set `status`='Overdue' tasks = frappe.get_all("Task", filters={'status':['not in',['Cancelled', 'Closed']]})
where exp_end_date is not null for task in tasks:
and exp_end_date < CURDATE() frappe.get_doc("Task", task.name).update_status()
and `status` not in ('Closed', 'Cancelled')""")
@frappe.whitelist() @frappe.whitelist()
def get_children(doctype, parent, task=None, project=None, is_root=False): def get_children(doctype, parent, task=None, project=None, is_root=False):

View File

@ -758,6 +758,9 @@ class Item(WebsiteGenerator):
d.conversion_factor = value d.conversion_factor = value
def validate_attributes(self): def validate_attributes(self):
if not self.variant_based_on:
self.variant_based_on = 'Item Attribute'
if (self.has_variants or self.variant_of) and self.variant_based_on == 'Item Attribute': if (self.has_variants or self.variant_of) and self.variant_based_on == 'Item Attribute':
attributes = [] attributes = []
if not self.attributes: if not self.attributes:
@ -780,7 +783,7 @@ class Item(WebsiteGenerator):
variant = get_variant(self.variant_of, args, self.name) variant = get_variant(self.variant_of, args, self.name)
if variant: if variant:
frappe.throw(_("Item variant {0} exists with same attributes") frappe.throw(_("Item variant {0} exists with same attributes")
.format(variant), ItemVariantExistsError) .format(variant), ItemVariantExistsError)
validate_item_variant_attributes(self, args) validate_item_variant_attributes(self, args)

View File

@ -17,7 +17,7 @@ from erpnext.stock.get_item_details import get_item_details
from six import iteritems from six import iteritems
test_ignore = ["BOM"] test_ignore = ["BOM"]
test_dependencies = ["Warehouse", "Item Group"] test_dependencies = ["Warehouse", "Item Group", "Brand"]
def make_item(item_code, properties=None): def make_item(item_code, properties=None):
if frappe.db.exists("Item", item_code): if frappe.db.exists("Item", item_code):