2015-01-05 10:31:57 +00:00
|
|
|
|
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
frappe.reload_doc('accounts', 'doctype', 'mode_of_payment')
|
2015-01-19 10:50:26 +00:00
|
|
|
frappe.reload_doc('accounts', 'doctype', 'mode_of_payment_account')
|
2015-01-05 10:31:57 +00:00
|
|
|
|
|
|
|
mode_of_payment_list = frappe.db.sql("""select name, default_account
|
|
|
|
from `tabMode of Payment`""", as_dict=1)
|
|
|
|
|
|
|
|
for d in mode_of_payment_list:
|
|
|
|
if d.get("default_account"):
|
|
|
|
parent_doc = frappe.get_doc("Mode of Payment", d.get("name"))
|
|
|
|
|
2015-01-19 10:50:26 +00:00
|
|
|
parent_doc.set("accounts",
|
2015-01-14 06:36:20 +00:00
|
|
|
[{"company": frappe.db.get_value("Account", d.get("default_account"), "company"),
|
2015-01-05 10:31:57 +00:00
|
|
|
"default_account": d.get("default_account")}])
|
|
|
|
parent_doc.save()
|