Merge branch 'master' into develop
This commit is contained in:
commit
f89f17cdde
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.1.18'
|
__version__ = '7.1.19'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -68,7 +68,7 @@ class JournalEntry(AccountsController):
|
|||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
||||||
from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
|
from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
|
||||||
unlink_ref_doc_from_payment_entries(self.doctype, self.name)
|
unlink_ref_doc_from_payment_entries(self)
|
||||||
unlink_ref_doc_from_salary_slip(self.name)
|
unlink_ref_doc_from_salary_slip(self.name)
|
||||||
self.make_gl_entries(1)
|
self.make_gl_entries(1)
|
||||||
self.update_advance_paid()
|
self.update_advance_paid()
|
||||||
|
@ -583,7 +583,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
if not self.is_return:
|
if not self.is_return:
|
||||||
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
||||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
||||||
unlink_ref_doc_from_payment_entries(self.doctype, self.name)
|
unlink_ref_doc_from_payment_entries(self)
|
||||||
|
|
||||||
self.update_prevdoc_status()
|
self.update_prevdoc_status()
|
||||||
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
|
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
|
||||||
|
@ -138,7 +138,7 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
||||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
||||||
unlink_ref_doc_from_payment_entries(self.doctype, self.name)
|
unlink_ref_doc_from_payment_entries(self)
|
||||||
|
|
||||||
if self.is_return:
|
if self.is_return:
|
||||||
# NOTE status updating bypassed for is_return
|
# NOTE status updating bypassed for is_return
|
||||||
|
@ -401,16 +401,22 @@ def update_reference_in_payment_entry(d, payment_entry):
|
|||||||
payment_entry.set_amounts()
|
payment_entry.set_amounts()
|
||||||
payment_entry.save(ignore_permissions=True)
|
payment_entry.save(ignore_permissions=True)
|
||||||
|
|
||||||
def unlink_ref_doc_from_payment_entries(ref_type, ref_no):
|
def unlink_ref_doc_from_payment_entries(ref_doc):
|
||||||
remove_ref_doc_link_from_jv(ref_type, ref_no)
|
remove_ref_doc_link_from_jv(ref_doc.doctype, ref_doc.name)
|
||||||
remove_ref_doc_link_from_pe(ref_type, ref_no)
|
remove_ref_doc_link_from_pe(ref_doc.doctype, ref_doc.name)
|
||||||
|
|
||||||
frappe.db.sql("""update `tabGL Entry`
|
frappe.db.sql("""update `tabGL Entry`
|
||||||
set against_voucher_type=null, against_voucher=null,
|
set against_voucher_type=null, against_voucher=null,
|
||||||
modified=%s, modified_by=%s
|
modified=%s, modified_by=%s
|
||||||
where against_voucher_type=%s and against_voucher=%s
|
where against_voucher_type=%s and against_voucher=%s
|
||||||
and voucher_no != ifnull(against_voucher, '')""",
|
and voucher_no != ifnull(against_voucher, '')""",
|
||||||
(now(), frappe.session.user, ref_type, ref_no))
|
(now(), frappe.session.user, ref_doc.doctype, ref_doc.name))
|
||||||
|
|
||||||
|
if ref_doc.doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||||
|
ref_doc.set("advances", [])
|
||||||
|
|
||||||
|
frappe.db.sql("""delete from `tab{0} Advance` where parent = %s"""
|
||||||
|
.format(ref_doc.doctype), ref_doc.name)
|
||||||
|
|
||||||
def remove_ref_doc_link_from_jv(ref_type, ref_no):
|
def remove_ref_doc_link_from_jv(ref_type, ref_no):
|
||||||
linked_jv = frappe.db.sql_list("""select parent from `tabJournal Entry Account`
|
linked_jv = frappe.db.sql_list("""select parent from `tabJournal Entry Account`
|
||||||
|
@ -565,6 +565,21 @@ class AccountsController(TransactionBase):
|
|||||||
elif asset.status in ("Scrapped", "Cancelled", "Sold"):
|
elif asset.status in ("Scrapped", "Cancelled", "Sold"):
|
||||||
frappe.throw(_("Row #{0}: Asset {1} cannot be submitted, it is already {2}")
|
frappe.throw(_("Row #{0}: Asset {1} cannot be submitted, it is already {2}")
|
||||||
.format(d.idx, d.asset, asset.status))
|
.format(d.idx, d.asset, asset.status))
|
||||||
|
|
||||||
|
def delink_advance_entries(self, linked_doc_name):
|
||||||
|
total_allocated_amount = 0
|
||||||
|
for adv in self.advances:
|
||||||
|
consider_for_total_advance = True
|
||||||
|
if adv.reference_name == linked_doc_name:
|
||||||
|
frappe.db.sql("""delete from `tab{0} Advance`
|
||||||
|
where name = %s""".format(self.doctype), adv.name)
|
||||||
|
consider_for_total_advance = False
|
||||||
|
|
||||||
|
if consider_for_total_advance:
|
||||||
|
total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
|
||||||
|
|
||||||
|
frappe.db.set_value(self.doctype, self.name, "total_advance",
|
||||||
|
total_allocated_amount, update_modified=False)
|
||||||
|
|
||||||
def group_similar_items(self):
|
def group_similar_items(self):
|
||||||
group_item_qty = {}
|
group_item_qty = {}
|
||||||
|
@ -125,20 +125,6 @@ class TransactionBase(StatusUpdater):
|
|||||||
ret = None
|
ret = None
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def delink_advance_entries(self, linked_doc_name):
|
|
||||||
total_allocated_amount = 0
|
|
||||||
for adv in self.advances:
|
|
||||||
consider_for_total_advance = True
|
|
||||||
if adv.reference_name == linked_doc_name:
|
|
||||||
frappe.db.sql("""delete from `tab{0} Advance`
|
|
||||||
where name = %s""".format(self.doctype), adv.name)
|
|
||||||
consider_for_total_advance = False
|
|
||||||
|
|
||||||
if consider_for_total_advance:
|
|
||||||
total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
|
|
||||||
|
|
||||||
frappe.db.set_value(self.doctype, self.name, "total_advance", total_allocated_amount, update_modified=False)
|
|
||||||
|
|
||||||
def delete_events(ref_type, ref_name):
|
def delete_events(ref_type, ref_name):
|
||||||
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user