mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 22:21:31 +01:00
fix: mode of payment fetched from pos profile company in POS
(cherry picked from commit 1bdd43d0f6)
This commit is contained in:
@@ -130,6 +130,7 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex
|
|||||||
args: { "pos_profile": frm.pos_profile },
|
args: { "pos_profile": frm.pos_profile },
|
||||||
callback: ({ message: profile }) => {
|
callback: ({ message: profile }) => {
|
||||||
this.update_customer_groups_settings(profile?.customer_groups);
|
this.update_customer_groups_settings(profile?.customer_groups);
|
||||||
|
this.frm.set_value("company", profile?.company);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class POSInvoice(SalesInvoice):
|
|||||||
self.validate_pos()
|
self.validate_pos()
|
||||||
self.validate_payment_amount()
|
self.validate_payment_amount()
|
||||||
self.validate_loyalty_transaction()
|
self.validate_loyalty_transaction()
|
||||||
|
self.validate_company_with_pos_company()
|
||||||
if self.coupon_code:
|
if self.coupon_code:
|
||||||
from erpnext.accounts.doctype.pricing_rule.utils import validate_coupon_code
|
from erpnext.accounts.doctype.pricing_rule.utils import validate_coupon_code
|
||||||
|
|
||||||
@@ -370,6 +371,14 @@ class POSInvoice(SalesInvoice):
|
|||||||
if total_amount_in_payments and total_amount_in_payments < invoice_total:
|
if total_amount_in_payments and total_amount_in_payments < invoice_total:
|
||||||
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
|
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
|
||||||
|
|
||||||
|
def validate_company_with_pos_company(self):
|
||||||
|
if self.company != frappe.db.get_value("POS Profile", self.pos_profile, "company"):
|
||||||
|
frappe.throw(
|
||||||
|
_("Company {} does not match with POS Profile Company {}").format(
|
||||||
|
self.company, frappe.db.get_value("POS Profile", self.pos_profile, "company")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def validate_loyalty_transaction(self):
|
def validate_loyalty_transaction(self):
|
||||||
if self.redeem_loyalty_points and (
|
if self.redeem_loyalty_points and (
|
||||||
not self.loyalty_redemption_account or not self.loyalty_redemption_cost_center
|
not self.loyalty_redemption_account or not self.loyalty_redemption_cost_center
|
||||||
@@ -448,6 +457,7 @@ class POSInvoice(SalesInvoice):
|
|||||||
profile = {}
|
profile = {}
|
||||||
if self.pos_profile:
|
if self.pos_profile:
|
||||||
profile = frappe.get_doc("POS Profile", self.pos_profile)
|
profile = frappe.get_doc("POS Profile", self.pos_profile)
|
||||||
|
self.company = profile.get("company")
|
||||||
|
|
||||||
if not self.get("payments") and not for_validate:
|
if not self.get("payments") and not for_validate:
|
||||||
update_multi_mode_option(self, profile)
|
update_multi_mode_option(self, profile)
|
||||||
|
|||||||
Reference in New Issue
Block a user