Patch fixed

This commit is contained in:
Nabin Hait 2016-09-06 17:47:05 +05:30
parent 3cdc74e3b0
commit f79d7188de
2 changed files with 13 additions and 3 deletions

View File

@ -5,8 +5,17 @@ def execute():
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount from
`tabSales Invoice` where is_pos = 1 and docstatus < 2 and cash_bank_account is not null""", as_dict=1):
for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount, company
from `tabSales Invoice`
where is_pos = 1 and docstatus < 2
and cash_bank_account is not null and cash_bank_account != ''""", as_dict=1):
if not data.mode_of_payment and not frappe.db.exists("Mode of Payment", "Cash"):
mop = frappe.new_doc("Mode of Payment")
mop.mode_of_payment = "Cash"
mop.type = "Cash"
mop.save()
si_doc = frappe.get_doc('Sales Invoice', data.name)
si_doc.append('payments', {
'mode_of_payment': data.mode_of_payment or 'Cash',

View File

@ -9,7 +9,8 @@ def execute():
return
for expense_claim_type in frappe.get_all("Expense Claim Type", fields=["name", "default_account"]):
if expense_claim_type.default_account:
if expense_claim_type.default_account \
and frappe.db.exists("Account", expense_claim_type.default_account):
doc = frappe.get_doc("Expense Claim Type", expense_claim_type.name)
doc.append("accounts", {
"company": frappe.db.get_value("Account", expense_claim_type.default_account, "company"),