[patch] Set party account currency in existing orders
This commit is contained in:
parent
b2206d1155
commit
ee8f88d641
@ -245,3 +245,4 @@ erpnext.patches.v6_12.set_overdue_tasks
|
||||
erpnext.patches.v6_16.update_billing_status_in_dn_and_pr
|
||||
erpnext.patches.v6_16.create_manufacturer_records
|
||||
execute:frappe.db.sql("update `tabPricing Rule` set title=name where title='' or title is null") #2016-01-27
|
||||
erpnext.patches.v6_20.set_party_account_currency_in_orders
|
0
erpnext/patches/v6_20/__init__.py
Normal file
0
erpnext/patches/v6_20/__init__.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for doctype in ("Sales Order", "Purchase Order"):
|
||||
frappe.reload_doctype(doctype)
|
||||
|
||||
for order in frappe.db.sql("""select name, {0} as party from `tab{1}`
|
||||
where advance_paid > 0 and docstatus=1"""
|
||||
.format(("customer" if doctype=="Sales Order" else "supplier"), doctype), as_dict=1):
|
||||
|
||||
party_account_currency = frappe.db.get_value("Journal Entry Account", {
|
||||
"reference_type": doctype,
|
||||
"reference_name": order.name,
|
||||
"party": order.party,
|
||||
"docstatus": 1,
|
||||
"is_advance": "Yes"
|
||||
}, "account_currency")
|
||||
|
||||
frappe.db.set_value(doctype, order.name, "party_account_currency", party_account_currency)
|
||||
|
Loading…
Reference in New Issue
Block a user