mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
Merge branch 'version-13-hotfix' into mergify/bp/version-13-hotfix/pr-30837
This commit is contained in:
@@ -161,17 +161,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
super(PurchaseInvoice, self).set_missing_values(for_validate)
|
super(PurchaseInvoice, self).set_missing_values(for_validate)
|
||||||
|
|
||||||
def check_conversion_rate(self):
|
|
||||||
default_currency = erpnext.get_company_currency(self.company)
|
|
||||||
if not default_currency:
|
|
||||||
throw(_("Please enter default currency in Company Master"))
|
|
||||||
if (
|
|
||||||
(self.currency == default_currency and flt(self.conversion_rate) != 1.00)
|
|
||||||
or not self.conversion_rate
|
|
||||||
or (self.currency != default_currency and flt(self.conversion_rate) == 1.00)
|
|
||||||
):
|
|
||||||
throw(_("Conversion rate cannot be 0 or 1"))
|
|
||||||
|
|
||||||
def validate_credit_to_acc(self):
|
def validate_credit_to_acc(self):
|
||||||
if not self.credit_to:
|
if not self.credit_to:
|
||||||
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
|
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ class SalesInvoice(SellingController):
|
|||||||
self.set_income_account_for_fixed_assets()
|
self.set_income_account_for_fixed_assets()
|
||||||
self.validate_item_cost_centers()
|
self.validate_item_cost_centers()
|
||||||
self.validate_income_account()
|
self.validate_income_account()
|
||||||
|
self.check_conversion_rate()
|
||||||
|
|
||||||
validate_inter_company_party(
|
validate_inter_company_party(
|
||||||
self.doctype, self.customer, self.company, self.inter_company_invoice_reference
|
self.doctype, self.customer, self.company, self.inter_company_invoice_reference
|
||||||
|
|||||||
@@ -1612,6 +1612,17 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(gle)
|
self.assertTrue(gle)
|
||||||
|
|
||||||
|
def test_invoice_exchange_rate(self):
|
||||||
|
si = create_sales_invoice(
|
||||||
|
customer="_Test Customer USD",
|
||||||
|
debit_to="_Test Receivable USD - _TC",
|
||||||
|
currency="USD",
|
||||||
|
conversion_rate=1,
|
||||||
|
do_not_save=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertRaises(frappe.ValidationError, si.save)
|
||||||
|
|
||||||
def test_invalid_currency(self):
|
def test_invalid_currency(self):
|
||||||
# Customer currency = USD
|
# Customer currency = USD
|
||||||
|
|
||||||
|
|||||||
@@ -1846,6 +1846,17 @@ class AccountsController(TransactionBase):
|
|||||||
jv.save()
|
jv.save()
|
||||||
jv.submit()
|
jv.submit()
|
||||||
|
|
||||||
|
def check_conversion_rate(self):
|
||||||
|
default_currency = erpnext.get_company_currency(self.company)
|
||||||
|
if not default_currency:
|
||||||
|
throw(_("Please enter default currency in Company Master"))
|
||||||
|
if (
|
||||||
|
(self.currency == default_currency and flt(self.conversion_rate) != 1.00)
|
||||||
|
or not self.conversion_rate
|
||||||
|
or (self.currency != default_currency and flt(self.conversion_rate) == 1.00)
|
||||||
|
):
|
||||||
|
throw(_("Conversion rate cannot be 0 or 1"))
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_tax_rate(account_head):
|
def get_tax_rate(account_head):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"autoname": "autoincrement",
|
"autoname": "hash",
|
||||||
"creation": "2022-05-31 17:34:39.825537",
|
"creation": "2022-05-31 17:34:39.825537",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-06-06 14:50:35.161062",
|
"modified": "2022-06-20 15:10:15.826571",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Update Batch",
|
"name": "BOM Update Batch",
|
||||||
@@ -50,6 +50,5 @@
|
|||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC"
|
||||||
"states": []
|
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,9 @@ def validate_eligibility(doc):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
invalid_company = not frappe.db.get_value("E Invoice User", {"company": doc.get("company")})
|
invalid_company = not frappe.db.get_value("E Invoice User", {"company": doc.get("company")})
|
||||||
|
invalid_company_gstin = not frappe.db.get_value(
|
||||||
|
"E Invoice User", {"gstin": doc.get("company_gstin")}
|
||||||
|
)
|
||||||
invalid_supply_type = doc.get("gst_category") not in [
|
invalid_supply_type = doc.get("gst_category") not in [
|
||||||
"Registered Regular",
|
"Registered Regular",
|
||||||
"Registered Composition",
|
"Registered Composition",
|
||||||
@@ -72,6 +75,7 @@ def validate_eligibility(doc):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
invalid_company
|
invalid_company
|
||||||
|
or invalid_company_gstin
|
||||||
or invalid_supply_type
|
or invalid_supply_type
|
||||||
or company_transaction
|
or company_transaction
|
||||||
or no_taxes_applied
|
or no_taxes_applied
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Quotation(SellingController):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None):
|
def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None):
|
||||||
if not self.has_sales_order():
|
if not (self.is_fully_ordered() or self.is_partially_ordered()):
|
||||||
get_lost_reasons = frappe.get_list("Quotation Lost Reason", fields=["name"])
|
get_lost_reasons = frappe.get_list("Quotation Lost Reason", fields=["name"])
|
||||||
lost_reasons_lst = [reason.get("name") for reason in get_lost_reasons]
|
lost_reasons_lst = [reason.get("name") for reason in get_lost_reasons]
|
||||||
frappe.db.set(self, "status", "Lost")
|
frappe.db.set(self, "status", "Lost")
|
||||||
|
|||||||
Reference in New Issue
Block a user