mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-22 02:46:29 +00:00
fix: resolve conflicts
This commit is contained in:
@@ -3,11 +3,7 @@ import json
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _, qb
|
from frappe import _, qb
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
<<<<<<< HEAD
|
|
||||||
from frappe.query_builder.functions import Abs, Sum
|
from frappe.query_builder.functions import Abs, Sum
|
||||||
=======
|
|
||||||
from frappe.query_builder.functions import Sum
|
|
||||||
>>>>>>> f7face43cd (fix: check payments against orders for getting request amount)
|
|
||||||
from frappe.utils import flt, nowdate
|
from frappe.utils import flt, nowdate
|
||||||
from frappe.utils.background_jobs import enqueue
|
from frappe.utils.background_jobs import enqueue
|
||||||
|
|
||||||
@@ -686,7 +682,6 @@ def get_amount(ref_doc, payment_account=None):
|
|||||||
dt = ref_doc.doctype
|
dt = ref_doc.doctype
|
||||||
if dt in ["Sales Order", "Purchase Order"]:
|
if dt in ["Sales Order", "Purchase Order"]:
|
||||||
grand_total = flt(ref_doc.rounded_total) or flt(ref_doc.grand_total)
|
grand_total = flt(ref_doc.rounded_total) or flt(ref_doc.grand_total)
|
||||||
grand_total -= get_paid_amount_against_order(dt, ref_doc.name)
|
|
||||||
elif dt in ["Sales Invoice", "Purchase Invoice"]:
|
elif dt in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
if not ref_doc.get("is_pos"):
|
if not ref_doc.get("is_pos"):
|
||||||
if ref_doc.party_account_currency == ref_doc.currency:
|
if ref_doc.party_account_currency == ref_doc.currency:
|
||||||
@@ -708,14 +703,10 @@ def get_amount(ref_doc, payment_account=None):
|
|||||||
elif dt == "Fees":
|
elif dt == "Fees":
|
||||||
grand_total = ref_doc.outstanding_amount
|
grand_total = ref_doc.outstanding_amount
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
if grand_total > 0:
|
if grand_total > 0:
|
||||||
return flt(grand_total, get_currency_precision())
|
return flt(grand_total, get_currency_precision())
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Payment Entry is already created"))
|
frappe.throw(_("Payment Entry is already created"))
|
||||||
=======
|
|
||||||
return grand_total
|
|
||||||
>>>>>>> f7face43cd (fix: check payments against orders for getting request amount)
|
|
||||||
|
|
||||||
|
|
||||||
def get_irequest_status(payment_requests: None | list = None) -> list:
|
def get_irequest_status(payment_requests: None | list = None) -> list:
|
||||||
@@ -1005,7 +996,6 @@ def validate_payment(doc, method=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_open_payment_requests_query(doctype, txt, searchfield, start, page_len, filters):
|
def get_open_payment_requests_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
# permission checks in `get_list()`
|
# permission checks in `get_list()`
|
||||||
@@ -1046,27 +1036,3 @@ def get_irequests_of_payment_request(doc: str | None = None) -> list:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
return res
|
return res
|
||||||
=======
|
|
||||||
def get_paid_amount_against_order(dt, dn):
|
|
||||||
pe_ref = frappe.qb.DocType("Payment Entry Reference")
|
|
||||||
if dt == "Sales Order":
|
|
||||||
inv_dt, inv_field = "Sales Invoice Item", "sales_order"
|
|
||||||
else:
|
|
||||||
inv_dt, inv_field = "Purchase Invoice Item", "purchase_order"
|
|
||||||
inv_item = frappe.qb.DocType(inv_dt)
|
|
||||||
return (
|
|
||||||
frappe.qb.from_(pe_ref)
|
|
||||||
.select(
|
|
||||||
Sum(pe_ref.allocated_amount),
|
|
||||||
)
|
|
||||||
.where(
|
|
||||||
(pe_ref.docstatus == 1)
|
|
||||||
& (
|
|
||||||
(pe_ref.reference_name == dn)
|
|
||||||
| pe_ref.reference_name.isin(
|
|
||||||
frappe.qb.from_(inv_item).select(inv_item.parent).where(inv_item[inv_field] == dn).distinct()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
).run()[0][0] or 0
|
|
||||||
>>>>>>> f7face43cd (fix: check payments against orders for getting request amount)
|
|
||||||
|
|||||||
@@ -40,11 +40,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1&order_type=Shopping Cart"
|
<a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1&order_type=Shopping Cart"
|
||||||
class="btn btn-primary btn-sm" id="pay-for-order">
|
class="btn btn-primary btn-sm" id="pay-for-order">
|
||||||
<<<<<<< HEAD
|
{{ _("Pay", null, "Amount") }} {{ pay_amount }}
|
||||||
{{ _("Pay", null, "Amount") }} {{doc.get_formatted("grand_total") }}
|
|
||||||
=======
|
|
||||||
{{ _("Pay") }} {{ pay_amount }}
|
|
||||||
>>>>>>> 7efb5a8cb5 (fix(portal): context pay_amount for button)
|
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,13 +4,10 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
from erpnext.accounts.doctype.payment_request.payment_request import (
|
from erpnext.accounts.doctype.payment_request.payment_request import (
|
||||||
ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST,
|
ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST,
|
||||||
|
get_amount,
|
||||||
)
|
)
|
||||||
=======
|
|
||||||
from erpnext.accounts.doctype.payment_request.payment_request import get_amount
|
|
||||||
>>>>>>> c18ff5bd25 (fix(portal): payment amount for orders)
|
|
||||||
|
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
@@ -54,15 +51,7 @@ def get_context(context):
|
|||||||
)
|
)
|
||||||
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
|
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
context.show_pay_button = (
|
|
||||||
"payments" in frappe.get_installed_apps()
|
|
||||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
|
||||||
and context.doc.doctype in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST
|
|
||||||
)
|
|
||||||
=======
|
|
||||||
context.show_pay_button, context.pay_amount = get_payment_details(context.doc)
|
context.show_pay_button, context.pay_amount = get_payment_details(context.doc)
|
||||||
>>>>>>> c18ff5bd25 (fix(portal): payment amount for orders)
|
|
||||||
context.show_make_pi_button = False
|
context.show_make_pi_button = False
|
||||||
if context.doc.get("supplier"):
|
if context.doc.get("supplier"):
|
||||||
# show Make Purchase Invoice button based on permission
|
# show Make Purchase Invoice button based on permission
|
||||||
@@ -79,10 +68,15 @@ def get_attachments(dt, dn):
|
|||||||
|
|
||||||
def get_payment_details(doc):
|
def get_payment_details(doc):
|
||||||
show_pay_button, amount = (
|
show_pay_button, amount = (
|
||||||
"payments" in frappe.get_installed_apps()
|
(
|
||||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
"payments" in frappe.get_installed_apps()
|
||||||
), 0
|
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||||
|
and doc.doctype in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
)
|
||||||
if not show_pay_button:
|
if not show_pay_button:
|
||||||
return show_pay_button, amount
|
return show_pay_button, amount
|
||||||
|
|
||||||
amount = get_amount(doc)
|
amount = get_amount(doc)
|
||||||
return bool(amount), amount
|
return bool(amount), amount
|
||||||
|
|||||||
Reference in New Issue
Block a user