remove mode of payment, migrate mode of payment from v6 to v7

This commit is contained in:
Rohit Waghchaure 2016-08-31 15:45:05 +05:30
parent 879cb6ebee
commit 774ce63b75
3 changed files with 166 additions and 29 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ erpnext.patches.v4_0.move_warehouse_user_to_restrictions
erpnext.patches.v4_0.global_defaults_to_system_settings
erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
execute:frappe.reload_doc('stock', 'doctype', 'warehouse')
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
@ -276,6 +276,7 @@ execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatu
execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
erpnext.patches.v7_0.update_mins_to_first_response
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
erpnext.patches.v7_0.migrate_mode_of_payments_v6_to_v7
erpnext.patches.v7_0.system_settings_setup_complete
erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
execute:frappe.reload_doc('projects', 'doctype', 'project')

View File

@ -0,0 +1,20 @@
from __future__ import unicode_literals
import frappe
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):
si_doc = frappe.get_doc('Sales Invoice', data.name)
si_doc.append('payments', {
'mode_of_payment': data.mode_of_payment or 'Cash',
'account': data.cash_bank_account,
'type': frappe.db.get_value('Mode of Payment', data.mode_of_payment, 'type') or 'Cash',
'amount': data.paid_amount
})
si_doc.set_paid_amount()
si_doc.flags.ignore_validate_update_after_submit = True
si_doc.save()