- {%= dateutil.str_to_user(data[i][__("Posting Date")]) %} |
- {%= data[i][__("Journal Entry")] %} |
- {%= __("Against") %}: {%= data[i][__("Against Account")] %}
- {% if (data[i][__("Reference")]) { %}
- {%= __("Reference") %}: {%= data[i][__("Reference")] %}
- {% if (data[i][__("Ref Date")]) { %}
- {%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i][__("Ref Date")]) %}
+ | {%= dateutil.str_to_user(data[i]["posting_date"]) %} |
+ {%= data[i]["journal_entry"] %} |
+ {%= __("Against") %}: {%= data[i]["against_account"] %}
+ {% if (data[i]["reference"]) { %}
+ {%= __("Reference") %}: {%= data[i]["reference"] %}
+ {% if (data[i]["ref_date"]) { %}
+ {%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i]["ref_date"]) %}
{% } %}
{% } %}
- {% if (data[i][__("Clearance Date")]) { %}
- {%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i][__("Clearance Date")]) %}
+ {% if (data[i]["clearance_date"]) { %}
+ {%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i]["clearance_date"]) %}
{% } %}
|
- {%= format_currency(data[i][__("Debit")]) %} |
- {%= format_currency(data[i][__("Credit")]) %} |
+ {%= format_currency(data[i]["debit"]) %} |
+ {%= format_currency(data[i]["credit"]) %} |
{% } else { %}
|
|
- {%= data[i][__("Journal Entry")] %} |
- {%= format_currency(data[i][__("Debit")]) %} |
- {%= format_currency(data[i][__("Credit")]) %} |
+ {%= data[i]["journal_entry"] %} |
+ {%= format_currency(data[i]["debit"]) %} |
+ {%= format_currency(data[i]["credit"]) %} |
{% } %}
{% } %}
From 70ed6ede5c83704f041fcc617d293578b8e05fb0 Mon Sep 17 00:00:00 2001
From: Saurabh
Date: Tue, 8 Dec 2015 14:02:53 +0530
Subject: [PATCH 7/9] [fixes] patch to update delivery status for drop ship
item
---
.../doctype/purchase_order/purchase_order.py | 10 ++--------
erpnext/controllers/status_updater.py | 9 +++++----
erpnext/patches.txt | 3 ++-
.../fix_delivery_status_of_drop_ship_item.py | 17 +++++++++++++++++
.../selling/doctype/sales_order/sales_order.py | 12 +++++++-----
5 files changed, 33 insertions(+), 18 deletions(-)
create mode 100644 erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index fcf463b991..b10b72f3fb 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -159,7 +159,6 @@ class PurchaseOrder(BuyingController):
def on_cancel(self):
if self.has_drop_ship_item():
self.update_status_updater()
- self.reset_received_qty_for_drop_ship_items()
self.update_delivered_qty_in_sales_order()
pc_obj = frappe.get_doc('Purchase Common')
@@ -218,7 +217,7 @@ class PurchaseOrder(BuyingController):
for so_name in sales_orders_to_update:
so = frappe.get_doc("Sales Order", so_name)
- so.update_delivery_status(self.name)
+ so.update_delivery_status()
so.set_status(update=True)
so.notify_update()
@@ -235,12 +234,7 @@ class PurchaseOrder(BuyingController):
for item in self.items:
if item.delivered_by_supplier == 1:
item.received_qty = item.qty
-
- def reset_received_qty_for_drop_ship_items(self):
- for item in self.items:
- if item.delivered_by_supplier == 1:
- frappe.db.set_value("Purchase Order Item", item.name, "received_qty", 0.0)
-
+
@frappe.whitelist()
def stop_or_unstop_purchase_orders(names, status):
if not frappe.has_permission("Purchase Order", "write"):
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index eb8d5e9574..73e9d7f0ee 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -76,10 +76,10 @@ class StatusUpdater(Document):
self.update_qty()
self.validate_qty()
- def set_status(self, update=False, status=None):
+ def set_status(self, update=False, status=None, update_modified=True):
if self.is_new():
return
-
+
if self.doctype in status_map:
_status = self.status
@@ -102,9 +102,10 @@ class StatusUpdater(Document):
if self.status != _status and self.status not in ("Submitted", "Cancelled"):
self.add_comment("Label", _(self.status))
-
+
if update:
- frappe.db.set_value(self.doctype, self.name, "status", self.status)
+ frappe.db.set_value(self.doctype, self.name, "status", self.status,
+ update_modified=update_modified)
def validate_qty(self):
"""Validates qty at row level"""
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index cd38e67e2c..302a33866c 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -237,4 +237,5 @@ erpnext.patches.v6_8.move_drop_ship_to_po_items
erpnext.patches.v6_10.fix_ordered_received_billed
erpnext.patches.v6_10.fix_jv_total_amount #2015-11-30
erpnext.patches.v6_10.email_digest_default_quote
-erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po
\ No newline at end of file
+erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po
+erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item
\ No newline at end of file
diff --git a/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py
new file mode 100644
index 0000000000..a54d0ab389
--- /dev/null
+++ b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py
@@ -0,0 +1,17 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ sales_orders_to_update = []
+
+ for item in frappe.get_all("Purchase Order Item", filters={"delivered_by_supplier": 1},
+ fields=["prevdoc_doctype", "prevdoc_docname"]):
+
+ if item.prevdoc_doctype == "Sales Order":
+ if item.prevdoc_docname not in sales_orders_to_update:
+ sales_orders_to_update.append(item.prevdoc_docname)
+
+ for so_name in sales_orders_to_update:
+ so = frappe.get_doc("Sales Order", so_name)
+ so.update_delivery_status()
+ so.set_status(update=True, update_modified=False)
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 6d396bd438..7712f5ebe6 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -265,27 +265,29 @@ class SalesOrder(SellingController):
if exc_list:
frappe.throw('\n'.join(exc_list))
- def update_delivery_status(self, po_name):
+ def update_delivery_status(self):
"""Update delivery status from Purchase Order for drop shipping"""
tot_qty, delivered_qty = 0.0, 0.0
for item in self.items:
if item.delivered_by_supplier:
- item_delivered_qty = frappe.db.sql("""select received_qty
+ item_delivered_qty = frappe.db.sql("""select sum(qty)
from `tabPurchase Order Item` poi, `tabPurchase Order` po
where poi.prevdoc_detail_docname = %s
and poi.prevdoc_doctype = 'Sales Order'
and poi.item_code = %s
and poi.parent = po.name
+ and po.docstatus = 1
and po.status = 'Delivered'""", (item.name, item.item_code))
item_delivered_qty = item_delivered_qty[0][0] if item_delivered_qty else 0
- item.db_set("delivered_qty", item_delivered_qty)
+ item.db_set("delivered_qty", flt(item_delivered_qty), update_modified=False)
delivered_qty += item.delivered_qty
tot_qty += item.qty
-
- frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100)
+
+ frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100,
+ update_modified=False)
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
From 41c8cf645ae38e201646523a43aab5f38af426f9 Mon Sep 17 00:00:00 2001
From: Nabin Hait
Date: Tue, 8 Dec 2015 14:50:24 +0530
Subject: [PATCH 8/9] [fix] Get incoming rate if args as json
---
erpnext/stock/utils.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 0d95c58337..3f9de86493 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -92,6 +92,9 @@ def update_bin(args, allow_negative_stock=False, via_landed_cost_voucher=False):
def get_incoming_rate(args):
"""Get Incoming Rate based on valuation method"""
from erpnext.stock.stock_ledger import get_previous_sle
+
+ if isinstance(args, basestring):
+ args = json.loads(args)
in_rate = 0
if (args.get("serial_no") or "").strip():
From d56ec926825d6708e36d034892d3b028e756cd99 Mon Sep 17 00:00:00 2001
From: Nabin Hait
Date: Tue, 8 Dec 2015 16:10:17 +0600
Subject: [PATCH 9/9] bumped to version 6.12.5
---
erpnext/__version__.py | 2 +-
erpnext/hooks.py | 2 +-
setup.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index e0496c667e..b9ede7a74b 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
from __future__ import unicode_literals
-__version__ = '6.12.4'
+__version__ = '6.12.5'
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 22a093dc77..1d3e659a92 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple"""
app_icon = "icon-th"
app_color = "#e74c3c"
-app_version = "6.12.4"
+app_version = "6.12.5"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext"
diff --git a/setup.py b/setup.py
index 56c5b7ddf1..7bf702727d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-version = "6.12.4"
+version = "6.12.5"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()