brotherton-erpnext/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
Nabin Hait d46b23699c
fix: optimize reposting of gle and sle (#24702)
* fix(india): escape for special characters in JSON (#24695)

JSON does not accept special whitespace characters like tab, carriage
return, line feed

Ref: https://www.ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf

Related issue: ISS-20-21-09811

* fix: Accounting Dimension creation background job timeout

* fix(regional): vehicle no is mandatory for ewaybill generation (#24679)

* fix: vehicle no required for e-invoice

* fix: ewaybill generation dialog condition

* fix: excluding unidentified accounts from gstr-1

* fix: optimize reposting of sle and gle (#24694)

* fix: optimize update_gl_entries_after method

* fix: Optimized reposting patch

* fix: accounting dimensions

* added reload_doc in patch

* Update item_reposting_for_incorrect_sl_and_gl.py

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>

* fix: Replaced spaces with tabs

* fix: merge conflict

* fix: test cases

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
Co-authored-by: Saqib <nextchamp.saqib@gmail.com>
Co-authored-by: pateljannat <pateljannat2308@gmail.com>
Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
2021-02-23 16:38:52 +05:30

28 lines
1.1 KiB
Python

# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "pos_payment_method")
pos_profiles = frappe.get_all("POS Profile")
for pos_profile in pos_profiles:
payments = frappe.db.sql("""
select idx, parentfield, parenttype, parent, mode_of_payment, `default` from `tabSales Invoice Payment` where parent=%s
""", pos_profile.name, as_dict=1)
if payments:
for payment_mode in payments:
pos_payment_method = frappe.new_doc("POS Payment Method")
pos_payment_method.idx = payment_mode.idx
pos_payment_method.default = payment_mode.default
pos_payment_method.mode_of_payment = payment_mode.mode_of_payment
pos_payment_method.parent = payment_mode.parent
pos_payment_method.parentfield = payment_mode.parentfield
pos_payment_method.parenttype = payment_mode.parenttype
pos_payment_method.db_insert()
frappe.db.sql("""delete from `tabSales Invoice Payment` where parent=%s""", pos_profile.name)