Merge branch 'hotfix'
This commit is contained in:
commit
30a25e11f7
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.0.43'
|
__version__ = '7.0.44'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -80,7 +80,7 @@ class Asset(Document):
|
|||||||
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
|
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
|
||||||
|
|
||||||
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
|
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
|
||||||
frappe.throw(_("Next Depreciation Date must be on or after today"))
|
frappe.msgprint(_("Next Depreciation Date is entered as past date"))
|
||||||
|
|
||||||
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
|
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
|
||||||
and not self.next_depreciation_date):
|
and not self.next_depreciation_date):
|
||||||
|
@ -317,3 +317,4 @@ erpnext.patches.v7_0.update_missing_employee_in_timesheet
|
|||||||
erpnext.patches.v7_0.update_status_for_timesheet
|
erpnext.patches.v7_0.update_status_for_timesheet
|
||||||
erpnext.patches.v7_0.set_party_name_in_payment_entry
|
erpnext.patches.v7_0.set_party_name_in_payment_entry
|
||||||
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
|
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
|
||||||
|
erpnext.patches.v7_0.update_mode_of_payment_type
|
||||||
|
29
erpnext/patches/v7_0/update_mode_of_payment_type.py
Normal file
29
erpnext/patches/v7_0/update_mode_of_payment_type.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.utils import flt
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc('accounts', 'doctype', 'mode_of_payment')
|
||||||
|
|
||||||
|
frappe.db.sql(""" update `tabMode of Payment` set type = 'Cash' where (type is null or type = '') and name = 'Cash'""")
|
||||||
|
|
||||||
|
for data in frappe.db.sql("""select name from `tabSales Invoice` where is_pos=1 and docstatus<2 and
|
||||||
|
(ifnull(paid_amount, 0) - ifnull(change_amount, 0)) > ifnull(grand_total, 0) and modified > '2016-05-01'""", as_dict=1):
|
||||||
|
if data.name:
|
||||||
|
si_doc = frappe.get_doc("Sales Invoice", data.name)
|
||||||
|
remove_payment = []
|
||||||
|
mode_of_payment = [d.mode_of_payment for d in si_doc.payments if flt(d.amount) > 0]
|
||||||
|
if mode_of_payment != set(mode_of_payment):
|
||||||
|
for payment_data in si_doc.payments:
|
||||||
|
if payment_data.idx != 1 and payment_data.amount == si_doc.grand_total:
|
||||||
|
remove_payment.append(payment_data)
|
||||||
|
frappe.db.sql(""" delete from `tabSales Invoice Payment`
|
||||||
|
where name = %(name)s""", {'name': payment_data.name})
|
||||||
|
|
||||||
|
if len(remove_payment) > 0:
|
||||||
|
for d in remove_payment:
|
||||||
|
si_doc.remove(d)
|
||||||
|
|
||||||
|
si_doc.set_paid_amount()
|
||||||
|
si_doc.db_set("paid_amount", si_doc.paid_amount, update_modified = False)
|
||||||
|
si_doc.db_set("base_paid_amount", si_doc.base_paid_amount, update_modified = False)
|
Loading…
x
Reference in New Issue
Block a user