Merge branch 'develop' into gst-category

This commit is contained in:
Anuja Pawar 2021-10-29 12:41:04 +05:30 committed by GitHub
commit 4589f39875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

View File

@ -114,6 +114,7 @@ def prepare_companywise_opening_balance(asset_data, liability_data, equity_data,
# opening_value = Aseet - liability - equity
for data in [asset_data, liability_data, equity_data]:
if data:
account_name = get_root_account_name(data[0].root_type, company)
opening_value += (get_opening_balance(account_name, data, company) or 0.0)

View File

@ -815,6 +815,38 @@ class AccountsController(TransactionBase):
if frappe.db.get_single_value('Accounts Settings', 'unlink_advance_payment_on_cancelation_of_order'):
unlink_ref_doc_from_payment_entries(self)
if self.doctype == "Sales Order":
self.unlink_ref_doc_from_po()
def unlink_ref_doc_from_po(self):
so_items = []
for item in self.items:
so_items.append(item.name)
linked_po = list(set(frappe.get_all(
'Purchase Order Item',
filters = {
'sales_order': self.name,
'sales_order_item': ['in', so_items],
'docstatus': ['<', 2]
},
pluck='parent'
)))
if linked_po:
frappe.db.set_value(
'Purchase Order Item', {
'sales_order': self.name,
'sales_order_item': ['in', so_items],
'docstatus': ['<', 2]
},{
'sales_order': None,
'sales_order_item': None
}
)
frappe.msgprint(_("Purchase Orders {0} are un-linked").format("\n".join(linked_po)))
def get_tax_map(self):
tax_map = {}
for tax in self.get('taxes'):

View File

@ -78,6 +78,8 @@ frappe.ui.form.on("Sales Order", {
});
erpnext.queries.setup_warehouse_query(frm);
frm.ignore_doctypes_on_cancel_all = ['Purchase Order'];
},
delivery_date: function(frm) {