Merge branch 'develop' of https://github.com/frappe/erpnext into so-on-hold
This commit is contained in:
@@ -119,6 +119,12 @@ class AccountsController(TransactionBase):
|
||||
self.validate_non_invoice_documents_schedule()
|
||||
|
||||
def before_print(self):
|
||||
if self.doctype in ['Journal Entry', 'Payment Entry', 'Sales Invoice', 'Purchase Invoice']:
|
||||
self.gl_entries = frappe.get_list("GL Entry", filters={
|
||||
"voucher_type": self.doctype,
|
||||
"voucher_no": self.name
|
||||
}, fields=["account", "party_type", "party", "debit", "credit", "remarks"])
|
||||
|
||||
if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice',
|
||||
'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']:
|
||||
if self.get("group_same_items"):
|
||||
@@ -276,7 +282,7 @@ class AccountsController(TransactionBase):
|
||||
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
|
||||
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
|
||||
|
||||
if ret.get("pricing_rules"):
|
||||
if ret.get("pricing_rules") and not ret.get("validate_applied_rule", 0):
|
||||
# if user changed the discount percentage then set user's discount percentage ?
|
||||
item.set("pricing_rules", ret.get("pricing_rules"))
|
||||
item.set("discount_percentage", ret.get("discount_percentage"))
|
||||
@@ -546,6 +552,19 @@ class AccountsController(TransactionBase):
|
||||
from erpnext.accounts.utils import reconcile_against_document
|
||||
reconcile_against_document(lst)
|
||||
|
||||
def on_cancel(self):
|
||||
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
|
||||
|
||||
if self.doctype in ["Sales Invoice", "Purchase Invoice"]:
|
||||
if self.is_return: return
|
||||
|
||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
||||
unlink_ref_doc_from_payment_entries(self)
|
||||
|
||||
elif self.doctype in ["Sales Order", "Purchase Order"]:
|
||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_advance_payment_on_cancelation_of_order'):
|
||||
unlink_ref_doc_from_payment_entries(self)
|
||||
|
||||
def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield):
|
||||
from erpnext.controllers.status_updater import get_tolerance_for
|
||||
item_tolerance = {}
|
||||
|
||||
@@ -538,6 +538,8 @@ class BuyingController(StockController):
|
||||
update_last_purchase_rate(self, is_submit = 1)
|
||||
|
||||
def on_cancel(self):
|
||||
super(BuyingController, self).on_cancel()
|
||||
|
||||
if self.get('is_return'):
|
||||
return
|
||||
|
||||
@@ -736,7 +738,7 @@ def get_subcontracted_raw_materials_from_se(purchase_orders):
|
||||
sed.stock_uom, sed.subcontracted_item as main_item_code, sed.serial_no, sed.batch_no
|
||||
from `tabStock Entry` se,`tabStock Entry Detail` sed
|
||||
where
|
||||
se.name = sed.parent and se.docstatus=1 and se.purpose='Subcontract'
|
||||
se.name = sed.parent and se.docstatus=1 and se.purpose='Send to Subcontractor'
|
||||
and se.purchase_order in (%s) and ifnull(sed.t_warehouse, '') != ''
|
||||
group by sed.item_code, sed.t_warehouse
|
||||
""" % (','.join(['%s'] * len(purchase_orders))), tuple(purchase_orders), as_dict=1)
|
||||
|
||||
Reference in New Issue
Block a user