mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 00:01:18 +00:00
Merge pull request #6868 from frappe/pos_payments_base_amount
[patch] Set base amount in Sales Invoice Payment table
This commit is contained in:
@@ -322,3 +322,4 @@ finally:erpnext.patches.v7_0.update_timesheet_communications
|
|||||||
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
|
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
|
||||||
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
|
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
|
||||||
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
||||||
|
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.utils import flt
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
si_list = frappe.db.sql("""
|
||||||
|
select distinct parent
|
||||||
|
from `tabSales Invoice Payment`
|
||||||
|
where docstatus!=2 and amount != 0 and base_amount = 0
|
||||||
|
""")
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
for d in si_list:
|
||||||
|
si = frappe.get_doc("Sales Invoice", d[0])
|
||||||
|
for p in si.get("payments"):
|
||||||
|
if p.amount and not p.base_amount:
|
||||||
|
base_amount = flt(p.amount*si.conversion_rate, si.precision("base_paid_amount"))
|
||||||
|
frappe.db.set_value("Sales Invoice Payment", p.name, "base_amount", base_amount, update_modified=False)
|
||||||
|
|
||||||
|
count +=1
|
||||||
|
|
||||||
|
if count % 200 == 0:
|
||||||
|
frappe.db.commit()
|
||||||
Reference in New Issue
Block a user