diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 38cef3134e..adc30e2de7 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -302,6 +302,9 @@ class PurchaseInvoice(BuyingController): asset.save() def make_gl_entries(self, repost_future_gle=True): + if not self.grand_total: + return + self.auto_accounting_for_stock = \ cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a5028c5ee5..2b64d17046 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -491,6 +491,8 @@ class SalesInvoice(SellingController): throw(_("Delivery Note {0} is not submitted").format(d.delivery_note)) def make_gl_entries(self, repost_future_gle=True): + if not self.grand_total: + return gl_entries = self.get_gl_entries() if gl_entries: diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6c2a14b50c..a9d978a9c7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -40,14 +40,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } } } - this.frm.set_query("difference_account", function() { - return { - "filters": { - "company": me.frm.doc.company, - "is_group": 0 - } - }; - }); } this.frm.get_field('items').grid.editable_fields = [ diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index b5efc90010..0ab80c28fe 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -844,33 +844,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "description": "", - "fieldname": "difference_account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Difference Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -1431,7 +1404,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-07 06:40:03.284036", + "modified": "2016-09-08 06:40:03.284036", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index e35f3d2965..b1f8c9c676 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -71,9 +71,6 @@ class StockEntry(StockController): if self.purpose not in valid_purposes: frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes))) - if self.purpose in ("Manufacture", "Repack") and not self.difference_account: - self.difference_account = frappe.db.get_value("Company", self.company, "default_expense_account") - def set_transfer_qty(self): for item in self.get("items"): if not flt(item.qty): @@ -97,9 +94,6 @@ class StockEntry(StockController): if f in ["stock_uom", "conversion_factor"] or not item.get(f): item.set(f, item_details.get(f)) - if self.difference_account and not item.expense_account: - item.expense_account = self.difference_account - if not item.transfer_qty and item.qty: item.transfer_qty = item.qty * item.conversion_factor diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py index b75eeeadd7..cb3bb7bc5e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py @@ -57,8 +57,6 @@ def make_stock_entry(**args): s.purchase_receipt_no = args.purchase_receipt_no s.delivery_note_no = args.delivery_note_no s.sales_invoice_no = args.sales_invoice_no - if args.difference_account: - s.difference_account = args.difference_account if not args.cost_center: args.cost_center = frappe.get_value('Company', s.company, 'cost_center')