brotherton-erpnext/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
Saqib ac9e6ff704
fix(pos): multiple pos fixes and additions (#24227)
* fix: make custom fields in pos invoice similar to sales invoice

* feat: allow/disallow rate & discount change

* fix: any pos profile can be selected while creating pos opening

* fix: cannot add item to cart

* fix: validate phone payment only if payment request exists

* fix: replace pos payment method patch

* chore: rearrange item & customer group filter

* fix: allow/disallow invoice level discount

* fix: updating qty of item with uom having space char

* fix: move configuration checbox to config section

* fix: invalid item rate trigger

* fix: cannot remove item from draft invoices

* fix: customer currency not set in pos invoice

* fix: duplicate item error message

* fix: sales uom not fetched in pos invoice

* fix: cannot add taxes to pos invoice for uae region

* fix: cannot merge pos invoice into credit note

* fix: tax calculation while merging pos invoices

* feat: delete draft orders from order list

* fix: merging of pos invoice with pricing rules
2021-01-28 17:58:55 +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)