Merge pull request #6124 from rohitwaghchaure/hotfix
[POS] Fixed issue of paid amount, write off account
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index fcdff21..3f25e02 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -204,10 +204,10 @@
from erpnext.stock.stock_ledger import make_sl_entries
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
- def make_gl_entries_on_cancel(self):
+ def make_gl_entries_on_cancel(self, repost_future_gle=True):
if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s
and voucher_no=%s""", (self.doctype, self.name)):
- self.make_gl_entries()
+ self.make_gl_entries(repost_future_gle)
def get_serialized_items(self):
serialized_items = []
@@ -261,7 +261,7 @@
future_stock_vouchers = get_future_stock_vouchers(posting_date, posting_time, for_warehouses, for_items)
gle = get_voucherwise_gl_entries(future_stock_vouchers, posting_date)
-
+
for voucher_type, voucher_no in future_stock_vouchers:
existing_gle = gle.get((voucher_type, voucher_no), [])
voucher_obj = frappe.get_doc(voucher_type, voucher_no)
diff --git a/erpnext/manufacturing/doctype/operation/operation.py b/erpnext/manufacturing/doctype/operation/operation.py
index 2c75fee..69e8329 100644
--- a/erpnext/manufacturing/doctype/operation/operation.py
+++ b/erpnext/manufacturing/doctype/operation/operation.py
@@ -2,13 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
class Operation(Document):
- def calculate_op_cost(self):
- if self.hour_rate and self.time_in_mins:
- self.operating_cost = flt(self.hour_rate) * flt(self.time_in_mins) / 60.0
- else :
- self.operating_cost = 0
-
+ def validate(self):
+ if not self.description:
+ self.description = self.name
diff --git a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
index 3493ccf..00bf934 100644
--- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
+++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
@@ -58,7 +58,7 @@
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
- "reqd": 0,
+ "reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -85,7 +85,7 @@
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -539,7 +539,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-11 03:28:04.235889",
+ "modified": "2016-08-22 03:41:42.356833",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order Operation",
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index b802656..d00980f 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -16,7 +16,6 @@
time_sheet = make_timesheet(data.production_order)
args = get_timelog_data(data)
add_timesheet_detail(time_sheet, args)
- time_sheet.docstatus = data.docstatus
time_sheet.note = data.note
time_sheet.company = company
@@ -25,6 +24,15 @@
time_sheet.calculate_total_amounts()
time_sheet.flags.ignore_validate = True
time_sheet.save(ignore_permissions=True)
+
+ # To ignore validate_mandatory_fields function
+ if data.docstatus == 1:
+ time_sheet.db_set("docstatus", 1)
+ for d in time_sheet.get("time_logs"):
+ d.db_set("docstatus", 1)
+ time_sheet.update_production_order(time_sheet.name)
+ time_sheet.update_task_and_project()
+
def get_timelog_data(data):
return {
diff --git a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
index f64f400..2aa6f04 100644
--- a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
+++ b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
@@ -9,12 +9,13 @@
frappe.reload_doc('website', 'doctype', 'portal_menu_item')
frappe.reload_doc('buying', 'doctype', 'request_for_quotation')
- if 'schools' in frappe.get_installed_apps():
+ if frappe.db.exists("Module Def", "Academics") \
+ and frappe.db.get_value("Module Def", "Academics", "app_name") == "schools":
frappe.db.sql("""delete from `tabDesktop Icon`""")
if not frappe.db.exists('Module Def', 'Schools') and frappe.db.exists('Module Def', 'Academics'):
frappe.rename_doc("Module Def", "Academics", "Schools")
-
+
remove_from_installed_apps("schools")
def reload_doctypes_for_schools_icons():
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
index ac59e06..cdf7263 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
@@ -84,7 +84,7 @@
self.update_landed_cost()
def update_landed_cost(self):
- for d in self.get("items"):
+ for d in self.get("purchase_receipts"):
doc = frappe.get_doc(d.receipt_document_type, d.receipt_document)
# set landed cost voucher amount in pr item
@@ -103,7 +103,7 @@
# update stock & gl entries for cancelled state of PR
doc.docstatus = 2
doc.update_stock_ledger(allow_negative_stock=True, via_landed_cost_voucher=True)
- doc.make_gl_entries_on_cancel()
+ doc.make_gl_entries_on_cancel(repost_future_gle=False)
# update stock & gl entries for submit state of PR