[fix] [patch] party model patch

This commit is contained in:
Anand Doshi 2015-04-02 17:42:02 +05:30
parent 750ceedbc1
commit 5445c460b7
3 changed files with 19 additions and 3 deletions

View File

@ -102,6 +102,7 @@ execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
erpnext.patches.v5_0.rename_table_fieldnames
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
erpnext.patches.v4_2.party_model
erpnext.patches.v5_0.party_model_patch_fix
erpnext.patches.v4_1.fix_jv_remarks
erpnext.patches.v4_2.update_landed_cost_voucher
erpnext.patches.v4_2.set_item_has_batch

View File

@ -0,0 +1,18 @@
from __future__ import unicode_literals
import frappe
def execute():
for company in frappe.get_all("Company",
["name", "default_receivable_account", "default_payable_account"]):
if company.default_receivable_account:
frappe.db.sql("""update `tabSales Invoice` invoice set `debit_to`=%(account)s
where company=%(company)s
and not exists (select name from `tabAccount` account where account.name=invoice.debit_to)""",
{"company": company.name, "account": company.default_receivable_account})
if company.default_payable_account:
frappe.db.sql("""update `tabPurchase Invoice` invoice set `credit_to`=%(account)s
where company=%(company)s
and not exists (select name from `tabAccount` account where account.name=invoice.credit_to)""",
{"company": company.name, "account": company.default_payable_account})

View File

@ -157,9 +157,6 @@ rename_map = {
["pp_so_details", "sales_orders"],
["pp_details", "items"]
],
"Project": [
["project_milestones", "milestones"]
],
"Quality Inspection": [
["qa_specification_details", "readings"]
],